flowcommerce 0.0.2 → 0.0.3

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: 570243d812d3c483da4005057b58212e2929a7ae
4
- data.tar.gz: d938fc2f031f75fc3c9a354e95f2807dd5430519
3
+ metadata.gz: af689547c1cb19cfe9d3e00793ac8caa39f91f3b
4
+ data.tar.gz: 9ef792eb61d56ed1af67fce82d141c22fbec04b4
5
5
  SHA512:
6
- metadata.gz: b2eec06f709ef8ae3b9939b6f23cc4cfa124bb3e40353cf67217a74557b762fe2cb2718af40b794ad7a203e4827a7b2971d862c1c6cb69bd42e50d8866962612
7
- data.tar.gz: 72dd2f5bc441eb7bed210f9871fd695733dfcc3a66d24cb63ce80de2f20d617fba65a45b10710015336d0209eaefc2cb01af085543e687128f12b4841807adb6
6
+ metadata.gz: 4ba0f90e9185b695dd31f3ee848fc9f59875e3fc6063d5fc84215feb4112274a5ac2c4f847d33d1d99e0a6b808b1fda76935ebdc4cab06f6b9dc2fb0eb6f0536
7
+ data.tar.gz: a930773716cdbfe3c3bd256f976012dbcfc803638f6ccdbcd090a799eacfc95540b7ac9eab6f86cb8b0a32c61e8c0fb99c244ae0a43408add80fb4d8a0199bb0
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.0.11
3
- # apidoc:0.11.17 http://www.apidoc.me/flow/catalog/0.0.11/ruby_client
3
+ # apidoc:0.11.19 http://www.apidoc.me/flow/catalog/0.0.11/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -24,7 +24,7 @@ module Io
24
24
 
25
25
  BASE_URL = 'https://catalog.api.flow.io' unless defined?(Constants::BASE_URL)
26
26
  NAMESPACE = 'io.flow.catalog.v0' unless defined?(Constants::NAMESPACE)
27
- USER_AGENT = 'apidoc:0.11.17 http://www.apidoc.me/flow/catalog/0.0.11/ruby_client' unless defined?(Constants::USER_AGENT)
27
+ USER_AGENT = 'apidoc:0.11.19 http://www.apidoc.me/flow/catalog/0.0.11/ruby_client' unless defined?(Constants::USER_AGENT)
28
28
  VERSION = '0.0.11' unless defined?(Constants::VERSION)
29
29
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
30
30
 
@@ -64,14 +64,14 @@ module Io
64
64
  @catalogs ||= ::Io::Flow::Catalog::V0::Clients::Catalogs.new(self)
65
65
  end
66
66
 
67
- def catalog_items
68
- @catalog_items ||= ::Io::Flow::Catalog::V0::Clients::CatalogItems.new(self)
69
- end
70
-
71
67
  def healthchecks
72
68
  @healthchecks ||= ::Io::Flow::Catalog::V0::Clients::Healthchecks.new(self)
73
69
  end
74
70
 
71
+ def items
72
+ @items ||= ::Io::Flow::Catalog::V0::Clients::Items.new(self)
73
+ end
74
+
75
75
  def views
76
76
  @views ||= ::Io::Flow::Catalog::V0::Clients::Views.new(self)
77
77
  end
@@ -98,7 +98,20 @@ module Io
98
98
 
99
99
  end
100
100
 
101
- class CatalogItems
101
+ class Healthchecks
102
+
103
+ def initialize(client)
104
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::Catalog::V0::Client)
105
+ end
106
+
107
+ def get_healthcheck
108
+ r = @client.request("/_internal_/healthcheck").get
109
+ ::Io::Flow::Common::V0::Models::Healthcheck.new(r)
110
+ end
111
+
112
+ end
113
+
114
+ class Items
102
115
 
103
116
  def initialize(client)
104
117
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::Catalog::V0::Client)
@@ -129,7 +142,7 @@ module Io
129
142
  :query => (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String)),
130
143
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
131
144
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
132
- :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
145
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "lower(name)" : x), String)
133
146
  }.delete_if { |k, v| v.nil? }
134
147
  r = @client.request("/#{CGI.escape(organization)}/catalog/items").with_query(query).get
135
148
  r.map { |x| ::Io::Flow::Catalog::V0::Models::Item.new(x) }
@@ -170,19 +183,6 @@ module Io
170
183
 
171
184
  end
172
185
 
