flowcommerce 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c265a72646f875ea42247024e52ad13bd9362351
4
- data.tar.gz: 76f8f5678c7ad813b99744f858aa4958a51eb23a
3
+ metadata.gz: 4e0646c5728af522534a9d1a26d55173bfac492f
4
+ data.tar.gz: bf13054e394904b83bc29a250ed262f1171604fa
5
5
  SHA512:
6
- metadata.gz: 22b4b15968a2b6c513a8177b74eacaeefaa0975089121fec6645e947e08ed902c34c92d96f2f2305537235bb19e25329b8c66f683b90f5bc3a0453783bd4e16a
7
- data.tar.gz: 39c35efd1072a27f7e861dd452432304a3b072ea2fc86588d72bef258d7bad1f5fade3d347810d51dac809763c4d809f4878bdaacab215d6e5741422b60ee976
6
+ metadata.gz: f07dc5618565a0ec1a0af6f835c8439641b507f0c1403d7de0f351ad0e3c6b1fb24659e7263b65dea12eaab95165cd30bb9dff4a859ec771fb7bb3201106c6c5
7
+ data.tar.gz: 3804e2ce17a39fb3bede119a4ebfb77e5168d52f85cecc9f275151bfea40fb92473e8a566e1d227de4449068f2f5ff001f5704c1d72a4c46704e3320b42ce8c5
data/README.md CHANGED
@@ -19,7 +19,15 @@ experience. This is temporary.
19
19
 
20
20
  gem install flowcommerce
21
21
 
22
- ## Example
22
+ require 'flowcommerce'
23
+
24
+ client = FlowCommerce.catalog_client("<YOUR API TOKEN>")
25
+ client.items.get("<YOUR ORGANIZATION ID>", :limit => 5, :offset => 0).each do |i|
26
+ puts i.number
27
+ end
28
+
29
+
30
+ ## Running the Examples in this Repository
23
31
 
24
32
  1. Create a file named ~/.flow/token that contains your API token
25
33
  and nothing else
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.32
3
- # apidoc:0.11.28 http://www.apidoc.me/flow/catalog/0.0.32/ruby_client
2
+ # Service version: 0.0.36
3
+ # apidoc:0.11.29 http://www.apidoc.me/flow/catalog/0.0.36/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -26,8 +26,8 @@ module Io
26
26
 
27
27
  BASE_URL = 'https://catalog.api.flow.io' unless defined?(Constants::BASE_URL)
28
28
  NAMESPACE = 'io.flow.catalog.v0' unless defined?(Constants::NAMESPACE)
29
- USER_AGENT = 'apidoc:0.11.28 http://www.apidoc.me/flow/catalog/0.0.32/ruby_client' unless defined?(Constants::USER_AGENT)
30
- VERSION = '0.0.32' unless defined?(Constants::VERSION)
29
+ USER_AGENT = 'apidoc:0.11.29 http://www.apidoc.me/flow/catalog/0.0.36/ruby_client' unless defined?(Constants::USER_AGENT)
30
+ VERSION = '0.0.36' unless defined?(Constants::VERSION)
31
31
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
32
32
 
33
33
  end
@@ -62,6 +62,10 @@ module Io
62
62
  request
63
63
  end
64
64
 
65
+ def attributes
66
+ @attributes ||= ::Io::Flow::Catalog::V0::Clients::Attributes.new(self)
67
+ end
68
+
65
69
  def catalogs
66
70
  @catalogs ||= ::Io::Flow::Catalog::V0::Clients::Catalogs.new(self)
67
71
  end
@@ -85,6 +89,78 @@ module Io
85
89
 
86
90
  module Clients
87
91
 
