Class: Io::Flow::V0::Clients::CustomerAddressBook

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CustomerAddressBook

Returns a new instance of CustomerAddressBook.



5476
5477
5478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5476

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get(organization, number) ⇒ Object

Retrieve customer addrress book.



5481
5482
5483
5484
5485
5486
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5481

def get(organization, number)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('number', number, String)
  r = @client.request("/#{CGI.escape(organization)}/customers/#{CGI.escape(number)}/addresses/book").get
  ::Io::Flow::V0::Models::CustomerAddressBook.new(r)
end

#patch(organization, number, customer_address_book_form) ⇒ Object

Append customer address book contacts



5489
5490
5491
5492
5493
5494
5495
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5489

def patch(organization, number, customer_address_book_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('number', number, String)
  (x = customer_address_book_form; x.is_a?(::Io::Flow::V0::Models::CustomerAddressBookForm) ? x : ::Io::Flow::V0::Models::CustomerAddressBookForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/customers/#{CGI.escape(number)}/addresses/book").with_json(customer_address_book_form.to_json).patch
  ::Io::Flow::V0::Models::CustomerAddressBook.new(r)
end