173
- class Healthchecks
174
-
175
- def initialize(client)
176
- @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::Catalog::V0::Client)
177
- end
178
-
179
- def get_healthcheck
180
- r = @client.request("/_internal_/healthcheck").get
181
- ::Io::Flow::Common::V0::Models::Healthcheck.new(r)
182
- end
183
-
184
- end
185
-
186
186
  class Views
187
187
 
188
188
  def initialize(client)
@@ -302,7 +302,7 @@ module Io
302
302
  :query => (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String)),
303
303
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
304
304
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
305
- :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
305
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "lower(name)" : x), String)
306
306
  }.delete_if { |k, v| v.nil? }
307
307
  r = @client.request("/#{CGI.escape(organization)}/catalog/views/#{CGI.escape(view)}/items").with_query(query).get
308
308
  r.map { |x| ::Io::Flow::Catalog::V0::Models::Item.new(x) }
@@ -323,7 +323,7 @@ module Io
323
323
  HttpClient::Preconditions.assert_class('view', view, String)
324
324
  HttpClient::Preconditions.assert_class('item_form', item_form, ::Io::Flow::Catalog::V0::Models::ItemForm)
325
325
  r = @client.request("/#{CGI.escape(organization)}/catalog/views/#{CGI.escape(view)}/items").with_json(item_form.to_json).post
326
- ::Io::Flow::Catalog::V0::Models::View.new(r)
326
+ ::Io::Flow::Catalog::V0::Models::Item.new(r)
327
327
  end
328
328
 
329
329
  # Update view item with the specified id, creating if it does not exist.
@@ -351,56 +351,46 @@ module Io
351
351
 
352
352
  module Models
353
353
 
354
- class Event
354
+ class DimensionType
355
355
 
356
- module Types
357
- ITEM_CREATED = 'item_created' unless defined?(ITEM_CREATED)
358
- ITEM_UPDATED = 'item_updated' unless defined?(ITEM_UPDATED)
359
- ITEM_DELETED = 'item_deleted' unless defined?(ITEM_DELETED)
360
- end
361
-
362
- def initialize(incoming={})
363
- opts = HttpClient::Helper.symbolize_keys(incoming)
364
- HttpClient::Preconditions.require_keys(opts, [:name], 'Event')
365
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
366
- end
356
+ attr_reader :value
367
357
 
368
- def to_hash
369
- subtype_to_hash.merge(:discriminator => @name)
358
+ def initialize(value)
359
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
370
360
  end
371
361
 
372
- def Event.from_json(hash)
373
- HttpClient::Preconditions.assert_class('hash', hash, Hash)
374
- case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
375
- when Types::ITEM_CREATED; ItemCreated.new(hash)
376
- when Types::ITEM_UPDATED; ItemUpdated.new(hash)
377
- when Types::ITEM_DELETED; ItemDeleted.new(hash)
378
- else EventUndefinedType.new(:name => union_type_name)
362
+ # Returns the instance of DimensionType for this value, creating a new instance for an unknown value
363
+ def DimensionType.apply(value)
364
+ if value.instance_of?(DimensionType)
365
+ value
366
+ else
367
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
368
+ value.nil? ? nil : (from_string(value) || DimensionType.new(value))
379
369
  end
380
370
  end
381
371
 
382
- end
383
-
384
- class EventUndefinedType < Event
385
-
386
- attr_reader :name
372
+ # Returns the instance of DimensionType for this value, or nil if not found
373
+ def DimensionType.from_string(value)
374
+ HttpClient::Preconditions.assert_class('value', value, String)
375
+ DimensionType.ALL.find { |v| v.value == value }
376
+ end
387
377
 
388
- def initialize(incoming={})
389
- super(:name => 'undefined_type')
390
- opts = HttpClient::Helper.symbolize_keys(incoming)
391
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
378
+ def DimensionType.ALL
379
+ @@all ||= [DimensionType.product, DimensionType.package]
392
380
  end
393
381
 
394
- def subtype_to_hash
395
- raise 'Unable to serialize undefined type to json'
382
+ # The standalone dimensions of an item.
383
+ def DimensionType.product
384
+ @@_product ||= DimensionType.new('product')
396
385
  end
397
386
 
398
- def copy(incoming={})
399
- raise 'Operation not supported for undefined type'
387
+ # The boxed dimensions of an item.
388
+ def DimensionType.package
389
+ @@_package ||= DimensionType.new('package')
400
390
  end
401
391
 
402
392
  def to_hash
403
- raise 'Operation not supported for undefined type'
393
+ value
404
394
  end
405
395
 
406
396
  end
@@ -506,36 +496,6 @@ module Io
506
496
 