92
+ class Attributes
93
+
94
+ def initialize(client)
95
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::Catalog::V0::Client)
96
+ end
97
+
98
+ # Provides visibility into recent changes of each object, including deletion
99
+ def get_versions(organization, incoming={})
100
+ HttpClient::Preconditions.assert_class('organization', organization, String)
101
+ opts = HttpClient::Helper.symbolize_keys(incoming)
102
+ query = {
103
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
104
+ :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
105
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
106
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
107
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "journal_timestamp" : x), String)
108
+ }.delete_if { |k, v| v.nil? }
109
+ r = @client.request("/#{CGI.escape(organization)}/attributes/versions").with_query(query).get
110
+ r.map { |x| ::Io::Flow::Catalog::V0::Models::AttributeVersion.new(x) }
111
+ end
112
+
113
+ # Search metadata. Always paginated.
114
+ def get(organization, incoming={})
115
+ HttpClient::Preconditions.assert_class('organization', organization, String)
116
+ opts = HttpClient::Helper.symbolize_keys(incoming)
117
+ query = {
118
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
119
+ :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
120
+ :option => (x = opts.delete(:option); x.nil? ? nil : HttpClient::Preconditions.assert_class('option', x, Array).map { |v| HttpClient::Preconditions.assert_class('option', v, String) }),
121
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
122
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
123
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "name" : x), String)
124
+ }.delete_if { |k, v| v.nil? }
125
+ r = @client.request("/#{CGI.escape(organization)}/attributes").with_query(query).get
126
+ r.map { |x| ::Io::Flow::Catalog::V0::Models::Attribute.new(x) }
127
+ end
128
+
129
+ # Returns information about a specific attribute.
130
+ def get_by_name(organization, name)
131
+ HttpClient::Preconditions.assert_class('organization', organization, String)
132
+ HttpClient::Preconditions.assert_class('name', name, String)
133
+ r = @client.request("/#{CGI.escape(organization)}/attributes/#{CGI.escape(name)}").get
134
+ ::Io::Flow::Catalog::V0::Models::Attribute.new(r)
135
+ end
136
+
137
+ # Add attribute
138
+ def post(organization, attribute)
139
+ HttpClient::Preconditions.assert_class('organization', organization, String)
140
+ HttpClient::Preconditions.assert_class('attribute', attribute, ::Io::Flow::Catalog::V0::Models::Attribute)
141
+ r = @client.request("/#{CGI.escape(organization)}/attributes").with_json(attribute.to_json).post
142
+ ::Io::Flow::Catalog::V0::Models::Attribute.new(r)
143
+ end
144
+
145
+ # Update an attribute with the specified name, creating if it does not exist.
146
+ def put_by_name(organization, name, attribute)
147
+ HttpClient::Preconditions.assert_class('organization', organization, String)
148
+ HttpClient::Preconditions.assert_class('name', name, String)
149
+ HttpClient::Preconditions.assert_class('attribute', attribute, ::Io::Flow::Catalog::V0::Models::Attribute)
150
+ r = @client.request("/#{CGI.escape(organization)}/attributes/#{CGI.escape(name)}").with_json(attribute.to_json).put
151
+ ::Io::Flow::Catalog::V0::Models::Attribute.new(r)
152
+ end
153
+
154
+ # Delete an attribute with this name
155
+ def delete_by_name(organization, name)
156
+ HttpClient::Preconditions.assert_class('organization', organization, String)
157
+ HttpClient::Preconditions.assert_class('name', name, String)
158
+ r = @client.request("/#{CGI.escape(organization)}/attributes/#{CGI.escape(name)}").delete
159
+ nil
160
+ end
161
+
162
+ end
163
+
88
164
  class Catalogs
89
165
 
90
166
  def initialize(client)
@@ -112,6 +188,7 @@ module Io
112
188
  opts = HttpClient::Helper.symbolize_keys(incoming)
113
189
  query = {
114
190
  :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
191
+ :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }),
115
192
  :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
116
193
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
117
194
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
@@ -127,6 +204,7 @@ module Io
127
204
  opts = HttpClient::Helper.symbolize_keys(incoming)
128
205
  query = {
129
206
  :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
207
+ :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }),
130
208
  :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
131
209
  :position => (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Array).map { |v| HttpClient::Preconditions.assert_class('position', v, Integer) }),
132
210
  :subcatalog => (x = opts.delete(:subcatalog); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog', x, Array).map { |v| HttpClient::Preconditions.assert_class('subcatalog', v, String) }),
@@ -139,10 +217,10 @@ module Io
139
217
  end
140
218
 
141
219
  # Returns information about a specific function.
142
- def get_by_id(organization, id)
220
+ def get_by_key(organization, key)
143
221
  HttpClient::Preconditions.assert_class('organization', organization, String)
144
- HttpClient::Preconditions.assert_class('id', id, String)
145
- r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(id)}").get
222
+ HttpClient::Preconditions.assert_class('key', key, String)
223
+ r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(key)}").get
146
224
  ::Io::Flow::Catalog::V0::Models::Function.new(r)
147
225
  end
148
226
 
@@ -154,20 +232,20 @@ module Io
154
232
  ::Io::Flow::Catalog::V0::Models::Function.new(r)
155
233
  end
156
234
 
157
- # Update function with the specified id, creating if it does not exist.
158
- def put_by_id(organization, id, function_form)
235
+ # Update function with the specified key, creating if it does not exist.
236
+ def put_by_key(organization, key, function_form)
159
237
  HttpClient::Preconditions.assert_class('organization', organization, String)
