class Io::Flow::V0::Clients::AbandonedOrderPromotions
Public Class Methods
new(client)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5658 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end
Public Instance Methods
delete_by_id(organization, id)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5698 def delete_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/promotions/#{CGI.escape(id)}").delete nil end
get(organization, incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5662 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) }), :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', 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)}/marketing/abandoned/order/promotions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::AbandonedOrderPromotion.new(x) } end
get_by_id(organization, id)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5683 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/promotions/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::AbandonedOrderPromotion.new(r) end
post(organization, abandoned_order_promotion_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5676 def post(organization, abandoned_order_promotion_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = abandoned_order_promotion_form; x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionForm) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/promotions").with_json(abandoned_order_promotion_form.to_json).post ::Io::Flow::V0::Models::AbandonedOrderPromotion.new(r) end
put_by_id(organization, id, abandoned_order_promotion_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5690 def put_by_id(organization, id, abandoned_order_promotion_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = abandoned_order_promotion_form; x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionForm) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/marketing/abandoned/order/promotions/#{CGI.escape(id)}").with_json(abandoned_order_promotion_form.to_json).put ::Io::Flow::V0::Models::AbandonedOrderPromotion.new(r) end