Sha256: bff21442db41f9e0a73b16aadd372cca1430e217caa93f907b5c3d1c29bb9ab7

Contents?: true

Size: 736 Bytes

Versions: 6

Compression:

Stored size: 736 Bytes

Contents

module Vhx
  class Customer < VhxObject
    include Vhx::ApiOperations::Create
    include Vhx::ApiOperations::Request
    include Vhx::ApiOperations::List
    include Vhx::ApiOperations::Delete

    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

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vhx-ruby-0.0.12 lib/vhx/objects/customer.rb
vhx-ruby-0.0.10 lib/vhx/objects/customer.rb
vhx-ruby-0.0.9 lib/vhx/objects/customer.rb
vhx-ruby-0.0.8 lib/vhx/objects/customer.rb
vhx-ruby-0.0.7 lib/vhx/objects/customer.rb
vhx-ruby-0.0.6 lib/vhx/objects/customer.rb