507
497
  end
508
498
 
509
- class CatalogItem
510
-
511
- attr_reader :id, :catalog, :data
512
-
513
- def initialize(incoming={})
514
- opts = HttpClient::Helper.symbolize_keys(incoming)
515
- HttpClient::Preconditions.require_keys(opts, [:id, :catalog, :data], 'CatalogItem')
516
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
517
- @catalog = (x = opts.delete(:catalog); x.is_a?(::Io::Flow::Catalog::V0::Models::Catalog) ? x : ::Io::Flow::Catalog::V0::Models::Catalog.new(x))
518
- @data = (x = opts.delete(:data); x.is_a?(::Io::Flow::Catalog::V0::Models::Item) ? x : ::Io::Flow::Catalog::V0::Models::Item.new(x))
519
- end
520
-
521
- def to_json
522
- JSON.dump(to_hash)
523
- end
524
-
525
- def copy(incoming={})
526
- CatalogItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
527
- end
528
-
529
- def to_hash
530
- {
531
- :id => id,
532
- :catalog => catalog.to_hash,
533
- :data => data.to_hash
534
- }
535
- end
536
-
537
- end
538
-
539
499
  class CatalogVersion
540
500
 
541
501
  attr_reader :id, :timestamp, :type, :catalog
@@ -568,82 +528,18 @@ module Io
568
528
 
569
529
  end
570
530
 
571
- class Codes
572
-
573
- attr_reader :harmonized
574
-
575
- def initialize(incoming={})
576
- opts = HttpClient::Helper.symbolize_keys(incoming)
577
- @harmonized = (x = opts.delete(:harmonized); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Harmonized) ? x : ::Io::Flow::Catalog::V0::Models::Harmonized.new(x)))
578
- end
579
-
580
- def to_json
581
- JSON.dump(to_hash)
582
- end
583
-
584
- def copy(incoming={})
585
- Codes.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
586
- end
587
-
588
- def to_hash
589
- {
590
- :harmonized => harmonized.nil? ? nil : harmonized.to_hash
591
- }
592
- end
593
-
594
- end
595
-
596
- class Content
597
-
598
- attr_reader :dimensions, :locale, :price, :title, :brand, :categories, :description, :images, :policies
599
-
600
- def initialize(incoming={})
601
- opts = HttpClient::Helper.symbolize_keys(incoming)
602
- HttpClient::Preconditions.require_keys(opts, [:dimensions, :locale, :price], 'Content')
603
- @dimensions = (x = opts.delete(:dimensions); x.is_a?(::Io::Flow::Catalog::V0::Models::Dimensions) ? x : ::Io::Flow::Catalog::V0::Models::Dimensions.new(x))
604
- @locale = (x = opts.delete(:locale); x.is_a?(::Io::Flow::Catalog::V0::Models::Locale) ? x : ::Io::Flow::Catalog::V0::Models::Locale.new(x))
605
- @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::Catalog::V0::Models::Price) ? x : ::Io::Flow::Catalog::V0::Models::Price.new(x))
606
- @title = HttpClient::Preconditions.assert_class('title', (x = opts.delete(:title); x.nil? ? "XXXX" : x), String)
607
- @brand = (x = opts.delete(:brand); x.nil? ? nil : HttpClient::Preconditions.assert_class('brand', x, String))
608
- @categories = HttpClient::Preconditions.assert_class('categories', (x = opts.delete(:categories); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) }
609
- @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
610
- @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::Image) ? x : ::Io::Flow::Catalog::V0::Models::Image.new(x)) })
611
- @policies = (x = opts.delete(:policies); x.nil? ? nil : HttpClient::Preconditions.assert_class('policies', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Policy) ? x : ::Io::Flow::Catalog::V0::Models::Policy.new(x)) })
612
- end
613
-
614
- def to_json
615
- JSON.dump(to_hash)
616
- end
617
-
618
- def copy(incoming={})
619
- Content.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
620
- end
621
-
622
- def to_hash
623
- {
624
- :dimensions => dimensions.to_hash,
625
- :locale => locale.to_hash,
626
- :price => price.to_hash,
627
- :title => title,
628
- :brand => brand,
629
- :categories => categories,
630
- :description => description,
631
- :images => images.nil? ? nil : images.map { |o| o.to_hash },
632
- :policies => policies.nil? ? nil : policies.map { |o| o.to_hash }
633
- }
634
- end
635
-
636
- end
637
-
638
531
  class Dimension
639
532
 
