Skip to content
Sergei Zinin edited this page Apr 1, 2014 · 5 revisions
Mavenlink::Invoice.scoped.all
I, [2014-04-01T22:31:06.923683 #99449]  INFO -- : [Maven] Started GET /invoices with {}
I, [2014-04-01T22:31:08.736276 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:31:08.737179 #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"
    }
  ]
}
[
  [0] {
      "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"
  }
]
2.0.0-p247 :034 > Mavenlink::Invoice.find(438375)
I, [2014-04-01T22:32:07.242156 #99449]  INFO -- : [Maven] Started GET /invoices with {"only"=>"438375"}
I, [2014-04-01T22:32:08.958902 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:32:08.960432 #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"
    }
  ]
}
{
    "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"
}
2.0.0-p247 :035 > invoice = _
{
    "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"
}
2.0.0-p247 :036 > invoice.destroy
Mavenlink::RecordLockedError: The model is locked and cannot be deleted
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"
    }
  ]
}
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"
    }
  ]
}
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"
    }
  ]
}
Clone this wiki locally