160
- HttpClient::Preconditions.assert_class('id', id, String)
238
+ HttpClient::Preconditions.assert_class('key', key, String)
161
239
  HttpClient::Preconditions.assert_class('function_form', function_form, ::Io::Flow::Catalog::V0::Models::FunctionForm)
162
- r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(id)}").with_json(function_form.to_json).put
240
+ r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(key)}").with_json(function_form.to_json).put
163
241
  ::Io::Flow::Catalog::V0::Models::Function.new(r)
164
242
  end
165
243
 
166
- # Delete the function with this id
167
- def delete_by_id(organization, id)
244
+ # Delete the function with this key
245
+ def delete_by_key(organization, key)
168
246
  HttpClient::Preconditions.assert_class('organization', organization, String)
169
- HttpClient::Preconditions.assert_class('id', id, String)
170
- r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(id)}").delete
247
+ HttpClient::Preconditions.assert_class('key', key, String)
248
+ r = @client.request("/#{CGI.escape(organization)}/functions/#{CGI.escape(key)}").delete
171
249
  nil
172
250
  end
173
251
 
@@ -426,6 +504,59 @@ module Io
426
504
 
427
505
  module Models
428
506
 
507
+ # Cost variation used to calculate localized prices
508
+ class Adjustment
509
+
510
+ module Types
511
+ MARGIN = 'margin' unless defined?(MARGIN)
512
+ ROUNDING = 'rounding' unless defined?(ROUNDING)
513
+ end
514
+
515
+ def initialize(incoming={})
516
+ opts = HttpClient::Helper.symbolize_keys(incoming)
517
+ HttpClient::Preconditions.require_keys(opts, [:name], 'Adjustment')
518
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
519
+ end
520
+
521
+ def to_hash
522
+ subtype_to_hash.merge(:discriminator => @name)
523
+ end
524
+
525
+ def Adjustment.from_json(hash)
526
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
527
+ case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
528
+ when Types::MARGIN; Margin.new(hash)
529
+ when Types::ROUNDING; Rounding.new(hash)
530
+ else AdjustmentUndefinedType.new(:name => union_type_name)
531
+ end
532
+ end
533
+
534
+ end
535
+
536
+ class AdjustmentUndefinedType < Adjustment
537
+
538
+ attr_reader :name
539
+
540
+ def initialize(incoming={})
541
+ super(:name => 'undefined_type')
542
+ opts = HttpClient::Helper.symbolize_keys(incoming)
543
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
544
+ end
545
+
546
+ def subtype_to_hash
547
+ raise 'Unable to serialize undefined type to json'
548
+ end
549
+
550
+ def copy(incoming={})
551
+ raise 'Operation not supported for undefined type'
552
+ end
553
+
554
+ def to_hash
555
+ raise 'Operation not supported for undefined type'
556
+ end
557
+
558
+ end
559
+
429
560
  # A function can be represented with just it's ID, or the entire model
430
561
  class ExpandableFunction
431
562
 
@@ -667,6 +798,55 @@ module Io
667
798
 
668
799
  end
669
800
 
801
+ class RoundingMethod
802
+
803
+ attr_reader :value
804
+
805
+ def initialize(value)
806
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
807
+ end
808
+
809
+ # Returns the instance of RoundingMethod for this value, creating a new instance for an unknown value
810
+ def RoundingMethod.apply(value)
811
+ if value.instance_of?(RoundingMethod)
812
+ value
813
+ else
814
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
815
+ value.nil? ? nil : (from_string(value) || RoundingMethod.new(value))
816
+ end
817
+ end
818
+
819
+ # Returns the instance of RoundingMethod for this value, or nil if not found
820
+ def RoundingMethod.from_string(value)
821
+ HttpClient::Preconditions.assert_class('value', value, String)
822
+ RoundingMethod.ALL.find { |v| v.value == value }
823
+ end
824
+
825
+ def RoundingMethod.ALL
826
+ @@all ||= [RoundingMethod.up, RoundingMethod.down, RoundingMethod.nearest]
827
+ end
828
+
829
+ # Round up to the specified rounding.value
830
+ def RoundingMethod.up
831
+ @@_up ||= RoundingMethod.new('up')
832
+ end
833
+
834
+ # Round down to the specified rounding.value
835
+ def RoundingMethod.down
836
+ @@_down ||= RoundingMethod.new('down')
837
+ end
838
+
839
+ # Round to the nearest specified rounding.value. If equidistant, will round up.
840
+ def RoundingMethod.nearest
841
+ @@_nearest ||= RoundingMethod.new('nearest')
842
+ end
843
+
844
+ def to_hash
845
+ value
846
+ end
847
+
848
+ end
849
+
670
850
  class UpdatePolicy
