Class: Vhx::Customer
- Defined in:
- lib/vhx/objects/customer.rb
Constant Summary
Constants inherited from VhxObject
VhxObject::ASSOCIATION_WHITELIST
Instance Method Summary collapse
Methods included from ApiOperations::Delete
Methods included from ApiOperations::List
Methods included from ApiOperations::Request
Methods included from ApiOperations::Create
Methods inherited from VhxObject
#_embedded, #_links, #href, #initialize, #links, #to_hash, #to_json
Methods included from HelperMethods
Constructor Details
This class inherits a constructor from Vhx::VhxObject
Instance Method Details
#add_product(identifier) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/vhx/objects/customer.rb', line 8 def add_product(identifier) response = Vhx.connection.put do |req| req.url('/customers/' + self.id.to_s + '/products') req.body = { product: get_hypermedia(identifier, 'Product') } end self.class.new(response.body) end |
#remove_product(identifier) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/vhx/objects/customer.rb', line 17 def remove_product(identifier) response = Vhx.connection.delete do |req| req.url('/customers/' + self.id.to_s + '/products') req.body = { product: get_hypermedia(identifier, 'Product') } end self.class.new(response.body) end |