flowcommerce 0.0.8 → 0.0.9

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: 4254e88417e5c637a08132c28e0590473cb1705d
4
- data.tar.gz: 89d32eca13e96d0738e05aa57f0c298aa18d3cd7
3
+ metadata.gz: 8e1ab24a647828ba12efcb9d3f05f57fc1029194
4
+ data.tar.gz: 77f306c8b91ee323eea6c12bf1bec009eff9175a
5
5
  SHA512:
6
- metadata.gz: 45187247ba83791d213d229f15d41cba2c7fb3f4d2fc6ace91c28c7e9972bcf2b5230d3531fda9845f9e7ddc77d2dc2d9f768c7c9905948c585309ce79d373f6
7
- data.tar.gz: 77c8d49ac34df85aa207f2bf3fcc3b90590e3e8908c0a25e7c7b0a5cec778a6ed2509e91ec523ab706295d28fbe002b905efd181208c15f1ed90313ef5d573ac
6
+ metadata.gz: 7d6f63155c597b4565b0ed4467eff830f8d6986c4ee2cf79b20381ea782c9e2929ca2228975363fa40f1c857bd8e33717d4cd4d3cea80892b5422348bbe9c3c6
7
+ data.tar.gz: ae5cb61a18ce10b99a0a78b5ea4859b094deffe0361d2c9e400beef376bdcbbc6a232dc70ebaebecbe301c42867b36b9f73c365452229824ed687c04de06d239
@@ -361,6 +361,58 @@ module Io
361
361
 
362
362
  module Models
363
363
 
364
+ class ExpandableSubcatalog
365
+
366
+ module Types
367
+ SUBCATALOG = 'subcatalog' unless defined?(SUBCATALOG)
368
+ SUBCATALOG_REFERENCE = 'subcatalog_reference' unless defined?(SUBCATALOG_REFERENCE)
369
+ end
370
+
371
+ def initialize(incoming={})
372
+ opts = HttpClient::Helper.symbolize_keys(incoming)
373
+ HttpClient::Preconditions.require_keys(opts, [:name], 'ExpandableSubcatalog')
374
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
375
+ end
376
+
377
+ def to_hash
378
+ subtype_to_hash.merge(:discriminator => @name)
379
+ end
380
+
381
+ def ExpandableSubcatalog.from_json(hash)
382
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
383
+ case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
384
+ when Types::SUBCATALOG; Subcatalog.new(hash)
385
+ when Types::SUBCATALOG_REFERENCE; SubcatalogReference.new(hash)
386
+ else ExpandableSubcatalogUndefinedType.new(:name => union_type_name)
387
+ end
388
+ end
389
+
390
+ end
391
+
392
+ class ExpandableSubcatalogUndefinedType < ExpandableSubcatalog
393
+
394
+ attr_reader :name
395
+
396
+ def initialize(incoming={})
397
+ super(:name => 'undefined_type')
398
+ opts = HttpClient::Helper.symbolize_keys(incoming)
399
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
400
+ end
401
+
402
+ def subtype_to_hash
403
+ raise 'Unable to serialize undefined type to json'
404
+ end
405
+
406
+ def copy(incoming={})
407
+ raise 'Operation not supported for undefined type'
408
+ end
409
+
410
+ def to_hash
411
+ raise 'Operation not supported for undefined type'
412
+ end
413
+
414
+ end
415
+
364
416
  class DimensionType
365
417
 
366
418
  attr_reader :value
@@ -602,22 +654,23 @@ module Io
602
654
 
603
655
  class Item
604
656
 
605
- attr_reader :id, :number, :currency, :locale, :name, :price, :categories, :description, :dimensions, :images, :attributes
657
+ attr_reader :id, :number, :locale, :name, :currency, :price, :categories, :description, :dimensions, :images, :attributes, :local
606
658
 
607
659
  def initialize(incoming={})
608
660
  opts = HttpClient::Helper.symbolize_keys(incoming)
609
- HttpClient::Preconditions.require_keys(opts, [:id, :number, :currency, :locale, :name, :price], 'Item')
661
+ HttpClient::Preconditions.require_keys(opts, [:id, :number, :locale, :name, :currency, :price], 'Item')
610
662
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
611
663
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
612
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
613
664
  @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String)
614
665
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
615
- @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Numeric)
666
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
667
+ @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::Catalog::V0::Models::Price) ? x : ::Io::Flow::Catalog::V0::Models::Price.new(x))
616
668
  @categories = HttpClient::Preconditions.assert_class('categories', (x = opts.delete(:categories); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) }
617
669
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
618
670
  @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)) }
619
671
  @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)) }
620
672
  @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)) }
673
+ @local = (x = opts.delete(:local); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::Local) ? x : ::Io::Flow::Catalog::V0::Models::Local.new(x)))
621
674
  end
622
675
 
623
676
  def to_json
@@ -632,15 +685,16 @@ module Io
632
685
  {
633
686
  :id => id,
634
687
  :number => number,
635
- :currency => currency,
636
688
  :locale => locale,
637
689
  :name => name,
638
- :price => price,
690
+ :currency => currency,
691
+ :price => price.to_hash,
639
692
  :categories => categories,
640
693
  :description => description,
641
694
  :dimensions => dimensions.map { |o| o.to_hash },
642
695
  :images => images.map { |o| o.to_hash },
643
- :attributes => attributes.map { |o| o.to_hash }
696
+ :attributes => attributes.map { |o| o.to_hash },
697
+ :local => local.nil? ? nil : local.to_hash
644
698
  }
645
699
  end
646
700
 
@@ -648,15 +702,15 @@ module Io
648
702
 
649
703
  class ItemForm
650
704
 
651
- attr_reader :number, :currency, :locale, :name, :price, :categories, :description, :dimensions, :images, :attributes
705
+ attr_reader :number, :locale, :name, :currency, :price, :categories, :description, :dimensions, :images, :attributes
652
706
 
653
707
  def initialize(incoming={})
654
708
  opts = HttpClient::Helper.symbolize_keys(incoming)
655
- HttpClient::Preconditions.require_keys(opts, [:number, :currency, :locale, :name, :price], 'ItemForm')
709
+ HttpClient::Preconditions.require_keys(opts, [:number, :locale, :name, :currency, :price], 'ItemForm')
656
710
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
657
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
658
711
  @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String)
659
712
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
713
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
660
714
  @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Numeric)
661
715
  @categories = (x = opts.delete(:categories); x.nil? ? nil : HttpClient::Preconditions.assert_class('categories', x, Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) })
662
716
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
@@ -676,9 +730,9 @@ module Io
676
730
  def to_hash
677
731
  {
678
732
  :number => number,
679
- :currency => currency,
680
733
  :locale => locale,
681
734
  :name => name,
735
+ :currency => currency,
682
736
  :price => price,
683
737
  :categories => categories.nil? ? nil : categories,
684
738
  :description => description,
@@ -722,18 +776,101 @@ module Io
722
776
 
723
777
  end
724
778
 
725
- class Subcatalog
779
+ class Local
726
780
 
727
- attr_reader :id, :catalog, :key, :countries, :currency, :settings, :query
781
+ attr_reader :prices
728
782
 
729
783
  def initialize(incoming={})
730
784
  opts = HttpClient::Helper.symbolize_keys(incoming)
731
- HttpClient::Preconditions.require_keys(opts, [:id, :catalog, :key, :countries, :currency, :settings], 'Subcatalog')
785
+ HttpClient::Preconditions.require_keys(opts, [:prices], 'Local')
786
+ @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Catalog::V0::Models::LocalizedPrice) ? x : ::Io::Flow::Catalog::V0::Models::LocalizedPrice.new(x)) }
787
+ end
788
+
789
+ def to_json
790
+ JSON.dump(to_hash)
791
+ end
792
+
793
+ def copy(incoming={})
794
+ Local.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
795
+ end
796
+
797
+ def to_hash
798
+ {
799
+ :prices => prices.map { |o| o.to_hash }
800
+ }
801
+ end
802
+
803
+ end
804
+
805
+ class LocalizedPrice
806
+
807
+ attr_reader :key, :amount, :label
808
+
809
+ def initialize(incoming={})
810
+ opts = HttpClient::Helper.symbolize_keys(incoming)
811
+ HttpClient::Preconditions.require_keys(opts, [:key, :amount, :label], 'LocalizedPrice')
812
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
813
+ @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
814
+ @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
815
+ end
816
+
817
+ def to_json
818
+ JSON.dump(to_hash)
819
+ end
820
+
821
+ def copy(incoming={})
822
+ LocalizedPrice.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
823
+ end
824
+
825
+ def to_hash
826
+ {
827
+ :key => key,
828
+ :amount => amount,
829
+ :label => label
830
+ }
831
+ end
832
+
833
+ end
834
+
835
+ class Price
836
+
837
+ attr_reader :amount, :label
838
+
839
+ def initialize(incoming={})
840
+ opts = HttpClient::Helper.symbolize_keys(incoming)
841
+ HttpClient::Preconditions.require_keys(opts, [:amount, :label], 'Price')
842
+ @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
843
+ @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
844
+ end
845
+
846
+ def to_json
847
+ JSON.dump(to_hash)
848
+ end
849
+
850
+ def copy(incoming={})
851
+ Price.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
852
+ end
853
+
854
+ def to_hash
855
+ {
856
+ :amount => amount,
857
+ :label => label
858
+ }
859
+ end
860
+
861
+ end
862
+
863
+ class Subcatalog < ExpandableSubcatalog
864
+
865
+ attr_reader :id, :catalog, :key, :settings, :query
866
+
867
+ def initialize(incoming={})
868
+ super(:name => ExpandableSubcatalog::Types::SUBCATALOG)
869
+ opts = HttpClient::Helper.symbolize_keys(incoming)
870
+ HttpClient::Preconditions.require_keys(opts, [:id, :catalog, :key, :settings], 'Subcatalog')
732
871
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
733
872
  @catalog = (x = opts.delete(:catalog); x.is_a?(::Io::Flow::Catalog::V0::Models::Catalog) ? x : ::Io::Flow::Catalog::V0::Models::Catalog.new(x))