671
851
 
672
852
  attr_reader :value
@@ -714,15 +894,18 @@ module Io
714
894
 
715
895
  end
716
896
 
717
- class Adjustment
897
+ # An attribute represents applicable item data made available on specific UI
898
+ # elements (e.g. require 'Brand')
899
+ class Attribute
718
900
 
719
- attr_reader :name, :value
901
+ attr_reader :name, :options, :label
720
902
 
721
903
  def initialize(incoming={})
722
904
  opts = HttpClient::Helper.symbolize_keys(incoming)
723
- HttpClient::Preconditions.require_keys(opts, [:name, :value], 'Adjustment')
724
- @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::Catalog::V0::Models::AdjustmentType) ? x : ::Io::Flow::Catalog::V0::Models::AdjustmentType.apply(x))
725
- @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), Numeric)
905
+ HttpClient::Preconditions.require_keys(opts, [:name, :options], 'Attribute')
906
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
907
+ @options = (x = opts.delete(:options); x.is_a?(::Io::Flow::Catalog::V0::Models::Options) ? x : ::Io::Flow::Catalog::V0::Models::Options.new(x))
908
+ @label = (x = opts.delete(:label); x.nil? ? nil : HttpClient::Preconditions.assert_class('label', x, String))
726
909
  end
727
910
 
728
911
  def to_json
@@ -730,25 +913,28 @@ module Io
730
913
  end
731
914
 
732
915
  def copy(incoming={})
733
- Adjustment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
916
+ Attribute.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
734
917
  end
735
918
 
736
919
  def to_hash
737
920
  {
738
- :name => name.value,
739
- :value => value
921
+ :name => name,
922
+ :options => options.to_hash,
923
+ :label => label
740
924
  }
741
925
  end
742
926
 
743
927
  end
744
928
 
745
- class Attribute
929
+ # Attribtue metadata represents additional item data not configured in other top
930
+ # level fields
931
+ class AttributeMetadata
746
932
 
747
933
  attr_reader :key, :value
748
934
 
749
935
  def initialize(incoming={})
750
936
  opts = HttpClient::Helper.symbolize_keys(incoming)
751
- HttpClient::Preconditions.require_keys(opts, [:key, :value], 'Attribute')
937
+ HttpClient::Preconditions.require_keys(opts, [:key, :value], 'AttributeMetadata')
752
938
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
753
939
  @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), String)
754
940
  end
@@ -758,7 +944,7 @@ module Io
758
944
  end
759
945
 
760
946
  def copy(incoming={})
761
- Attribute.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
947
+ AttributeMetadata.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
762
948
  end
763
949
 
764
950
  def to_hash
@@ -770,6 +956,39 @@ module Io
770
956
 
771
957
  end
772
958
 
959
+ # Retrieve journaled history of an attribute
960
+ class AttributeVersion
961
+
962
+ attr_reader :id, :timestamp, :type, :attribute
963
+
964
+ def initialize(incoming={})
965
+ opts = HttpClient::Helper.symbolize_keys(incoming)
966
+ HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :attribute], 'AttributeVersion')
967
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
968
+ @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
969
+ @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::Common::V0::Models::ChangeType) ? x : ::Io::Flow::Common::V0::Models::ChangeType.apply(x))
970
+ @attribute = (x = opts.delete(:attribute); x.is_a?(::Io::Flow::Catalog::V0::Models::Attribute) ? x : ::Io::Flow::Catalog::V0::Models::Attribute.new(x))
971
+ end
972
+
973
+ def to_json
974
+ JSON.dump(to_hash)
975
+ end
976
+
977
+ def copy(incoming={})
978
+ AttributeVersion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
979
+ end
980
+
981
+ def to_hash
982
+ {
983
+ :id => id,
984
+ :timestamp => timestamp,
985
+ :type => type.value,
986
+ :attribute => attribute.to_hash
987
+ }
988
+ end
989
+
990
+ end
991
+
773
992
  class Catalog
774
993
 
775
994
  attr_reader :id
@@ -863,14 +1082,15 @@ module Io
863
1082
  # defined price function)
864
1083
  class Function < ExpandableFunction
865
1084
 
