Class: Io::Flow::V0::Clients::Experiences
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Experiences
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#delete_by_key(organization, key) ⇒ Object
Delete the experience with this key.
- #delete_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
- #delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
-
#get(organization, incoming = {}) ⇒ Object
Search experiences.
-
#get_by_key(organization, key) ⇒ Object
Returns information about a specific experience.
-
#get_clone_by_key_and_id(organization, key, id) ⇒ Object
Returns the experience_clone associated with the id.
-
#get_conversions_by_base_and_amount(organization, base, amount, incoming = {}) ⇒ Object
Formats the requested amount using the formatting settings for the experience.
- #get_currency_and_formats_by_experience_key(organization, experience_key) ⇒ Object
-
#get_items(organization, incoming = {}) ⇒ Object
Returns localized information about 1 or more items.
-
#get_items_and_price_by_key_and_number(organization, key, number, incoming = {}) ⇒ Object
Returns detailed information on the pricing of this item within this experience.
-
#get_items_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about this item localized based on the query parameters.
- #get_logistics_and_summary_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_and_versions_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
- #get_payment_and_method_and_rules_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_payment_method_types_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_price_and_books_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
-
#get_pricing_by_key(organization, key) ⇒ Object
Get the pricing settings for this experience.
-
#get_promotions_and_available_by_key(organization, key) ⇒ Object
Get available promotions for the experience.
-
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion.
-
#initialize(client) ⇒ Experiences
constructor
A new instance of Experiences.
-
#post(organization, experience_form) ⇒ Object
Add experience.
-
#post_clone_by_key(organization, key, experience_clone_form) ⇒ Object
Clones the experience with the specified key, using data from experience_clone_form.
- #post_margins_by_experience_key(organization, experience_key, item_margin_post_form) ⇒ Object
- #post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form) ⇒ Object
-
#post_query_and_builders(organization, query_builder_form) ⇒ Object
Builds a query to search experiences.
-
#put_by_key(organization, key, experience_form) ⇒ Object
Update experience with the specified key, creating if it does not exist.
- #put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form) ⇒ Object
- #put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form) ⇒ Object
-
#put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms) ⇒ Object
Change the ordering or payment tags for an experience.
- #put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form) ⇒ Object
-
#put_pricing_by_key(organization, key, pricing) ⇒ Object
Update the pricing settings for this experience.
-
#put_status_by_key(organization, key, experience_status_form) ⇒ Object
Updates the status of a given experience.
Constructor Details
#initialize(client) ⇒ Experiences
Returns a new instance of Experiences.
915 916 917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 915 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
Delete the experience with this key
1221 1222 1223 1224 1225 1226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1221 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)}/experiences/#{CGI.escape(key)}").delete nil end |
#delete_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1109 1110 1111 1112 1113 1114 1115 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1109 def delete_margins_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").delete nil end |
#delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1195 1196 1197 1198 1199 1200 1201 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1195 def delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books/#{CGI.escape(key)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
Search experiences. Always paginated.
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 920 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String)), :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) }), :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String)), :region => (x = opts.delete(:region); x.nil? ? nil : HttpClient::Preconditions.assert_class('region', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :subcatalog => (x = opts.delete(:subcatalog); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :status => (x = opts.delete(:status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExperienceStatus) ? x : ::Io::Flow::V0::Models::ExperienceStatus.apply(x)).value), :shipping_configuration_key => (x = opts.delete(:shipping_configuration_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('shipping_configuration_key', x, 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? ? "position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Experience.new(x) } end |
#get_by_key(organization, key) ⇒ Object
Returns information about a specific experience.
1204 1205 1206 1207 1208 1209 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1204 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)}/experiences/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::Experience.new(r) end |
#get_clone_by_key_and_id(organization, key, id) ⇒ Object
Returns the experience_clone associated with the id.
1239 1240 1241 1242 1243 1244 1245 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1239 def get_clone_by_key_and_id(organization, key, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/clone/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ExperienceClone.new(r) end |
#get_conversions_by_base_and_amount(organization, base, amount, incoming = {}) ⇒ Object
Formats the requested amount using the formatting settings for the experience.
952 953 954 955 956 957 958 959 960 961 962 963 964 965 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 952 def get_conversions_by_base_and_amount(organization, base, amount, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('base', base, String) HttpClient::Preconditions.assert_class('amount', amount, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/conversions/#{CGI.escape(base)}/#{CGI.escape(amount)}").with_query(query).get ::Io::Flow::V0::Models::PriceWithBase.new(r) end |
#get_currency_and_formats_by_experience_key(organization, experience_key) ⇒ Object
1028 1029 1030 1031 1032 1033 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1028 def get_currency_and_formats_by_experience_key(organization, experience_key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/currency/formats").get ::Io::Flow::V0::Models::ExperienceCurrencyFormat.new(r) end |
#get_items(organization, incoming = {}) ⇒ Object
Returns localized information about 1 or more items. The items will be localized based on the experience selected by the query parameters in the order of experience, then country, then ip address.
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 970 def get_items(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, Array).map { |v| HttpClient::Preconditions.assert_class('number', v, String) }), :status => (x = opts.delete(:status); x.nil? ? nil : HttpClient::Preconditions.assert_class('status', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)).value }), :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, 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)}/experiences/items").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Item.new(x) } end |
#get_items_and_price_by_key_and_number(organization, key, number, incoming = {}) ⇒ Object
Returns detailed information on the pricing of this item within this experience
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1249 def get_items_and_price_by_key_and_number(organization, key, number, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :price_amount => (x = opts.delete(:price_amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_amount', x, Numeric)), :price_currency => (x = opts.delete(:price_currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_currency', x, String)), :ship_from_country => (x = opts.delete(:ship_from_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_from_country', x, String)), :ship_from_province => (x = opts.delete(:ship_from_province); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_from_province', x, String)), :ship_to_country => (x = opts.delete(:ship_to_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_to_country', x, String)), :ship_to_province => (x = opts.delete(:ship_to_province); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_to_province', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/items/#{CGI.escape(number)}/price").with_query(query).get ::Io::Flow::V0::Models::PriceCheck.new(r) end |
#get_items_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about this item localized based on the query parameters
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 990 def get_items_by_number(organization, number, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/items/#{CGI.escape(number)}").with_query(query).get ::Io::Flow::V0::Models::Item.new(r) end |
#get_logistics_and_summary_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1043 def get_logistics_and_summary_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/logistics/summary").with_query(query).get ::Io::Flow::V0::Models::ExperienceLogisticsSummary.new(r) end |
#get_margins_and_versions_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1078 def get_margins_and_versions_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, 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) }), :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)}/experiences/#{CGI.escape(experience_key)}/margins/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ItemMarginVersion.new(x) } end |
#get_margins_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1056 def get_margins_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, 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) }), :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)}/experiences/#{CGI.escape(experience_key)}/margins").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ItemMargin.new(x) } end |
#get_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1092 1093 1094 1095 1096 1097 1098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1092 def get_margins_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#get_payment_and_method_and_rules_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1129 def get_payment_and_method_and_rules_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :payment_method_type => (x = opts.delete(:payment_method_type); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment_method_type', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodType) ? x : ::Io::Flow::V0::Models::PaymentMethodType.apply(x)).value }), :tags => (x = opts.delete(:tags); x.nil? ? nil : HttpClient::Preconditions.assert_class('tags', x, Array).map { |v| HttpClient::Preconditions.assert_class('tags', v, String) }), :amount => (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, 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? ? "display_position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment/method/rules").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |
#get_payment_method_types_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1117 def get_payment_method_types_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :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) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment-method-types").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodType.new(x) } end |
#get_price_and_books_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1156 def get_price_and_books_by_experience_key(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, 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) }), :price_book_key => (x = opts.delete(:price_book_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_book_key', x, Array).map { |v| HttpClient::Preconditions.assert_class('price_book_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? ? "position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(x) } end |
#get_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1187 1188 1189 1190 1191 1192 1193 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1187 def get_price_and_books_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(r) end |
#get_pricing_by_key(organization, key) ⇒ Object
Get the pricing settings for this experience
1268 1269 1270 1271 1272 1273 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1268 def get_pricing_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").get ::Io::Flow::V0::Models::Pricing.new(r) end |
#get_promotions_and_available_by_key(organization, key) ⇒ Object
Get available promotions for the experience
1285 1286 1287 1288 1289 1290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1285 def get_promotions_and_available_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/promotions/available").get r.map { |x| ::Io::Flow::V0::Models::Promotion.from_json(x) } end |
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1014 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)}/experiences/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ExperienceVersion.new(x) } end |
#post(organization, experience_form) ⇒ Object
Add experience
943 944 945 946 947 948 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 943 def post(organization, experience_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences").with_json(experience_form.to_json).post ::Io::Flow::V0::Models::Experience.new(r) end |
#post_clone_by_key(organization, key, experience_clone_form) ⇒ Object
Clones the experience with the specified key, using data from experience_clone_form.
1230 1231 1232 1233 1234 1235 1236 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1230 def post_clone_by_key(organization, key, experience_clone_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = experience_clone_form; x.is_a?(::Io::Flow::V0::Models::ExperienceCloneForm) ? x : ::Io::Flow::V0::Models::ExperienceCloneForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/clone").with_json(experience_clone_form.to_json).post ::Io::Flow::V0::Models::ExperienceClone.new(r) end |
#post_margins_by_experience_key(organization, experience_key, item_margin_post_form) ⇒ Object
1070 1071 1072 1073 1074 1075 1076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1070 def post_margins_by_experience_key(organization, experience_key, item_margin_post_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) (x = item_margin_post_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPostForm) ? x : ::Io::Flow::V0::Models::ItemMarginPostForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins").with_json(item_margin_post_form.to_json).post ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form) ⇒ Object
1171 1172 1173 1174 1175 1176 1177 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1171 def post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) (x = experience_price_book_mapping_form; x.is_a?(::Io::Flow::V0::Models::ExperiencePriceBookMappingForm) ? x : ::Io::Flow::V0::Models::ExperiencePriceBookMappingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_json(experience_price_book_mapping_form.to_json).post ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(r) end |
#post_query_and_builders(organization, query_builder_form) ⇒ Object
Builds a query to search experiences
1006 1007 1008 1009 1010 1011 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1006 def post_query_and_builders(organization, query_builder_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = query_builder_form; x.is_a?(::Io::Flow::V0::Models::QueryBuilderForm) ? x : ::Io::Flow::V0::Models::QueryBuilderForm.from_json(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/query/builders").with_json(query_builder_form.to_json).post ::Io::Flow::V0::Models::QueryBuilder.new(r) end |
#put_by_key(organization, key, experience_form) ⇒ Object
Update experience with the specified key, creating if it does not exist.
1212 1213 1214 1215 1216 1217 1218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1212 def put_by_key(organization, key, experience_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").with_json(experience_form.to_json).put ::Io::Flow::V0::Models::Experience.new(r) end |
#put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form) ⇒ Object
1035 1036 1037 1038 1039 1040 1041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1035 def put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) (x = experience_currency_format_form; x.is_a?(::Io::Flow::V0::Models::ExperienceCurrencyFormatForm) ? x : ::Io::Flow::V0::Models::ExperienceCurrencyFormatForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/currency/formats").with_json(experience_currency_format_form.to_json).put ::Io::Flow::V0::Models::ExperienceCurrencyFormat.new(r) end |
#put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form) ⇒ Object
1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1100 def put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) (x = item_margin_put_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPutForm) ? x : ::Io::Flow::V0::Models::ItemMarginPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").with_json(item_margin_put_form.to_json).put ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms) ⇒ Object
Change the ordering or payment tags for an experience. Every post must include one entry for each payment method offered by Flow.
1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1148 def put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('experience_payment_method_rule_forms', experience_payment_method_rule_forms, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExperiencePaymentMethodRuleForm) ? x : ::Io::Flow::V0::Models::ExperiencePaymentMethodRuleForm.new(x)) } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment/method/rules").with_json(experience_payment_method_rule_forms.map { |o| o.to_hash }.to_json).put r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |
#put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form) ⇒ Object
1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1179 def put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) (x = experience_price_book_mapping_put_form; x.is_a?(::Io::Flow::V0::Models::ExperiencePriceBookMappingPutForm) ? x : ::Io::Flow::V0::Models::ExperiencePriceBookMappingPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_json(experience_price_book_mapping_put_form.to_json).put r.map { |x| ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(x) } end |
#put_pricing_by_key(organization, key, pricing) ⇒ Object
Update the pricing settings for this experience
1276 1277 1278 1279 1280 1281 1282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1276 def put_pricing_by_key(organization, key, pricing) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = pricing; x.is_a?(::Io::Flow::V0::Models::Pricing) ? x : ::Io::Flow::V0::Models::Pricing.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").with_json(pricing.to_json).put ::Io::Flow::V0::Models::Pricing.new(r) end |
#put_status_by_key(organization, key, experience_status_form) ⇒ Object
Updates the status of a given experience.
1293 1294 1295 1296 1297 1298 1299 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1293 def put_status_by_key(organization, key, experience_status_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = experience_status_form; x.is_a?(::Io::Flow::V0::Models::ExperienceStatusForm) ? x : ::Io::Flow::V0::Models::ExperienceStatusForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/status").with_json(experience_status_form.to_json).put ::Io::Flow::V0::Models::Experience.new(r) end |