Class: Io::Flow::V0::Clients::AbandonedOrderSettings
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::AbandonedOrderSettings
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete(organization) ⇒ Object
- #get(organization) ⇒ Object
-
#initialize(client) ⇒ AbandonedOrderSettings
constructor
A new instance of AbandonedOrderSettings.
- #post(organization, incoming = {}) ⇒ Object
- #put(organization, incoming = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ AbandonedOrderSettings
Returns a new instance of AbandonedOrderSettings.
5709 5710 5711 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5709 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete(organization) ⇒ Object
5747 5748 5749 5750 5751 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5747 def delete(organization) HttpClient::Preconditions.assert_class('organization', organization, String) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/settings").delete nil end |
#get(organization) ⇒ Object
5713 5714 5715 5716 5717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5713 def get(organization) HttpClient::Preconditions.assert_class('organization', organization, String) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/settings").get ::Io::Flow::V0::Models::AbandonedOrderSettings.new(r) end |
#post(organization, incoming = {}) ⇒ Object
5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5719 def post(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :delay_time => HttpClient::Preconditions.assert_class('delay_time', (x = opts.delete(:delay_time); x.nil? ? 30 : x), Integer), :delay_unit => (x = (x = opts.delete(:delay_unit); x.nil? ? "minute" : x); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x)).value, :frequency_time => HttpClient::Preconditions.assert_class('frequency_time', (x = opts.delete(:frequency_time); x.nil? ? 24 : x), Integer), :frequency_unit => (x = (x = opts.delete(:frequency_unit); x.nil? ? "hour" : x); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x)).value, :status => (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderSettingStatus) ? x : ::Io::Flow::V0::Models::AbandonedOrderSettingStatus.apply(x)).value }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/settings").with_query(query).post ::Io::Flow::V0::Models::AbandonedOrderSettings.new(r) end |
#put(organization, incoming = {}) ⇒ Object
5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5733 def put(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :delay_time => HttpClient::Preconditions.assert_class('delay_time', opts.delete(:delay_time), Integer), :delay_unit => (x = opts.delete(:delay_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x)).value, :frequency_time => HttpClient::Preconditions.assert_class('frequency_time', opts.delete(:frequency_time), Integer), :frequency_unit => (x = opts.delete(:frequency_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x)).value, :status => (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderSettingStatus) ? x : ::Io::Flow::V0::Models::AbandonedOrderSettingStatus.apply(x)).value }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/settings").with_query(query).put ::Io::Flow::V0::Models::AbandonedOrderSettings.new(r) end |