866
- attr_reader :id, :subcatalog_id, :name, :position, :presets, :code, :q
1085
+ attr_reader :id, :subcatalog_id, :key, :name, :position, :presets, :code, :q
867
1086
 
868
1087
  def initialize(incoming={})
869
1088
  super(:name => ExpandableFunction::Types::FUNCTION)
870
1089
  opts = HttpClient::Helper.symbolize_keys(incoming)
871
- HttpClient::Preconditions.require_keys(opts, [:id, :subcatalog_id, :name, :position, :presets, :code], 'Function')
1090
+ HttpClient::Preconditions.require_keys(opts, [:id, :subcatalog_id, :key, :name, :position, :presets, :code], 'Function')
872
1091
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
873
1092
  @subcatalog_id = HttpClient::Preconditions.assert_class('subcatalog_id', opts.delete(:subcatalog_id), String)
1093
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
874
1094
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
875
1095
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
876
1096
  @presets = (x = opts.delete(:presets); x.is_a?(::Io::Flow::Catalog::V0::Models::Presets) ? x : ::Io::Flow::Catalog::V0::Models::Presets.new(x))
@@ -890,6 +1110,7 @@ module Io
890
1110
  {
891
1111
  :id => id,
892
1112
  :subcatalog_id => subcatalog_id,
1113
+ :key => key,
893
1114
  :name => name,
894
1115
  :position => position,
895
1116
  :presets => presets.to_hash,
@@ -1099,7 +1320,7 @@ module Io
1099
1320
  @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::Catalog::V0::Models::Price) ? x : ::Io::Flow::Catalog::V0::Models::Price.new(x))
1100
1321
  @categories = HttpClient::Preconditions.assert_class('categories', (x = opts.delete(:categories); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) }
1101
1322
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
1102
- @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Attribute) ? x : ::Io::Flow::Catalog::V0::Models::Attribute.new(x)) }
1323
+ @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::AttributeMetadata) ? x : ::Io::Flow::Catalog::V0::Models::AttributeMetadata.new(x)) }
1103
1324
  @dimensions = HttpClient::Preconditions.assert_class('dimensions', (x = opts.delete(:dimensions); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Common::V0::Models::Dimension) ? x : ::Io::Flow::Common::V0::Models::Dimension.new(x)) }
1104
1325
  @images = HttpClient::Preconditions.assert_class('images', (x = opts.delete(:images); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Image) ? x : ::Io::Flow::Catalog::V0::Models::Image.new(x)) }
1105
1326
  @flow = (x = opts.delete(:flow); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Flow) ? x : ::Io::Flow::Catalog::V0::Models::Flow.new(x)))
@@ -1149,7 +1370,7 @@ module Io
1149
1370
  @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Numeric)
1150
1371
  @categories = (x = opts.delete(:categories); x.nil? ? nil : HttpClient::Preconditions.assert_class('categories', x, Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) })
1151
1372
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
1152
- @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Attribute) ? x : ::Io::Flow::Catalog::V0::Models::Attribute.new(x)) })
1373
+ @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::AttributeMetadata) ? x : ::Io::Flow::Catalog::V0::Models::AttributeMetadata.new(x)) })
1153
1374
  @dimensions = (x = opts.delete(:dimensions); x.nil? ? nil : HttpClient::Preconditions.assert_class('dimensions', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Common::V0::Models::Dimension) ? x : ::Io::Flow::Common::V0::Models::Dimension.new(x)) })
1154
1375
  @images = (x = opts.delete(:images); x.nil? ? nil : HttpClient::Preconditions.assert_class('images', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::ImageForm) ? x : ::Io::Flow::Catalog::V0::Models::ImageForm.new(x)) })
1155
1376
  end
@@ -1269,6 +1490,65 @@ module Io
1269
1490
 
1270
1491
  end
1271
1492
 
1493
+ class Margin < Adjustment
1494
+
1495
+ attr_reader :name, :value
1496
+
1497
+ def initialize(incoming={})
1498
+ super(:name => Adjustment::Types::MARGIN)
1499
+ opts = HttpClient::Helper.symbolize_keys(incoming)
1500
+ HttpClient::Preconditions.require_keys(opts, [:name, :value], 'Margin')
1501
+ @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::Catalog::V0::Models::AdjustmentType) ? x : ::Io::Flow::Catalog::V0::Models::AdjustmentType.apply(x))
1502
+ @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), Numeric)
1503
+ end
1504
+
1505
+ def to_json
1506
+ JSON.dump(to_hash)
1507
+ end
1508
+
1509
+ def copy(incoming={})
1510
+ Margin.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1511
+ end
1512
+
1513
+ def subtype_to_hash
1514
+ {
1515
+ :name => name.value,
1516
+ :value => value
1517
+ }
1518
+ end
1519
+
1520
+ end
1521
+
1522
+ # Flags to indicate whether a feature is enabled/disabled on a particular model
1523
+ # (e.g. show/do not show attribute as a column in harmonization table view of
1524
+ # items)
1525
+ class Options
1526
+
1527
+ attr_reader :show_in_catalog, :show_in_harmonization
1528
+
1529
+ def initialize(incoming={})
1530
+ opts = HttpClient::Helper.symbolize_keys(incoming)
1531
+ @show_in_catalog = HttpClient::Preconditions.assert_boolean('show_in_catalog', (x = opts.delete(:show_in_catalog); x.nil? ? false : x))
1532
+ @show_in_harmonization = HttpClient::Preconditions.assert_boolean('show_in_harmonization', (x = opts.delete(:show_in_harmonization); x.nil? ? false : x))
1533
+ end
1534
+
1535
+ def to_json
1536
+ JSON.dump(to_hash)
1537
+ end
1538
+
1539
+ def copy(incoming={})
1540
+ Options.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1541
+ end
1542
+
1543
+ def to_hash
1544
+ {
1545
+ :show_in_catalog => show_in_catalog,
1546
+ :show_in_harmonization => show_in_harmonization
1547
+ }
1548
+ end
1549
+
1550
+ end
1551
+
1272
1552
  # Presentation for UI that is used to generate a localized price function
1273
1553
  class Presets
1274
1554
 
@@ -1276,7 +1556,7 @@ module Io
1276
1556
 
1277
1557
  def initialize(incoming={})
1278
1558
  opts = HttpClient::Helper.symbolize_keys(incoming)
1279
- @adjustments = HttpClient::Preconditions.assert_class('adjustments', (x = opts.delete(:adjustments); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Adjustment) ? x : ::Io::Flow::Catalog::V0::Models::Adjustment.new(x)) }
1559
+ @adjustments = HttpClient::Preconditions.assert_class('adjustments', (x = opts.delete(:adjustments); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Adjustment) ? x : ::Io::Flow::Catalog::V0::Models::Adjustment.from_json(x)) }
1280
1560
  @levies = HttpClient::Preconditions.assert_class('levies', (x = opts.delete(:levies); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Levy) ? x : ::Io::Flow::Catalog::V0::Models::Levy.apply(x)) }
1281
1561
  end
1282
1562
 
@@ -1325,6 +1605,37 @@ module Io
1325
1605
 
1326
1606
  end
1327
1607
 
1608
+ class Rounding < Adjustment
1609
+
1610
+ attr_reader :name, :rounding_method, :value
1611
+
1612
+ def initialize(incoming={})
1613
+ super(:name => Adjustment::Types::ROUNDING)
1614
+ opts = HttpClient::Helper.symbolize_keys(incoming)
1615
+ HttpClient::Preconditions.require_keys(opts, [:name, :rounding_method, :value], 'Rounding')
1616
+ @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::Catalog::V0::Models::AdjustmentType) ? x : ::Io::Flow::Catalog::V0::Models::AdjustmentType.apply(x))
1617
+ @rounding_method = (x = opts.delete(:rounding_method); x.is_a?(::Io::Flow::Catalog::V0::Models::RoundingMethod) ? x : ::Io::Flow::Catalog::V0::Models::RoundingMethod.apply(x))
1618
+ @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), Numeric)
1619
+ end
1620
+
1621
+ def to_json
1622
+ JSON.dump(to_hash)
1623
+ end
1624
+
1625
+ def copy(incoming={})
1626
+ Rounding.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1627
+ end
1628
+
1629
+ def subtype_to_hash
1630
+ {
1631
+ :name => name.value,
1632
+ :rounding_method => rounding_method.value,
1633
+ :value => value
1634
+ }
1635
+ end
1636
+
1637
+ end
1638
+
1328
1639
  # A configuration with custom query to select a subset of master catalog items
1329
1640
  # for a localized experience
1330
1641
  class Subcatalog < ExpandableSubcatalog
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.32
3
- # apidoc:0.11.28 http://www.apidoc.me/flow/common/0.0.32/ruby_client
2
+ # Service version: 0.0.36
3
+ # apidoc:0.11.29 http://www.apidoc.me/flow/common/0.0.36/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -26,8 +26,8 @@ module Io
26
26
 
27
27
  BASE_URL = 'https://api.flow.io' unless defined?(Constants::BASE_URL)
