Class: TerminalShop::Resources::Address
- Inherits:
-
Object
- Object
- TerminalShop::Resources::Address
- Defined in:
- lib/terminal_shop/resources/address.rb
Instance Method Summary collapse
-
#create(city: , country: , name: , street1: , zip: , phone: nil, province: nil, street2: nil, request_options: {}) ⇒ TerminalShop::Models::AddressCreateResponse
Create and add a shipping address to the current user.
-
#delete(id, request_options: {}) ⇒ TerminalShop::Models::AddressDeleteResponse
Delete a shipping address from the current user.
-
#get(id, request_options: {}) ⇒ TerminalShop::Models::AddressGetResponse
Get the shipping address with the given ID.
-
#initialize(client:) ⇒ Address
constructor
private
A new instance of Address.
-
#list(request_options: {}) ⇒ TerminalShop::Models::AddressListResponse
Get the shipping addresses associated with the current user.
Constructor Details
#initialize(client:) ⇒ Address
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Address.
103 104 105 |
# File 'lib/terminal_shop/resources/address.rb', line 103 def initialize(client:) @client = client end |
Instance Method Details
#create(city: , country: , name: , street1: , zip: , phone: nil, province: nil, street2: nil, request_options: {}) ⇒ TerminalShop::Models::AddressCreateResponse
Create and add a shipping address to the current user.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/terminal_shop/resources/address.rb', line 31 def create(params) parsed, = TerminalShop::AddressCreateParams.dump_request(params) @client.request( method: :post, path: "address", body: parsed, model: TerminalShop::Models::AddressCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ TerminalShop::Models::AddressDeleteResponse
Delete a shipping address from the current user.
71 72 73 74 75 76 77 78 |
# File 'lib/terminal_shop/resources/address.rb', line 71 def delete(id, params = {}) @client.request( method: :delete, path: ["address/%1$s", id], model: TerminalShop::Models::AddressDeleteResponse, options: params[:request_options] ) end |
#get(id, request_options: {}) ⇒ TerminalShop::Models::AddressGetResponse
Get the shipping address with the given ID.
91 92 93 94 95 96 97 98 |
# File 'lib/terminal_shop/resources/address.rb', line 91 def get(id, params = {}) @client.request( method: :get, path: ["address/%1$s", id], model: TerminalShop::Models::AddressGetResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ TerminalShop::Models::AddressListResponse
Get the shipping addresses associated with the current user.
51 52 53 54 55 56 57 58 |
# File 'lib/terminal_shop/resources/address.rb', line 51 def list(params = {}) @client.request( method: :get, path: "address", model: TerminalShop::Models::AddressListResponse, options: params[:request_options] ) end |