640
- attr_reader :units, :value
533
+ attr_reader :type, :depth, :length, :weight, :width
641
534
 
642
535
  def initialize(incoming={})
643
536
  opts = HttpClient::Helper.symbolize_keys(incoming)
644
- HttpClient::Preconditions.require_keys(opts, [:units, :value], 'Dimension')
645
- @units = (x = opts.delete(:units); x.is_a?(::Io::Flow::Common::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::Common::V0::Models::UnitOfMeasurement.apply(x))
646
- @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), String)
537
+ HttpClient::Preconditions.require_keys(opts, [:type], 'Dimension')
538
+ @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::Catalog::V0::Models::DimensionType) ? x : ::Io::Flow::Catalog::V0::Models::DimensionType.apply(x))
539
+ @depth = (x = opts.delete(:depth); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
540
+ @length = (x = opts.delete(:length); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
541
+ @weight = (x = opts.delete(:weight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
542
+ @width = (x = opts.delete(:width); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
647
543
  end
648
544
 
649
545
  def to_json
@@ -656,35 +552,7 @@ module Io
656
552
 
657
553
  def to_hash
658
554
  {
659
- :units => units.value,
660
- :value => value
661
- }
662
- end
663
-
664
- end
665
-
666
- class DimensionSpecification
667
-
668
- attr_reader :depth, :length, :weight, :width
669
-
670
- def initialize(incoming={})
671
- opts = HttpClient::Helper.symbolize_keys(incoming)
672
- @depth = (x = opts.delete(:depth); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)))
673
- @length = (x = opts.delete(:length); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)))
674
- @weight = (x = opts.delete(:weight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)))
675
- @width = (x = opts.delete(:width); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)))
676
- end
677
-
678
- def to_json
679
- JSON.dump(to_hash)
680
- end
681
-
682
- def copy(incoming={})
683
- DimensionSpecification.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
684
- end
685
-
686
- def to_hash
687
- {
555
+ :type => type.value,
688
556
  :depth => depth.nil? ? nil : depth.to_hash,
689
557
  :length => length.nil? ? nil : length.to_hash,
690
558
  :weight => weight.nil? ? nil : weight.to_hash,
@@ -694,98 +562,15 @@ module Io
694
562
 
695
563
  end
696
564
 
697
- class Dimensions
698
-
699
- attr_reader :physical, :shipping
700
-
701
- def initialize(incoming={})
702
- opts = HttpClient::Helper.symbolize_keys(incoming)
703
- @physical = (x = opts.delete(:physical); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::DimensionSpecification) ? x : ::Io::Flow::Catalog::V0::Models::DimensionSpecification.new(x)))
704
- @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::DimensionSpecification) ? x : ::Io::Flow::Catalog::V0::Models::DimensionSpecification.new(x)))
705
- end
706
-
707
- def to_json
708
- JSON.dump(to_hash)
709
- end
710
-
711
- def copy(incoming={})
712
- Dimensions.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
713
- end
714
-
715
- def to_hash
716
- {
717
- :physical => physical.nil? ? nil : physical.to_hash,
718
- :shipping => shipping.nil? ? nil : shipping.to_hash
719
- }
720
- end
721
-
722
- end
723
-
724
- class Harmonized
725
-
726
- attr_reader :hs6, :hs10
727
-
728
- def initialize(incoming={})
729
- opts = HttpClient::Helper.symbolize_keys(incoming)
730
- @hs6 = (x = opts.delete(:hs6); x.nil? ? nil : HttpClient::Preconditions.assert_class('hs6', x, String))
731
- @hs10 = (x = opts.delete(:hs10); x.nil? ? nil : HttpClient::Preconditions.assert_class('hs10', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::HarmonizedGeo) ? x : ::Io::Flow::Catalog::V0::Models::HarmonizedGeo.new(x)) })
732
- end
733
-
734
- def to_json
735
- JSON.dump(to_hash)
736
- end
737
-
738
- def copy(incoming={})
739
- Harmonized.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
740
- end
741
-
742
- def to_hash
743
- {
744
- :hs6 => hs6,
745
- :hs10 => hs10.nil? ? nil : hs10.map { |o| o.to_hash }
746
- }
747
- end
748
-
749
- end
750
-
751
- class HarmonizedGeo
752
-
753
- attr_reader :code, :from, :to
754
-
755
- def initialize(incoming={})
756
- opts = HttpClient::Helper.symbolize_keys(incoming)
757
- @code = (x = opts.delete(:code); x.nil? ? nil : HttpClient::Preconditions.assert_class('code', x, String))
758
- @from = (x = opts.delete(:from); x.nil? ? nil : HttpClient::Preconditions.assert_class('from', x, String))
759
- @to = (x = opts.delete(:to); x.nil? ? nil : HttpClient::Preconditions.assert_class('to', x, String))
760
- end
761
-
762
- def to_json
763
- JSON.dump(to_hash)
764
- end
765
-
766
- def copy(incoming={})
767
- HarmonizedGeo.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
768
- end
769
-
770
- def to_hash
771
- {
772
- :code => code,
773
- :from => from,
774
- :to => to
775
- }
776
- end
777
-
778
- end
779
-
780
565
  class Image
