Skip to content

Pending and without_drafts filter for invoices do not work #10

@einzige

Description

@einzige

@cantino
Other filters work good, these two do not. Always returns same results.

2.0.0-p247 :041 > Mavenlink::Invoice.scoped.filter(pending: true)
I, [2014-04-01T22:34:08.221359 #99449]  INFO -- : [Maven] Started GET /invoices with {"pending"=>true}
I, [2014-04-01T22:34:09.815910 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:34:09.816874 #99449]  INFO -- : {
     "count" => 1,
  "invoices" => {
    "438375" => {
        "balance_in_cents" => 1000,
              "created_at" => "2014-03-21T23:39:24-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                   "draft" => false,
                "due_date" => "2014-04-20",
                      "id" => "438375",
            "invoice_date" => "2014-03-21",
                 "message" => "",
        "payment_schedule" => 30,
            "recipient_id" => nil,
                  "status" => "new",
                   "title" => "Invoice #00001",
              "updated_at" => "2014-03-21T23:39:24-07:00",
                 "user_id" => "4576975"
    }
  },
   "results" => [
    [0] {
       "id" => "438375",
      "key" => "invoices"
    }
  ]
}
#<Mavenlink::Request [<Mavenlink::Invoice:438375>]>
2.0.0-p247 :042 > Mavenlink::Invoice.scoped.filter(pending: false)
I, [2014-04-01T22:34:13.493165 #99449]  INFO -- : [Maven] Started GET /invoices with {"pending"=>false}
I, [2014-04-01T22:34:14.909586 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:34:14.911026 #99449]  INFO -- : {
     "count" => 1,
  "invoices" => {
    "438375" => {
        "balance_in_cents" => 1000,
              "created_at" => "2014-03-21T23:39:24-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                   "draft" => false,
                "due_date" => "2014-04-20",
                      "id" => "438375",
            "invoice_date" => "2014-03-21",
                 "message" => "",
        "payment_schedule" => 30,
            "recipient_id" => nil,
                  "status" => "new",
                   "title" => "Invoice #00001",
              "updated_at" => "2014-03-21T23:39:24-07:00",
                 "user_id" => "4576975"
    }
  },
   "results" => [
    [0] {
       "id" => "438375",
      "key" => "invoices"
    }
  ]
}

Paid filter looks good as opposed to example above:

2.0.0-p247 :043 > Mavenlink::Invoice.scoped.filter(paid: true)
I, [2014-04-01T22:36:30.849263 #99449]  INFO -- : [Maven] Started GET /invoices with {"paid"=>true}
^[[CI, [2014-04-01T22:36:33.300319 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:36:33.301042 #99449]  INFO -- : {
     "count" => 0,
  "invoices" => {},
   "results" => []
}
#<Mavenlink::Request []>
2.0.0-p247 :044 > Mavenlink::Invoice.scoped.filter(paid: false)
I, [2014-04-01T22:36:36.840729 #99449]  INFO -- : [Maven] Started GET /invoices with {"paid"=>false}
I, [2014-04-01T22:36:38.088239 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:36:38.089304 #99449]  INFO -- : {
     "count" => 1,
  "invoices" => {
    "438375" => {
        "balance_in_cents" => 1000,
              "created_at" => "2014-03-21T23:39:24-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                   "draft" => false,
                "due_date" => "2014-04-20",
                      "id" => "438375",
            "invoice_date" => "2014-03-21",
                 "message" => "",
        "payment_schedule" => 30,
            "recipient_id" => nil,
                  "status" => "new",
                   "title" => "Invoice #00001",
              "updated_at" => "2014-03-21T23:39:24-07:00",
                 "user_id" => "4576975"
    }
  },
   "results" => [
    [0] {
       "id" => "438375",
      "key" => "invoices"
    }
  ]
}

Example for drafts:

2.0.0-p247 :045 > Mavenlink::Invoice.scoped.filter(without_drafts: false)
I, [2014-04-01T22:38:10.542436 #99449]  INFO -- : [Maven] Started GET /invoices with {"without_drafts"=>false}
I, [2014-04-01T22:38:12.300270 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:38:12.301341 #99449]  INFO -- : {
     "count" => 1,
  "invoices" => {
    "438375" => {
        "balance_in_cents" => 1000,
              "created_at" => "2014-03-21T23:39:24-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                   "draft" => false,
                "due_date" => "2014-04-20",
                      "id" => "438375",
            "invoice_date" => "2014-03-21",
                 "message" => "",
        "payment_schedule" => 30,
            "recipient_id" => nil,
                  "status" => "new",
                   "title" => "Invoice #00001",
              "updated_at" => "2014-03-21T23:39:24-07:00",
                 "user_id" => "4576975"
    }
  },
   "results" => [
    [0] {
       "id" => "438375",
      "key" => "invoices"
    }
  ]
}
#<Mavenlink::Request [<Mavenlink::Invoice:438375>]>
2.0.0-p247 :046 > Mavenlink::Invoice.scoped.filter(without_drafts: true)
I, [2014-04-01T22:38:18.422283 #99449]  INFO -- : [Maven] Started GET /invoices with {"without_drafts"=>true}
I, [2014-04-01T22:38:19.626527 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:38:19.627821 #99449]  INFO -- : {
     "count" => 1,
  "invoices" => {
    "438375" => {
        "balance_in_cents" => 1000,
              "created_at" => "2014-03-21T23:39:24-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                   "draft" => false,
                "due_date" => "2014-04-20",
                      "id" => "438375",
            "invoice_date" => "2014-03-21",
                 "message" => "",
        "payment_schedule" => 30,
            "recipient_id" => nil,
                  "status" => "new",
                   "title" => "Invoice #00001",
              "updated_at" => "2014-03-21T23:39:24-07:00",
                 "user_id" => "4576975"
    }
  },
   "results" => [
    [0] {
       "id" => "438375",
      "key" => "invoices"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions