Class: Io::Flow::V0::Clients::ShippingNotifications
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ShippingNotifications
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_key(organization, key) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
- #get_by_key(organization, key) ⇒ Object
- #get_versions(organization, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ ShippingNotifications
constructor
A new instance of ShippingNotifications.
- #post(organization, shipping_notification_form) ⇒ Object
- #put_by_key(organization, key, detailed_shipping_notification_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ ShippingNotifications
Returns a new instance of ShippingNotifications.
4777 4778 4779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4777 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
4835 4836 4837 4838 4839 4840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4835 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-notifications/#{CGI.escape(key)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4781 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) }), :carrier_tracking_number => (x = opts.delete(:carrier_tracking_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('carrier_tracking_number', x, Array).map { |v| HttpClient::Preconditions.assert_class('carrier_tracking_number', v, String) }), :flow_tracking_number => (x = opts.delete(:flow_tracking_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('flow_tracking_number', x, Array).map { |v| HttpClient::Preconditions.assert_class('flow_tracking_number', v, String) }), :order_number => (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, Array).map { |v| HttpClient::Preconditions.assert_class('order_number', v, String) }), :service => (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, Array).map { |v| HttpClient::Preconditions.assert_class('service', 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-notifications").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShippingNotification.new(x) } end |
#get_by_key(organization, key) ⇒ Object
4820 4821 4822 4823 4824 4825 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4820 def get_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-notifications/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ShippingNotification.new(r) end |
#get_versions(organization, incoming = {}) ⇒ Object
4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4806 def get_versions(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) }), :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? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shipping-notifications/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShippingNotificationVersion.new(x) } end |
#post(organization, shipping_notification_form) ⇒ Object
4799 4800 4801 4802 4803 4804 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4799 def post(organization, shipping_notification_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = shipping_notification_form; x.is_a?(::Io::Flow::V0::Models::ShippingNotificationForm) ? x : ::Io::Flow::V0::Models::ShippingNotificationForm.from_json(x)) r = @client.request("/#{CGI.escape(organization)}/shipping-notifications").with_json(shipping_notification_form.to_json).post ::Io::Flow::V0::Models::ShippingNotification.new(r) end |
#put_by_key(organization, key, detailed_shipping_notification_form) ⇒ Object
4827 4828 4829 4830 4831 4832 4833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4827 def put_by_key(organization, key, detailed_shipping_notification_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = detailed_shipping_notification_form; x.is_a?(::Io::Flow::V0::Models::DetailedShippingNotificationForm) ? x : ::Io::Flow::V0::Models::DetailedShippingNotificationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shipping-notifications/#{CGI.escape(key)}").with_json(detailed_shipping_notification_form.to_json).put ::Io::Flow::V0::Models::ShippingNotification.new(r) end |