781
566
 
782
- attr_reader :tags, :url
567
+ attr_reader :url, :tags
783
568
 
784
569
  def initialize(incoming={})
785
570
  opts = HttpClient::Helper.symbolize_keys(incoming)
786
571
  HttpClient::Preconditions.require_keys(opts, [:url], 'Image')
787
- @tags = HttpClient::Preconditions.assert_class('tags', (x = opts.delete(:tags); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('tags', v, String) }
788
572
  @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String)
573
+ @tags = HttpClient::Preconditions.assert_class('tags', (x = opts.delete(:tags); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('tags', v, String) }
789
574
  end
790
575
 
791
576
  def to_json
@@ -798,8 +583,8 @@ module Io
798
583
 
799
584
  def to_hash
800
585
  {
801
- :tags => tags,
802
- :url => url
586
+ :url => url,
587
+ :tags => tags
803
588
  }
804
589
  end
805
590
 
@@ -807,17 +592,22 @@ module Io
807
592
 
808
593
  class Item
809
594
 
810
- attr_reader :id, :number, :attributes, :codes, :content, :metadata
595
+ attr_reader :id, :number, :currency, :locale, :name, :price, :categories, :description, :dimensions, :images, :attributes
811
596
 
812
597
  def initialize(incoming={})
813
598
  opts = HttpClient::Helper.symbolize_keys(incoming)
814
- HttpClient::Preconditions.require_keys(opts, [:id, :number, :codes, :content, :metadata], 'Item')
599
+ HttpClient::Preconditions.require_keys(opts, [:id, :number, :currency, :locale, :name, :price], 'Item')
815
600
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
816
601
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
602
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
603
+ @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String)
604
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
605
+ @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Float)
606
+ @categories = HttpClient::Preconditions.assert_class('categories', (x = opts.delete(:categories); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) }
607
+ @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
608
+ @dimensions = HttpClient::Preconditions.assert_class('dimensions', (x = opts.delete(:dimensions); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)) }
609
+ @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)) }
817
610
  @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)) }
818
- @codes = (x = opts.delete(:codes); x.is_a?(::Io::Flow::Catalog::V0::Models::Codes) ? x : ::Io::Flow::Catalog::V0::Models::Codes.new(x))
819
- @content = HttpClient::Preconditions.assert_class('content', opts.delete(:content), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Content) ? x : ::Io::Flow::Catalog::V0::Models::Content.new(x)) }
820
- @metadata = HttpClient::Preconditions.assert_class('metadata', opts.delete(:metadata), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('metadata', d[1], String); h }
821
611
  end
822
612
 
823
613
  def to_json
@@ -832,64 +622,15 @@ module Io
832
622
  {
833
623
  :id => id,
834
624
  :number => number,
835
- :attributes => attributes.map { |o| o.to_hash },
836
- :codes => codes.to_hash,
837
- :content => content.map { |o| o.to_hash },
838
- :metadata => metadata
839
- }
840
- end
841
-
842
- end
843
-
844
- class ItemCreated < Event
845
-
846
- attr_reader :id
847
-
848
- def initialize(incoming={})
849
- super(:name => Event::Types::ITEM_CREATED)
850
- opts = HttpClient::Helper.symbolize_keys(incoming)
851
- HttpClient::Preconditions.require_keys(opts, [:id], 'ItemCreated')
852
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
853
- end
854
-
855
- def to_json
856
- JSON.dump(to_hash)
857
- end
858
-
859
- def copy(incoming={})
860
- ItemCreated.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
861
- end
862
-
863
- def subtype_to_hash
864
- {
865
- :id => id
866
- }
867
- end
868
-
869
- end
870
-
871
- class ItemDeleted < Event
872
-
873
- attr_reader :id
874
-
875
- def initialize(incoming={})
876
- super(:name => Event::Types::ITEM_DELETED)
877
- opts = HttpClient::Helper.symbolize_keys(incoming)
878
- HttpClient::Preconditions.require_keys(opts, [:id], 'ItemDeleted')
879
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
880
- end
881
-
882
- def to_json
883
- JSON.dump(to_hash)
884
- end
885
-
886
- def copy(incoming={})
887
- ItemDeleted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
888
- end
889
-
890
- def subtype_to_hash
891
- {
892
- :id => id
625
+ :currency => currency,
626
+ :locale => locale,
627
+ :name => name,
628
+ :price => price,
629
+ :categories => categories,
630
+ :description => description,
631
+ :dimensions => dimensions.map { |o| o.to_hash },
632
+ :images => images.map { |o| o.to_hash },
633
+ :attributes => attributes.map { |o| o.to_hash }
893
634
  }
