Class: Wajub::CustomersResource
Instance Attribute Summary
Attributes inherited from BaseClient
#api_key, #base_url, #idempotency_key_prefix, #last_request, #transport
Instance Method Summary
collapse
-
#activate(id, options = nil) ⇒ Object
-
#block(id, params = nil, options = nil) ⇒ Object
-
#create_tax_id(customer_id, params, options = nil) ⇒ Object
-
#deactivate(id, options = nil) ⇒ Object
-
#delete_tax_id(customer_id, tax_id, options = nil) ⇒ Object
-
#initialize(api_key, base_url, idempotency_key_prefix = 'wajub', transport: nil) ⇒ CustomersResource
constructor
A new instance of CustomersResource.
-
#list_tax_ids(customer_id) ⇒ Object
-
#unblock(id, options = nil) ⇒ Object
#create, #delete, #list, #retrieve, #update
Methods inherited from BaseClient
#delete, #get, #post, #put, #request
Constructor Details
#initialize(api_key, base_url, idempotency_key_prefix = 'wajub', transport: nil) ⇒ CustomersResource
Returns a new instance of CustomersResource.
132
133
134
|
# File 'lib/wajub/resources.rb', line 132
def initialize(api_key, base_url, idempotency_key_prefix = 'wajub', transport: nil)
super(api_key, base_url, 'customers', 'customer', 'customers', idempotency_key_prefix, transport: transport)
end
|
Instance Method Details
#activate(id, options = nil) ⇒ Object
144
145
146
|
# File 'lib/wajub/resources.rb', line 144
def activate(id, options = nil)
HttpUtils.pick_resource(post("/customers/#{URI.encode_www_form_component(id)}/activate", nil, options), 'customer')
end
|
#block(id, params = nil, options = nil) ⇒ Object
136
137
138
|
# File 'lib/wajub/resources.rb', line 136
def block(id, params = nil, options = nil)
HttpUtils.pick_resource(post("/customers/#{URI.encode_www_form_component(id)}/block", params, options), 'customer')
end
|
#create_tax_id(customer_id, params, options = nil) ⇒ Object
157
158
159
|
# File 'lib/wajub/resources.rb', line 157
def create_tax_id(customer_id, params, options = nil)
HttpUtils.pick_resource(post("/customers/#{URI.encode_www_form_component(customer_id)}/tax_ids", params, options), 'tax_id')
end
|
#deactivate(id, options = nil) ⇒ Object
148
149
150
|
# File 'lib/wajub/resources.rb', line 148
def deactivate(id, options = nil)
HttpUtils.pick_resource(post("/customers/#{URI.encode_www_form_component(id)}/deactivate", nil, options), 'customer')
end
|
#delete_tax_id(customer_id, tax_id, options = nil) ⇒ Object
161
162
163
|
# File 'lib/wajub/resources.rb', line 161
def delete_tax_id(customer_id, tax_id, options = nil)
delete("/customers/#{URI.encode_www_form_component(customer_id)}/tax_ids/#{URI.encode_www_form_component(tax_id)}", options)
end
|
#list_tax_ids(customer_id) ⇒ Object
152
153
154
155
|
# File 'lib/wajub/resources.rb', line 152
def list_tax_ids(customer_id)
list = HttpUtils.pick_list(get("/customers/#{URI.encode_www_form_component(customer_id)}/tax_ids"), 'tax_ids')
[list[:data], list[:meta]]
end
|
#unblock(id, options = nil) ⇒ Object
140
141
142
|
# File 'lib/wajub/resources.rb', line 140
def unblock(id, options = nil)
HttpUtils.pick_resource(post("/customers/#{URI.encode_www_form_component(id)}/unblock", nil, options), 'customer')
end
|