28
28
  NAMESPACE = 'io.flow.common.v0' unless defined?(Constants::NAMESPACE)
29
- USER_AGENT = 'apidoc:0.11.28 http://www.apidoc.me/flow/common/0.0.32/ruby_client' unless defined?(Constants::USER_AGENT)
30
- VERSION = '0.0.32' unless defined?(Constants::VERSION)
29
+ USER_AGENT = 'apidoc:0.11.29 http://www.apidoc.me/flow/common/0.0.36/ruby_client' unless defined?(Constants::USER_AGENT)
30
+ VERSION = '0.0.36' unless defined?(Constants::VERSION)
31
31
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
32
32
 
33
33
  end
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.32
3
- # apidoc:0.11.28 http://www.apidoc.me/flow/experience/0.0.32/ruby_client
2
+ # Service version: 0.0.36
3
+ # apidoc:0.11.29 http://www.apidoc.me/flow/experience/0.0.36/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -26,8 +26,8 @@ module Io
26
26
 
27
27
  BASE_URL = 'https://experience.api.flow.io' unless defined?(Constants::BASE_URL)
28
28
  NAMESPACE = 'io.flow.experience.v0' unless defined?(Constants::NAMESPACE)
29
- USER_AGENT = 'apidoc:0.11.28 http://www.apidoc.me/flow/experience/0.0.32/ruby_client' unless defined?(Constants::USER_AGENT)
30
- VERSION = '0.0.32' unless defined?(Constants::VERSION)
29
+ USER_AGENT = 'apidoc:0.11.29 http://www.apidoc.me/flow/experience/0.0.36/ruby_client' unless defined?(Constants::USER_AGENT)
30
+ VERSION = '0.0.36' unless defined?(Constants::VERSION)
31
31
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
32
32
 
33
33
  end
@@ -85,6 +85,7 @@ module Io
85
85
  opts = HttpClient::Helper.symbolize_keys(incoming)
86
86
  query = {
87
87
  :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
88
+ :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }),
88
89
  :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
89
90
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
90
91
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
@@ -100,6 +101,7 @@ module Io
100
101
  opts = HttpClient::Helper.symbolize_keys(incoming)
101
102
  query = {
102
103
  :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
104
+ :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }),
103
105
  :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, Array).map { |v| HttpClient::Preconditions.assert_class('name', v, String) }),
104
106
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
105
107
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
@@ -110,10 +112,10 @@ module Io
110
112
  end
111
113
 
112
114
  # Returns information about a specific display.
113
- def get_by_name(organization, name)
115
+ def get_by_key(organization, key)
114
116
  HttpClient::Preconditions.assert_class('organization', organization, String)
115
- HttpClient::Preconditions.assert_class('name', name, String)
116
- r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(name)}").get
117
+ HttpClient::Preconditions.assert_class('key', key, String)
118
+ r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(key)}").get
117
119
  ::Io::Flow::Experience::V0::Models::Display.new(r)
118
120
  end
119
121
 
@@ -125,20 +127,20 @@ module Io
125
127
  ::Io::Flow::Experience::V0::Models::Display.new(r)
126
128
  end
127
129
 
128
- # Update display with the specified name, creating if it does not exist.
129
- def put_by_name(organization, name, display_form)
130
+ # Update display with the specified key, creating if it does not exist.
131
+ def put_by_key(organization, key, display_form)
130
132
  HttpClient::Preconditions.assert_class('organization', organization, String)
131
- HttpClient::Preconditions.assert_class('name', name, String)
133
+ HttpClient::Preconditions.assert_class('key', key, String)
132
134
  HttpClient::Preconditions.assert_class('display_form', display_form, ::Io::Flow::Experience::V0::Models::DisplayForm)
133
- r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(name)}").with_json(display_form.to_json).put
135
+ r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(key)}").with_json(display_form.to_json).put
134
136
  ::Io::Flow::Experience::V0::Models::Display.new(r)
135
137
  end
136
138
 
137
- # Delete the display with this name
138
- def delete_by_name(organization, name)
139
+ # Delete the display with this key
140
+ def delete_by_key(organization, key)
139
141
  HttpClient::Preconditions.assert_class('organization', organization, String)
140
- HttpClient::Preconditions.assert_class('name', name, String)
141
- r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(name)}").delete
142
+ HttpClient::Preconditions.assert_class('key', key, String)
143
+ r = @client.request("/#{CGI.escape(organization)}/displays/#{CGI.escape(key)}").delete
142
144
  nil
143
145
  end
144
146
 
