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.
5190 5191 5192 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5190 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete(organization) ⇒ Object
5228 5229 5230 5231 5232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5228 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
5194 5195 5196 5197 5198 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5194 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
5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5200 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
5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5214 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 |