734
873
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
735
- @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
736
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
737
874
  @settings = (x = opts.delete(:settings); x.is_a?(::Io::Flow::Catalog::V0::Models::SubcatalogSettings) ? x : ::Io::Flow::Catalog::V0::Models::SubcatalogSettings.new(x))
738
875
  @query = (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String))
739
876
  end
@@ -743,16 +880,14 @@ module Io
743
880
  end
744
881
 
745
882
  def copy(incoming={})
746
- Subcatalog.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
883
+ Subcatalog.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
747
884
  end
748
885
 
749
- def to_hash
886
+ def subtype_to_hash
750
887
  {
751
888
  :id => id,
752
889
  :catalog => catalog.to_hash,
753
890
  :key => key,
754
- :countries => countries,
755
- :currency => currency,
756
891
  :settings => settings.to_hash,
757
892
  :query => query
758
893
  }
@@ -762,14 +897,11 @@ module Io
762
897
 
763
898
  class SubcatalogForm
764
899
 
765
- attr_reader :countries, :key, :currency, :query, :settings
900
+ attr_reader :key, :query, :settings
766
901
 
767
902
  def initialize(incoming={})
768
903
  opts = HttpClient::Helper.symbolize_keys(incoming)
769
- HttpClient::Preconditions.require_keys(opts, [:countries], 'SubcatalogForm')
770
- @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
771
904
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
772
- @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
773
905
  @query = (x = opts.delete(:query); x.nil? ? nil : HttpClient::Preconditions.assert_class('query', x, String))
774
906
  @settings = (x = opts.delete(:settings); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Catalog::V0::Models::SubcatalogSettingsForm) ? x : ::Io::Flow::Catalog::V0::Models::SubcatalogSettingsForm.new(x)))
775
907
  end
@@ -784,9 +916,7 @@ module Io
784
916
 
785
917
  def to_hash
786
918
  {
787
- :countries => countries,
788
919
  :key => key,
789
- :currency => currency,
790
920
  :query => query,
791
921
  :settings => settings.nil? ? nil : settings.to_hash
792
922
  }
@@ -794,7 +924,6 @@ module Io
794
924
 
795
925
  end
796
926
 
797
- # Placeholder for subcatalog_item resource.
798
927
  class SubcatalogItem
799
928
 
800
929
  attr_reader :id
@@ -821,6 +950,33 @@ module Io
821
950
 
822
951
  end
823
952
 
953
+ class SubcatalogReference < ExpandableSubcatalog
954
+
955
+ attr_reader :id
956
+
957
+ def initialize(incoming={})
958
+ super(:name => ExpandableSubcatalog::Types::SUBCATALOG_REFERENCE)
959
+ opts = HttpClient::Helper.symbolize_keys(incoming)
960
+ HttpClient::Preconditions.require_keys(opts, [:id], 'SubcatalogReference')
961
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
962
+ end
963
+
964
+ def to_json
965
+ JSON.dump(to_hash)
966
+ end
967
+
968
+ def copy(incoming={})
969
+ SubcatalogReference.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
970
+ end
971
+
972
+ def subtype_to_hash
973
+ {
974
+ :id => id
975
+ }
976
+ end
977
+
978
+ end
979
+
824
980
  class SubcatalogSettings
825
981
 
826
982
  attr_reader :update_policy
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.8
4
+ version: 0.0.9
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-29 00:00:00.000000000 Z
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json