894
635
  end
895
636
 
@@ -897,16 +638,21 @@ module Io
897
638
 
898
639
  class ItemForm
899
640
 
900
- attr_reader :attributes, :codes, :content, :metadata, :number
641
+ attr_reader :number, :currency, :locale, :name, :price, :categories, :description, :dimensions, :images, :attributes
901
642
 
902
643
  def initialize(incoming={})
903
644
  opts = HttpClient::Helper.symbolize_keys(incoming)
904
- HttpClient::Preconditions.require_keys(opts, [:codes, :content, :metadata, :number], 'ItemForm')
905
- @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)) }
906
- @codes = (x = opts.delete(:codes); x.is_a?(::Io::Flow::Catalog::V0::Models::Codes) ? x : ::Io::Flow::Catalog::V0::Models::Codes.new(x))
907
- @content = HttpClient::Preconditions.assert_class('content', opts.delete(:content), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Content) ? x : ::Io::Flow::Catalog::V0::Models::Content.new(x)) }
908
- @metadata = HttpClient::Preconditions.assert_class('metadata', opts.delete(:metadata), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('metadata', d[1], String); h }
645
+ HttpClient::Preconditions.require_keys(opts, [:number, :currency, :locale, :name, :price], 'ItemForm')
909
646
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
647
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
648
+ @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String)
649
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
650
+ @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Float)
651
+ @categories = (x = opts.delete(:categories); x.nil? ? nil : HttpClient::Preconditions.assert_class('categories', x, Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) })
652
+ @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
653
+ @dimensions = (x = opts.delete(:dimensions); x.nil? ? nil : HttpClient::Preconditions.assert_class('dimensions', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::Dimension) ? x : ::Io::Flow::Catalog::V0::Models::Dimension.new(x)) })
654
+ @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::Image) ? x : ::Io::Flow::Catalog::V0::Models::Image.new(x)) })
655
+ @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)) })
910
656
  end
911
657
 
912
658
  def to_json
@@ -919,38 +665,16 @@ module Io
919
665
 
920
666
  def to_hash
921
667
  {
922
- :attributes => attributes.map { |o| o.to_hash },
923
- :codes => codes.to_hash,
924
- :content => content.map { |o| o.to_hash },
925
- :metadata => metadata,
926
- :number => number
927
- }
928
- end
929
-
930
- end
931
-
932
- class ItemUpdated < Event
933
-
934
- attr_reader :id
935
-
936
- def initialize(incoming={})
937
- super(:name => Event::Types::ITEM_UPDATED)
938
- opts = HttpClient::Helper.symbolize_keys(incoming)
939
- HttpClient::Preconditions.require_keys(opts, [:id], 'ItemUpdated')
940
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
941
- end
942
-
943
- def to_json
944
- JSON.dump(to_hash)
945
- end
946
-
947
- def copy(incoming={})
948
- ItemUpdated.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
949
- end
950
-
951
- def subtype_to_hash
952
- {
953
- :id => id
668
+ :number => number,
669
+ :currency => currency,
670
+ :locale => locale,
671
+ :name => name,
672
+ :price => price,
673
+ :categories => categories.nil? ? nil : categories,
674
+ :description => description,
675
+ :dimensions => dimensions.nil? ? nil : dimensions.map { |o| o.to_hash },
676
+ :images => images.nil? ? nil : images.map { |o| o.to_hash },
677
+ :attributes => attributes.nil? ? nil : attributes.map { |o| o.to_hash }
954
678
  }
955
679
  end
956
680
 
@@ -988,100 +712,20 @@ module Io
988
712
 
989
713
  end
990
714
 
