Skip to content
Sergei Zinin edited this page Apr 1, 2014 · 4 revisions
2.0.0-p247 :001 > Mavenlink::Expense.scoped.all
I, [2014-04-01T22:11:00.168979 #99449]  INFO -- : [Maven] Started GET /expenses with {}
I, [2014-04-01T22:11:02.168850 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:11:02.169909 #99449]  INFO -- : {
     "count" => 1,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :002 > Mavenlink::Expense.find 21316325
I, [2014-04-01T22:11:29.592133 #99449]  INFO -- : [Maven] Started GET /expenses with {"only"=>"21316325"}
I, [2014-04-01T22:11:30.881454 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:11:30.882445 #99449]  INFO -- : {
     "count" => 1,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
{
     "amount_in_cents" => 123,
            "category" => "Travel",
          "created_at" => "2014-04-01T00:40:33-07:00",
            "currency" => "USD",
  "currency_base_unit" => 100,
     "currency_symbol" => "$",
                "date" => "2013-02-19",
                  "id" => "21316325",
         "is_billable" => false,
         "is_invoiced" => false,
               "notes" => nil,
          "updated_at" => "2014-04-01T00:40:33-07:00",
       "user_can_edit" => true,
             "user_id" => "4576975",
        "workspace_id" => "4894095"
}
2.0.0-p247 :003 > expense = _
{
     "amount_in_cents" => 123,
            "category" => "Travel",
          "created_at" => "2014-04-01T00:40:33-07:00",
            "currency" => "USD",
  "currency_base_unit" => 100,
     "currency_symbol" => "$",
                "date" => "2013-02-19",
                  "id" => "21316325",
         "is_billable" => false,
         "is_invoiced" => false,
               "notes" => nil,
          "updated_at" => "2014-04-01T00:40:33-07:00",
       "user_can_edit" => true,
             "user_id" => "4576975",
        "workspace_id" => "4894095"
}
2.0.0-p247 :004 > expense.class
Mavenlink::Expense < Mavenlink::Model
2.0.0-p247 :005 > Mavenlink::Expense.create(workspace_id: 4894095, date: '2015-01-01', category: 'Travel', amount_in_cents: 1)
I, [2014-04-01T22:13:14.861962 #99449]  INFO -- : [Maven] Started POST /expenses with {"expense"=>{"workspace_id"=>4894095, "date"=>"2015-01-01", "category"=>"Travel", "amount_in_cents"=>1}}
I, [2014-04-01T22:13:17.029335 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:13:17.030505 #99449]  INFO -- : {
     "count" => 1,
  "expenses" => {
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    }
  ]
}
{
     "amount_in_cents" => 1,
            "category" => "Travel",
          "created_at" => "2014-04-01T07:13:16-07:00",
            "currency" => "USD",
  "currency_base_unit" => 100,
     "currency_symbol" => "$",
                "date" => "2015-01-01",
                  "id" => "21336035",
         "is_billable" => false,
         "is_invoiced" => false,
               "notes" => nil,
          "updated_at" => "2014-04-01T07:13:16-07:00",
       "user_can_edit" => true,
             "user_id" => "4576975",
        "workspace_id" => "4894095"
}
2.0.0-p247 :006 > expense = _
{
     "amount_in_cents" => 1,
            "category" => "Travel",
          "created_at" => "2014-04-01T07:13:16-07:00",
            "currency" => "USD",
  "currency_base_unit" => 100,
     "currency_symbol" => "$",
                "date" => "2015-01-01",
                  "id" => "21336035",
         "is_billable" => false,
         "is_invoiced" => false,
               "notes" => nil,
          "updated_at" => "2014-04-01T07:13:16-07:00",
       "user_can_edit" => true,
             "user_id" => "4576975",
        "workspace_id" => "4894095"
}
2.0.0-p247 :007 > Mavenlink::Expense.scoped.all
I, [2014-04-01T22:13:32.324708 #99449]  INFO -- : [Maven] Started GET /expenses with {}
I, [2014-04-01T22:13:33.638779 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:13:33.640329 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    },
    [1] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :008 > Mavenlink::Expense.scoped.order(:date).all
I, [2014-04-01T22:13:46.388491 #99449]  INFO -- : [Maven] Started GET /expenses with {"order"=>"date"}
I, [2014-04-01T22:13:55.294293 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:13:55.295617 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21316325",
      "key" => "expenses"
    },
    [1] {
       "id" => "21336035",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :009 > Mavenlink::Expense.scoped.order(:date, :desc).all
I, [2014-04-01T22:14:07.274213 #99449]  INFO -- : [Maven] Started GET /expenses with {"order"=>"date:desc"}
I, [2014-04-01T22:14:08.486866 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:14:08.488281 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    },
    [1] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :017 > Mavenlink::Expense.create(workspace_id: 4906855, date: '2015-01-01', category: 'Travel', amount_in_cents: 2)
I, [2014-04-01T22:19:05.191559 #99449]  INFO -- : [Maven] Started POST /expenses with {"expense"=>{"workspace_id"=>4906855, "date"=>"2015-01-01", "category"=>"Travel", "amount_in_cents"=>2}}
I, [2014-04-01T22:19:07.151547 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:19:07.152044 #99449]  INFO -- : {
  "errors" => [
    [0] {
        "field" => "base",
      "message" => "Time and Expenses require a budgeted workspace",
         "type" => "validation"
    }
  ]
}
I, [2014-04-01T22:19:07.152091 #99449]  INFO -- : [Maven] REQUEST FAILED:
I, [2014-04-01T22:19:07.152419 #99449]  INFO -- : [
  [0] {
      "field" => "base",
    "message" => "Time and Expenses require a budgeted workspace",
       "type" => "validation"
  }
]
Mavenlink::InvalidRequestError: {"errors"=>[{"type"=>"validation", "field"=>"base", "message"=>"Time and Expenses require a budgeted workspace"}]}
2.0.0-p247 :010 > Mavenlink::Expense.scoped.filter(from_archived_workspaces: true).all
I, [2014-04-01T22:14:58.019563 #99449]  INFO -- : [Maven] Started GET /expenses with {"from_archived_workspaces"=>true}
I, [2014-04-01T22:15:06.944734 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:15:06.946114 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    },
    [1] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :011 > Mavenlink::Expense.scoped.filter(from_archived_workspaces: false).all
I, [2014-04-01T22:15:15.709791 #99449]  INFO -- : [Maven] Started GET /expenses with {"from_archived_workspaces"=>false}
I, [2014-04-01T22:15:16.904365 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:15:16.906461 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    },
    [1] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :021 >   Mavenlink::Expense.scoped.filter(workspace_id: 1).all
I, [2014-04-01T22:23:14.300525 #99449]  INFO -- : [Maven] Started GET /expenses with {"workspace_id"=>1}
I, [2014-04-01T22:23:16.076924 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:23:16.077389 #99449]  INFO -- : {
     "count" => 0,
  "expenses" => {},
   "results" => []
}
[]
2.0.0-p247 :022 > Mavenlink::Expense.scoped.filter(workspace_id: 4906855).all
I, [2014-04-01T22:23:28.160908 #99449]  INFO -- : [Maven] Started GET /expenses with {"workspace_id"=>4906855}
I, [2014-04-01T22:23:29.438243 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:23:29.438844 #99449]  INFO -- : {
     "count" => 0,
  "expenses" => {},
   "results" => []
}
[]
2.0.0-p247 :023 > Mavenlink::Expense.scoped.filter(workspace_id: 4894095).all
I, [2014-04-01T22:23:52.183847 #99449]  INFO -- : [Maven] Started GET /expenses with {"workspace_id"=>4894095}
I, [2014-04-01T22:23:53.871662 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:23:53.873634 #99449]  INFO -- : {
     "count" => 2,
  "expenses" => {
    "21316325" => {
         "amount_in_cents" => 123,
                "category" => "Travel",
              "created_at" => "2014-04-01T00:40:33-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2013-02-19",
                      "id" => "21316325",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T00:40:33-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    },
    "21336035" => {
         "amount_in_cents" => 1,
                "category" => "Travel",
              "created_at" => "2014-04-01T07:13:16-07:00",
                "currency" => "USD",
      "currency_base_unit" => 100,
         "currency_symbol" => "$",
                    "date" => "2015-01-01",
                      "id" => "21336035",
             "is_billable" => false,
             "is_invoiced" => false,
                   "notes" => nil,
              "updated_at" => "2014-04-01T07:13:16-07:00",
           "user_can_edit" => true,
                 "user_id" => "4576975",
            "workspace_id" => "4894095"
    }
  },
   "results" => [
    [0] {
       "id" => "21336035",
      "key" => "expenses"
    },
    [1] {
       "id" => "21316325",
      "key" => "expenses"
    }
  ]
}
[
  [0] {
       "amount_in_cents" => 1,
              "category" => "Travel",
            "created_at" => "2014-04-01T07:13:16-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2015-01-01",
                    "id" => "21336035",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T07:13:16-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  },
  [1] {
       "amount_in_cents" => 123,
              "category" => "Travel",
            "created_at" => "2014-04-01T00:40:33-07:00",
              "currency" => "USD",
    "currency_base_unit" => 100,
       "currency_symbol" => "$",
                  "date" => "2013-02-19",
                    "id" => "21316325",
           "is_billable" => false,
           "is_invoiced" => false,
                 "notes" => nil,
            "updated_at" => "2014-04-01T00:40:33-07:00",
         "user_can_edit" => true,
               "user_id" => "4576975",
          "workspace_id" => "4894095"
  }
]
2.0.0-p247 :025 > expense.workspace_id = 10
10
2.0.0-p247 :026 > expense.save
I, [2014-04-01T22:24:47.646611 #99449]  INFO -- : [Maven] Started PUT /expenses/21336035 with {"expense"=>{"date"=>"2015-01-01", "category"=>"Travel", "amount_in_cents"=>1, "notes"=>nil, "currency"=>"USD", "user_id"=>"4576975"}}
I, [2014-04-01T22:24:49.477727 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:24:49.478161 #99449]  INFO -- : {
  "errors" => [
    [0] {
      "message" => "Unknown params: currency. Please see our documentation at http://developer.mavenlink.com",
         "type" => "syntax"
    }
  ]
}
I, [2014-04-01T22:24:49.478193 #99449]  INFO -- : [Maven] REQUEST FAILED:
I, [2014-04-01T22:24:49.478546 #99449]  INFO -- : [
  [0] {
    "message" => "Unknown params: currency. Please see our documentation at http://developer.mavenlink.com",
       "type" => "syntax"
  }
]
Mavenlink::InvalidRequestError: {"errors"=>[{"type"=>"syntax", "message"=>"Unknown params: currency. Please see our documentation at http://developer.mavenlink.com"}]}
	from /Users/szinin/git/mavenlink/lib/mavenlink/client.rb:95:in `block in perform_request'
	from /Users/szinin/git/mavenlink/lib/mavenlink/client.rb:84:in `tap'
	from /Users/szinin/git/mavenlink/lib/mavenlink/client.rb:84:in `perform_request'
	from /Users/szinin/git/mavenlink/lib/mavenlink/client.rb:52:in `put'
	from /Users/szinin/git/mavenlink/lib/mavenlink/request.rb:120:in `block in update'
	from /Users/szinin/git/mavenlink/lib/mavenlink/request.rb:131:in `perform'
	from /Users/szinin/git/mavenlink/lib/mavenlink/request.rb:120:in `update'
	from /Users/szinin/git/mavenlink/lib/mavenlink/model.rb:177:in `update'
	from /Users/szinin/git/mavenlink/lib/mavenlink/model.rb:132:in `save'
	from (irb):26
	from /Users/szinin/git/mavenlink/Rakefile:27:in `block in <top (required)>'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:240:in `call'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:240:in `block in execute'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:235:in `each'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:235:in `execute'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
	from /Users/szinin/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/task.rb:165:in `invoke'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:150:in `invoke_task'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:106:in `each'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:106:in `block in top_level'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:115:in `run_with_threads'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:100:in `top_level'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:78:in `block in run'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:176:in `standard_exception_handling'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/lib/rake/application.rb:75:in `run'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/gems/rake-10.2.2/bin/rake:33:in `<top (required)>'
	from /Users/szinin/.rvm/gems/ruby-2.0.0-p247@mavenlink/bin/rake:23:in `load'
	from /User
2.0.0-p247 :028 >
2.0.0-p247 :031 > expense.destroy
I, [2014-04-01T22:29:24.192581 #99449]  INFO -- : [Maven] Started DELETE /expenses/21336035 with {}
I, [2014-04-01T22:29:25.986623 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:29:25.986997 #99449]  INFO -- : nil
nil
2.0.0-p247 :032 > expense.reload
I, [2014-04-01T22:29:31.000593 #99449]  INFO -- : [Maven] Started GET /expenses with {"only"=>"21336035"}
I, [2014-04-01T22:29:32.387992 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:29:32.388450 #99449]  INFO -- : {
     "count" => 0,
  "expenses" => {},
   "results" => []
}
I, [2014-04-01T22:29:32.388645 #99449]  INFO -- : [Maven] Started GET /expenses with {"only"=>"21336035"}
I, [2014-04-01T22:29:33.721392 #99449]  INFO -- : [Maven] Received response:
I, [2014-04-01T22:29:33.721874 #99449]  INFO -- : {
     "count" => 0,
  "expenses" => {},
   "results" => []
}
Mavenlink::RecordNotFoundError: #<Mavenlink::Request []>
Clone this wiki locally