class Io::Flow::V0::Clients::AbandonedOrderSettings

Public Class Methods

new(client) click to toggle source
# 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

Public Instance Methods

delete(organization) click to toggle source
# 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) click to toggle source
# 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={}) click to toggle source
# 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={}) click to toggle source
# 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