@@ -239,13 +241,13 @@ module Io
239
241
  ::Io::Flow::Experience::V0::Models::Experience.new(r)
240
242
  end
241
243
 
242
- # Remove the experience display with this name
243
- def put_display_by_key_and_name(organization, key, name, hash)
244
+ # Remove the experience display with this key
245
+ def put_displays_by_key_and_display_key(organization, key, display_key, hash)
244
246
  HttpClient::Preconditions.assert_class('organization', organization, String)
245
247
  HttpClient::Preconditions.assert_class('key', key, String)
246
- HttpClient::Preconditions.assert_class('name', name, String)
248
+ HttpClient::Preconditions.assert_class('display_key', display_key, String)
247
249
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
248
- r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/display/#{CGI.escape(name)}").with_json(hash.to_json).put
250
+ r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/displays/#{CGI.escape(display_key)}").with_json(hash.to_json).put
249
251
  ::Io::Flow::Experience::V0::Models::Experience.new(r)
250
252
  end
251
253
 
@@ -356,12 +358,13 @@ module Io
356
358
  # product page or checkout)
357
359
  class Display
358
360
 
359
- attr_reader :id, :name, :context, :component
361
+ attr_reader :id, :key, :name, :context, :component
360
362
 
361
363
  def initialize(incoming={})
362
364
  opts = HttpClient::Helper.symbolize_keys(incoming)
363
- HttpClient::Preconditions.require_keys(opts, [:id, :name, :context, :component], 'Display')
365
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :name, :context, :component], 'Display')
364
366
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
367
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
365
368
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
366
369
  @context = HttpClient::Preconditions.assert_class('context', opts.delete(:context), Array).map { |v| HttpClient::Preconditions.assert_class('context', v, String) }
367
370
  @component = (x = opts.delete(:component); x.is_a?(::Io::Flow::Experience::V0::Models::Component) ? x : ::Io::Flow::Experience::V0::Models::Component.new(x))
@@ -378,6 +381,7 @@ module Io
378
381
  def to_hash
379
382
  {
380
383
  :id => id,
384
+ :key => key,
381
385
  :name => name,
382
386
  :context => context,
383
387
  :component => component.to_hash
@@ -418,13 +422,13 @@ module Io
418
422
 
419
423
  class DisplaySummary
420
424
 
421
- attr_reader :id, :name
425
+ attr_reader :id, :key
422
426
 
423
427
  def initialize(incoming={})
424
428
  opts = HttpClient::Helper.symbolize_keys(incoming)
425
- HttpClient::Preconditions.require_keys(opts, [:id, :name], 'DisplaySummary')
429
+ HttpClient::Preconditions.require_keys(opts, [:id, :key], 'DisplaySummary')
426
430
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
427
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
431
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
428
432
  end
429
433
 
430
434
  def to_json
@@ -438,7 +442,7 @@ module Io
438
442
  def to_hash
439
443
  {
440
444
  :id => id,
441
- :name => name
445
+ :key => key
442
446
  }
443
447
  end
444
448
 
@@ -521,7 +525,7 @@ module Io
521
525
 
522
526
  class ExperienceForm
523
527
 
524
- attr_reader :country, :name, :currency, :display_name, :language, :measurement_system, :subcatalog_id
528
+ attr_reader :country, :name, :currency, :display_key, :language, :measurement_system, :subcatalog_id
525
529
 
526
530
  def initialize(incoming={})
527
531
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -529,7 +533,7 @@ module Io
529
533
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
530
534
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
531
535
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
532
- @display_name = (x = opts.delete(:display_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('display_name', x, Array).map { |v| HttpClient::Preconditions.assert_class('display_name', v, String) })
536
+ @display_key = (x = opts.delete(:display_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('display_key', x, Array).map { |v| HttpClient::Preconditions.assert_class('display_key', v, String) })
533
537
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
534
538
  @measurement_system = (x = opts.delete(:measurement_system); x.nil? ? nil : HttpClient::Preconditions.assert_class('measurement_system', x, String))
535
539
  @subcatalog_id = (x = opts.delete(:subcatalog_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog_id', x, String))
@@ -548,7 +552,7 @@ module Io
548
552
  :country => country,
549
553
  :name => name,
550
554
  :currency => currency,
551
- :display_name => display_name.nil? ? nil : display_name,
555
+ :display_key => display_key.nil? ? nil : display_key,
552
556
  :language => language,
553
557
  :measurement_system => measurement_system,
554
558
  :subcatalog_id => subcatalog_id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowcommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flow Commerce, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json