Class: Io::Flow::V0::Clients::ShippingConfigurations
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ShippingConfigurations
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_key(organization, key) ⇒ Object
- #delete_lanes_by_key_and_id(organization, key, id) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
- #get_by_key(organization, key, incoming = {}) ⇒ Object
-
#get_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id) ⇒ Object
Endpoint to retrieve the default tier of a shipping lane.
- #get_lanes_by_key(organization, key, incoming = {}) ⇒ Object
- #get_lanes_by_key_and_id(organization, key, id, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ ShippingConfigurations
constructor
A new instance of ShippingConfigurations.
- #post(organization, shipping_configuration_form) ⇒ Object
- #post_lanes_by_key(organization, key, shipping_lane_form, incoming = {}) ⇒ Object
- #put_by_key(organization, key, shipping_configuration_form, incoming = {}) ⇒ Object
-
#put_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id, shipping_lane_default_tier_form) ⇒ Object
Endpoint to set or udpate the default tier of a shipping lane.
- #put_lanes_by_key_and_id(organization, key, id, shipping_lane_form, incoming = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ ShippingConfigurations
Returns a new instance of ShippingConfigurations.
4670 4671 4672 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4670 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
4722 4723 4724 4725 4726 4727 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4722 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)}/shipping/configuration/#{CGI.escape(key)}").delete nil end |
#delete_lanes_by_key_and_id(organization, key, id) ⇒ Object
4782 4783 4784 4785 4786 4787 4788 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4782 def delete_lanes_by_key_and_id(organization, key, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4674 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }), :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String)), :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, 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), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "name" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shipping/configuration").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShippingConfiguration.new(x) } end |
#get_by_key(organization, key, incoming = {}) ⇒ Object
4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4698 def get_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}").with_query(query).get ::Io::Flow::V0::Models::ShippingConfiguration.new(r) end |
#get_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id) ⇒ Object
Endpoint to retrieve the default tier of a shipping lane
4791 4792 4793 4794 4795 4796 4797 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4791 def get_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes/#{CGI.escape(id)}/defaults/tiers").get ::Io::Flow::V0::Models::ShippingLaneDefaultTier.new(r) end |
#get_lanes_by_key(organization, key, incoming = {}) ⇒ Object
4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4729 def get_lanes_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :region => (x = opts.delete(:region); x.nil? ? nil : HttpClient::Preconditions.assert_class('region', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, 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), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShippingLane.new(x) } end |
#get_lanes_by_key_and_id(organization, key, id, incoming = {}) ⇒ Object
4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4757 def get_lanes_by_key_and_id(organization, key, id, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes/#{CGI.escape(id)}").with_query(query).get ::Io::Flow::V0::Models::ShippingLane.new(r) end |
#post(organization, shipping_configuration_form) ⇒ Object
4691 4692 4693 4694 4695 4696 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4691 def post(organization, shipping_configuration_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = shipping_configuration_form; x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationForm) ? x : ::Io::Flow::V0::Models::ShippingConfigurationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration").with_json(shipping_configuration_form.to_json).post ::Io::Flow::V0::Models::ShippingConfiguration.new(r) end |
#post_lanes_by_key(organization, key, shipping_lane_form, incoming = {}) ⇒ Object
4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4745 def post_lanes_by_key(organization, key, shipping_lane_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = shipping_lane_form; x.is_a?(::Io::Flow::V0::Models::ShippingLaneForm) ? x : ::Io::Flow::V0::Models::ShippingLaneForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes").with_query(query).with_json(shipping_lane_form.to_json).post ::Io::Flow::V0::Models::ShippingLane.new(r) end |
#put_by_key(organization, key, shipping_configuration_form, incoming = {}) ⇒ Object
4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4710 def put_by_key(organization, key, shipping_configuration_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = shipping_configuration_form; x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationForm) ? x : ::Io::Flow::V0::Models::ShippingConfigurationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}").with_query(query).with_json(shipping_configuration_form.to_json).put ::Io::Flow::V0::Models::ShippingConfiguration.new(r) end |
#put_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id, shipping_lane_default_tier_form) ⇒ Object
Endpoint to set or udpate the default tier of a shipping lane
4800 4801 4802 4803 4804 4805 4806 4807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4800 def put_lanes_and_defaults_and_tiers_by_key_and_id(organization, key, id, shipping_lane_default_tier_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) (x = shipping_lane_default_tier_form; x.is_a?(::Io::Flow::V0::Models::ShippingLaneDefaultTierForm) ? x : ::Io::Flow::V0::Models::ShippingLaneDefaultTierForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes/#{CGI.escape(id)}/defaults/tiers").with_json(shipping_lane_default_tier_form.to_json).put ::Io::Flow::V0::Models::ShippingLaneDefaultTier.new(r) end |
#put_lanes_by_key_and_id(organization, key, id, shipping_lane_form, incoming = {}) ⇒ Object
4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4769 def put_lanes_by_key_and_id(organization, key, id, shipping_lane_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = shipping_lane_form; x.is_a?(::Io::Flow::V0::Models::ShippingLaneForm) ? x : ::Io::Flow::V0::Models::ShippingLaneForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping/configuration/#{CGI.escape(key)}/lanes/#{CGI.escape(id)}").with_query(query).with_json(shipping_lane_form.to_json).put ::Io::Flow::V0::Models::ShippingLane.new(r) end |