Class: FreeAgent::EstimateItemsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/free_agent/resources/estimate_items.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from FreeAgent::Resource

Instance Method Details

#create(estimate:, **params) ⇒ Object



4
5
6
7
8
9
# File 'lib/free_agent/resources/estimate_items.rb', line 4

def create(estimate:, **params)
  attributes = {estimate: estimate}

  response = post_request("estimate_items", body: attributes.merge(params))
  EstimateItem.new(response.body["estimate_item"]) if response.success?
end

#delete(id:) ⇒ Object



16
17
18
19
# File 'lib/free_agent/resources/estimate_items.rb', line 16

def delete(id:)
  response = delete_request("estimate_items/#{id}")
  response.success?
end

#update(id:, **params) ⇒ Object



11
12
13
14
# File 'lib/free_agent/resources/estimate_items.rb', line 11

def update(id:, **params)
  response = put_request("estimate_items/#{id}", body: params)
  EstimateItem.new(response.body["estimate_item"]) if response.success?
end