Class: Io::Flow::V0::Clients::TaxRegistrations
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::TaxRegistrations
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_key(organization, key) ⇒ Object
- #get_details(organization, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ TaxRegistrations
constructor
A new instance of TaxRegistrations.
- #post(organization, tax_registration_form) ⇒ Object
- #put_by_key(organization, key, tax_registration_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ TaxRegistrations
Returns a new instance of TaxRegistrations.
3225 3226 3227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3225 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
3256 3257 3258 3259 3260 3261 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3256 def delete_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/tax/registrations/#{CGI.escape(key)}").delete nil end |
#get_details(organization, incoming = {}) ⇒ Object
3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3236 def get_details(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :order_number => HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/tax/registrations/details").with_query(query).get ::Io::Flow::V0::Models::DetailedTaxRegistration.new(r) end |
#post(organization, tax_registration_form) ⇒ Object
3229 3230 3231 3232 3233 3234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3229 def post(organization, tax_registration_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = tax_registration_form; x.is_a?(::Io::Flow::V0::Models::TaxRegistrationForm) ? x : ::Io::Flow::V0::Models::TaxRegistrationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/tax/registrations").with_json(tax_registration_form.to_json).post ::Io::Flow::V0::Models::TaxRegistration.new(r) end |
#put_by_key(organization, key, tax_registration_form) ⇒ Object
3248 3249 3250 3251 3252 3253 3254 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3248 def put_by_key(organization, key, tax_registration_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = tax_registration_form; x.is_a?(::Io::Flow::V0::Models::TaxRegistrationForm) ? x : ::Io::Flow::V0::Models::TaxRegistrationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/tax/registrations/#{CGI.escape(key)}").with_json(tax_registration_form.to_json).put ::Io::Flow::V0::Models::TaxRegistration.new(r) end |