991
- class Locale
992
-
993
- attr_reader :country, :language
994
-
995
- def initialize(incoming={})
996
- opts = HttpClient::Helper.symbolize_keys(incoming)
997
- @country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
998
- @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
999
- end
1000
-
1001
- def to_json
1002
- JSON.dump(to_hash)
1003
- end
1004
-
1005
- def copy(incoming={})
1006
- Locale.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1007
- end
1008
-
1009
- def to_hash
1010
- {
1011
- :country => country,
1012
- :language => language
1013
- }
1014
- end
1015
-
1016
- end
1017
-
1018
- class Policy
1019
-
1020
- attr_reader :id
1021
-
1022
- def initialize(incoming={})
1023
- opts = HttpClient::Helper.symbolize_keys(incoming)
1024
- HttpClient::Preconditions.require_keys(opts, [:id], 'Policy')
1025
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
1026
- end
1027
-
1028
- def to_json
1029
- JSON.dump(to_hash)
1030
- end
1031
-
1032
- def copy(incoming={})
1033
- Policy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1034
- end
1035
-
1036
- def to_hash
1037
- {
1038
- :id => id
1039
- }
1040
- end
1041
-
1042
- end
1043
-
1044
- class Price
1045
-
1046
- attr_reader :current, :msrp
1047
-
1048
- def initialize(incoming={})
1049
- opts = HttpClient::Helper.symbolize_keys(incoming)
1050
- @current = (x = opts.delete(:current); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Price) ? x : ::Io::Flow::Common::V0::Models::Price.new(x)))
1051
- @msrp = (x = opts.delete(:msrp); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Price) ? x : ::Io::Flow::Common::V0::Models::Price.new(x)))
1052
- end
1053
-
1054
- def to_json
1055
- JSON.dump(to_hash)
1056
- end
1057
-
1058
- def copy(incoming={})
1059
- Price.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
1060
- end
1061
-
1062
- def to_hash
1063
- {
1064
- :current => current.nil? ? nil : current.to_hash,
1065
- :msrp => msrp.nil? ? nil : msrp.to_hash
1066
- }
1067
- end
1068
-
1069
- end
1070
-
1071
715
  class View
1072
716
 
1073
- attr_reader :id, :catalog, :key, :countries, :currency, :query, :settings
717
+ attr_reader :id, :catalog, :key, :countries, :currency, :settings, :query
1074
718
 
1075
719
  def initialize(incoming={})
1076
720
  opts = HttpClient::Helper.symbolize_keys(incoming)
1077
- HttpClient::Preconditions.require_keys(opts, [:id, :catalog, :key, :countries, :currency, :query, :settings], 'View')
721
+ HttpClient::Preconditions.require_keys(opts, [:id, :catalog, :key, :countries, :currency, :settings], 'View')
1078
722
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
1079
723
  @catalog = (x = opts.delete(:catalog); x.is_a?(::Io::Flow::Catalog::V0::Models::Catalog) ? x : ::Io::Flow::Catalog::V0::Models::Catalog.new(x))
1080
724
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
1081
725
  @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
1082
726
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
1083
- @query = HttpClient::Preconditions.assert_class('query', opts.delete(:query), String)
1084
727
  @settings = (x = opts.delete(:settings); x.is_a?(::Io::Flow::Catalog::V0::Models::ViewSettings) ? x : ::Io::Flow::Catalog::V0::Models::ViewSettings.new(x))
728
+ @query = (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String))
1085
729
  end
1086
730
 
1087
731
  def to_json
@@ -1099,8 +743,8 @@ module Io
1099
743
  :key => key,
1100
744
  :countries => countries,
1101
745
  :currency => currency,
1102
- :query => query,
1103
- :settings => settings.to_hash
746
+ :settings => settings.to_hash,
747
+ :query => query
1104
748
  }
1105
749
  end
1106
750
 
@@ -1108,16 +752,16 @@ module Io
1108
752
 
1109
753
  class ViewForm
1110
754
 
1111
- attr_reader :key, :countries, :currency, :query, :settings
755
+ attr_reader :countries, :key, :currency, :query, :settings
1112
756
 
1113
757
  def initialize(incoming={})
1114
758
  opts = HttpClient::Helper.symbolize_keys(incoming)
1115
- HttpClient::Preconditions.require_keys(opts, [:key, :countries, :currency, :query, :settings], 'ViewForm')
1116
- @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
759
+ HttpClient::Preconditions.require_keys(opts, [:countries], 'ViewForm')
1117
760
  @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
1118
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
1119
- @query = HttpClient::Preconditions.assert_class('query', opts.delete(:query), String)
1120
- @settings = (x = opts.delete(:settings); x.is_a?(::Io::Flow::Catalog::V0::Models::ViewSettingsForm) ? x : ::Io::Flow::Catalog::V0::Models::ViewSettingsForm.new(x))
761
+ @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
762
+ @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
763
+ @query = (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String))
764
+ @settings = (x = opts.delete(:settings); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::ViewSettingsForm) ? x : ::Io::Flow::Catalog::V0::Models::ViewSettingsForm.new(x)))
1121
765
  end
1122
766
 
1123
767
  def to_json
@@ -1130,25 +774,25 @@ module Io
1130
774
 
1131
775
  def to_hash
1132
776
  {
1133
- :key => key,
1134
777
  :countries => countries,
778
+ :key => key,
1135
779
  :currency => currency,
1136
780
  :query => query,
1137
- :settings => settings.to_hash
781
+ :settings => settings.nil? ? nil : settings.to_hash
1138
782
  }
1139
783
  end
1140
784
 
1141
785
  end
1142
786
 
787
+ # Placeholder for view_item resource.
1143
788
  class ViewItem
1144
789
 
1145
- attr_reader :id, :data
790
+ attr_reader :id
1146
791
 
1147
792
  def initialize(incoming={})
1148
793
  opts = HttpClient::Helper.symbolize_keys(incoming)
1149
- HttpClient::Preconditions.require_keys(opts, [:id, :data], 'ViewItem')
794
+ HttpClient::Preconditions.require_keys(opts, [:id], 'ViewItem')
1150
795
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
1151
- @data = (x = opts.delete(:data); x.is_a?(::Io::Flow::Catalog::V0::Models::Item) ? x : ::Io::Flow::Catalog::V0::Models::Item.new(x))
1152
796
  end
1153
797
 
1154
798
  def to_json
@@ -1161,8 +805,7 @@ module Io
1161
805
 
1162
806
  def to_hash
1163
807
  {
1164
- :id => id,
1165
- :data => data.to_hash
808
+ :id => id
1166
809
  }
1167
810
  end
1168
811
 
@@ -1669,4 +1312,4 @@ module Io
1669
1312
  end
1670
1313
  end
1671
1314
  end
1672
- end
1315
+ end
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.0.11
3
- # apidoc:0.11.17 http://www.apidoc.me/flow/common/0.0.11/ruby_client
3
+ # apidoc:0.11.19 http://www.apidoc.me/flow/common/0.0.11/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -23,7 +23,7 @@ module Io
23
23
  module Constants
24
24
 
25
25
  NAMESPACE = 'io.flow.common.v0' unless defined?(Constants::NAMESPACE)
26
- USER_AGENT = 'apidoc:0.11.17 http://www.apidoc.me/flow/common/0.0.11/ruby_client' unless defined?(Constants::USER_AGENT)
26
+ USER_AGENT = 'apidoc:0.11.19 http://www.apidoc.me/flow/common/0.0.11/ruby_client' unless defined?(Constants::USER_AGENT)
27
27
  VERSION = '0.0.11' unless defined?(Constants::VERSION)
28
28
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
29
29
 
@@ -798,6 +798,34 @@ module Io
798
798
 
799
799
  end
800
800
 
801
+ class Measurement
802
+
803
+ attr_reader :value, :units
804
+
805
+ def initialize(incoming={})
806
+ opts = HttpClient::Helper.symbolize_keys(incoming)
807
+ HttpClient::Preconditions.require_keys(opts, [:value, :units], 'Measurement')
808
+ @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), String)
809
+ @units = (x = opts.delete(:units); x.is_a?(::Io::Flow::Common::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::Common::V0::Models::UnitOfMeasurement.apply(x))
810
+ end
811
+
812
+ def to_json
813
+ JSON.dump(to_hash)
814
+ end
815
+
816
+ def copy(incoming={})
817
+ Measurement.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
818
+ end
819
+
820
+ def to_hash
821
+ {
822
+ :value => value,
823
+ :units => units.value
824
+ }
825
+ end
826
+
827
+ end
828
+
801
829
  class Name
802
830
 
803
831
  attr_reader :first, :last
@@ -917,7 +945,7 @@ module Io
917
945
  def initialize(incoming={})
918
946
  opts = HttpClient::Helper.symbolize_keys(incoming)
919
947
  HttpClient::Preconditions.require_keys(opts, [:amount, :currency], 'Price')
920
- @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), String)
948
+ @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Float)
921
949
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
922
950
  end
923
951
 
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.2
4
+ version: 0.0.3
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-03-11 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json