flowcommerce 0.0.19 → 0.0.20

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: 3b92bf91f71330ca707d40dc304753db206910a1
4
- data.tar.gz: 240876db6a950b588d838319faab4609d7e4e428
3
+ metadata.gz: 88a0ee5512e740845dac43fade0d5c3c698ee244
4
+ data.tar.gz: 737a1b1f72da00a597be1df2eb8d8a7256b70424
5
5
  SHA512:
6
- metadata.gz: 19100dabe8a83d1fc692621bafcbfc4d2c7dbe6b6b04a76ff7819d4a7733c54bf87cd1b20596b0b2d6c213b6b96c05cf2db7183fda58411dbe6a25be52779d57
7
- data.tar.gz: 579139b4d1ae1261bdcccd1c49118f1e2853795825e189027fe3bb852466cdca4e0e08bccaca56bd1c3c00e0b5bc016e6f231db32f39f9d3cfd1ce9897aeb10c
6
+ metadata.gz: 70a16853a2e7645a03036b0e01d04162930b2317cd15f4e756f05d988ff1c9ce04dc5367a96f3bf6fb91f818f0080e5538164cd095e0ef3048d680e944d61b89
7
+ data.tar.gz: 49c823e90d99edaa90417af5e1149db60b5a6329060e2d1667f30d296d0898801320348b94d546348e0731ea248d0391eadb6fe349926106a3f9bdae01a62532
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.60
3
- # apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.60/ruby_client
2
+ # Service version: 0.0.61
3
+ # apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.61/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -25,8 +25,8 @@ module Io
25
25
 
26
26
  BASE_URL = 'https://api.flow.io' unless defined?(Constants::BASE_URL)
27
27
  NAMESPACE = 'io.flow.v0' unless defined?(Constants::NAMESPACE)
28
- USER_AGENT = 'apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.60/ruby_client' unless defined?(Constants::USER_AGENT)
29
- VERSION = '0.0.60' unless defined?(Constants::VERSION)
28
+ USER_AGENT = 'apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.61/ruby_client' unless defined?(Constants::USER_AGENT)
29
+ VERSION = '0.0.61' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
32
32
  end
@@ -437,16 +437,16 @@ module Io
437
437
  ::Io::Flow::V0::Models::Experience.new(r)
438
438
  end
439
439
 
440
- # Returns information about 1 or more items, localized based on the query
441
- # parameters
440
+ # Returns localized information about 1 or more items. The items will be
441
+ # localized based on the experience selected by the query parameters in the
442
+ # order of experience, then country, then ip address.
442
443
  def get_items(organization, incoming={})
443
444
  HttpClient::Preconditions.assert_class('organization', organization, String)
444
445
  opts = HttpClient::Helper.symbolize_keys(incoming)
445
446
  query = {
446
447
  :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, Array).map { |v| HttpClient::Preconditions.assert_class('number', v, String) }),
447
448
  :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)),
448
- :destination => (x = opts.delete(:destination); x.nil? ? nil : HttpClient::Preconditions.assert_class('destination', x, String)),
449
- :from_country => (x = opts.delete(:from_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('from_country', x, String)),
449
+ :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
450
450
  :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
451
451
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
452
452
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)),
@@ -465,8 +465,7 @@ module Io
465
465
  opts = HttpClient::Helper.symbolize_keys(incoming)
466
466
  query = {
467
467
  :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)),
468
- :destination => (x = opts.delete(:destination); x.nil? ? nil : HttpClient::Preconditions.assert_class('destination', x, String)),
469
- :from_country => (x = opts.delete(:from_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('from_country', x, String)),
468
+ :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
470
469
  :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
471
470
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
472
471
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
@@ -584,12 +583,21 @@ module Io
584
583
  r.map { |x| ::Io::Flow::V0::Models::Order.new(x) }
585
584
  end
586
585
 
587
- # Create an order - the order must be booked (see bookings) before its
588
- # expiration
589
- def post(organization, order_form)
586
+ # Create an order, using the localized information from the experience
587
+ # selected by the query parameters. Note the order must be booked (see
588
+ # bookings) before its expiration
589
+ def post(organization, order_form, incoming={})
590
590
  HttpClient::Preconditions.assert_class('organization', organization, String)
591
+ opts = HttpClient::Helper.symbolize_keys(incoming)
592
+ query = {
593
+ :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)),
594
+ :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
595
+ :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
596
+ :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
597
+ :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
598
+ }.delete_if { |k, v| v.nil? }
591
599
  HttpClient::Preconditions.assert_class('order_form', order_form, ::Io::Flow::V0::Models::OrderForm)
592
- r = @client.request("/#{CGI.escape(organization)}/orders").with_json(order_form.to_json).post
600
+ r = @client.request("/#{CGI.escape(organization)}/orders").with_query(query).with_json(order_form.to_json).post
593
601
  ::Io::Flow::V0::Models::Order.new(r)
594
602
  end
595
603
 
@@ -601,6 +609,15 @@ module Io
601
609
  ::Io::Flow::V0::Models::Order.new(r)
602
610
  end
603
611
 
612
+ # Update an order.
613
+ def put_by_number(organization, number, order_put_form)
614
+ HttpClient::Preconditions.assert_class('organization', organization, String)
615
+ HttpClient::Preconditions.assert_class('number', number, String)
616
+ HttpClient::Preconditions.assert_class('order_put_form', order_put_form, ::Io::Flow::V0::Models::OrderPutForm)
617
+ r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_json(order_put_form.to_json).put
618
+ ::Io::Flow::V0::Models::Order.new(r)
619
+ end
620
+
604
621
  # Delete an order. Note that only orders that have not yet been booked may be
605
622
  # deleted.
606
623
  def delete_by_number(organization, number)
@@ -614,11 +631,11 @@ module Io
614
631
  # expired (and a new quote could not be automatically recreated for a lower or
615
632
  # same price). This method is idempotent - booking an order a second time has
616
633
  # no effect.
617
- def put_bookings_by_number(organization, number, order_booking_form)
634
+ def put_bookings_by_number(organization, number, hash)
618
635
  HttpClient::Preconditions.assert_class('organization', organization, String)
619
636
  HttpClient::Preconditions.assert_class('number', number, String)
620
- HttpClient::Preconditions.assert_class('order_booking_form', order_booking_form, ::Io::Flow::V0::Models::OrderBookingForm)
621
- r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/bookings").with_json(order_booking_form.to_json).put
637
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
638
+ r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/bookings").with_json(hash.to_json).put
622
639
  ::Io::Flow::V0::Models::OrderBooking.new(r)
623
640
  end
624
641
 
@@ -6613,7 +6630,7 @@ module Io
6613
6630
  # management (verification of who the person id), and reporting. We also
6614
6631
  # recommend including your customer.number whenever possible as doing so will
6615
6632
  # allow Flow to link up transactions for this customer making customer service
6616
- # easieer.
6633
+ # easier.
6617
6634
  class Customer
6618
6635
 
6619
6636
  attr_reader :number, :name, :phone, :email
@@ -7295,14 +7312,15 @@ module Io
7295
7312
  # region
7296
7313
  class Experience
7297
7314
 
7298
- attr_reader :id, :key, :region, :currency, :language, :measurement_system, :name, :subcatalog, :price_display
7315
+ attr_reader :id, :key, :region, :country, :currency, :language, :measurement_system, :name, :subcatalog, :price_display
7299
7316
 
7300
7317
  def initialize(incoming={})
7301
7318
  opts = HttpClient::Helper.symbolize_keys(incoming)
7302
- HttpClient::Preconditions.require_keys(opts, [:id, :key, :region, :currency, :language, :measurement_system, :name, :subcatalog, :price_display], 'Experience')
7319
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :region, :country, :currency, :language, :measurement_system, :name, :subcatalog, :price_display], 'Experience')
7303
7320
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
7304
7321
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
7305
7322
  @region = (x = opts.delete(:region); x.is_a?(::Io::Flow::V0::Models::RegionReference) ? x : ::Io::Flow::V0::Models::RegionReference.new(x))
7323
+ @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
7306
7324
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
7307
7325
  @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
7308
7326
  @measurement_system = (x = opts.delete(:measurement_system); x.is_a?(::Io::Flow::V0::Models::MeasurementSystem) ? x : ::Io::Flow::V0::Models::MeasurementSystem.apply(x))
@@ -7324,6 +7342,7 @@ module Io
7324
7342
  :id => id,
7325
7343
  :key => key,
7326
7344
  :region => region.to_hash,
7345
+ :country => country,
7327
7346
  :currency => currency,
7328
7347
  :language => language,
7329
7348
  :measurement_system => measurement_system.value,
@@ -7338,13 +7357,14 @@ module Io
7338
7357
  # Data needed to create an experience for a given geographic region
7339
7358
  class ExperienceForm
7340
7359
 
7341
- attr_reader :region_id, :name, :currency, :language, :key, :measurement_system, :subcatalog_id
7360
+ attr_reader :region_id, :name, :country, :currency, :language, :key, :measurement_system, :subcatalog_id
7342
7361
 
7343
7362
  def initialize(incoming={})
7344
7363
  opts = HttpClient::Helper.symbolize_keys(incoming)
7345
7364
  HttpClient::Preconditions.require_keys(opts, [:region_id, :name], 'ExperienceForm')
7346
7365
  @region_id = HttpClient::Preconditions.assert_class('region_id', opts.delete(:region_id), String)
7347
7366
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
7367
+ @country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
7348
7368
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
7349
7369
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
7350
7370
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
@@ -7364,6 +7384,7 @@ module Io
7364
7384
  {
7365
7385
  :region_id => region_id,
7366
7386
  :name => name,
7387
+ :country => country,
7367
7388
  :currency => currency,
7368
7389
  :language => language,
7369
7390
  :key => key,
@@ -8947,7 +8968,7 @@ module Io
8947
8968
 
8948
8969
  end
8949
8970
 
8950
- # Summary of product line item as part of the quote
8971
+ # Summary of product line item
8951
8972
  class ItemSummary
8952
8973
 
8953
8974
  attr_reader :number, :quantity
@@ -9449,35 +9470,6 @@ module Io
9449
9470
 
9450
9471
  end
9451
9472
 
9452
- # Represents an order line item
9453
- class Line
9454
-
9455
- attr_reader :number, :quantity
9456
-
9457
- def initialize(incoming={})
9458
- opts = HttpClient::Helper.symbolize_keys(incoming)
9459
- HttpClient::Preconditions.require_keys(opts, [:number, :quantity], 'Line')
9460
- @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
9461
- @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
9462
- end
9463
-
9464
- def to_json
9465
- JSON.dump(to_hash)
9466
- end
9467
-
9468
- def copy(incoming={})
9469
- Line.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
9470
- end
9471
-
9472
- def to_hash
9473
- {
9474
- :number => number,
9475
- :quantity => quantity
9476
- }
9477
- end
9478
-
9479
- end
9480
-
9481
9473
  class Local
9482
9474
 
9483
9475
  attr_reader :prices
@@ -9879,17 +9871,18 @@ module Io
9879
9871
  # then to book that order in order processing.
9880
9872
  class Order
9881
9873
 
9882
- attr_reader :id, :number, :customer, :expires_at, :destination, :deliveries, :prices, :total
9874
+ attr_reader :id, :number, :customer, :expires_at, :destination, :deliveries, :selections, :prices, :total
9883
9875
 
9884
9876
  def initialize(incoming={})
9885
9877
  opts = HttpClient::Helper.symbolize_keys(incoming)
9886
- HttpClient::Preconditions.require_keys(opts, [:id, :number, :customer, :expires_at, :destination, :deliveries, :prices, :total], 'Order')
9878
+ HttpClient::Preconditions.require_keys(opts, [:id, :number, :customer, :expires_at, :destination, :deliveries, :selections, :prices, :total], 'Order')
9887
9879
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
9888
9880
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
9889
9881
  @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
9890
9882
  @expires_at = HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expires_at)), DateTime)
9891
9883
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Location) ? x : ::Io::Flow::V0::Models::Location.new(x))
9892
9884
  @deliveries = HttpClient::Preconditions.assert_class('deliveries', opts.delete(:deliveries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Delivery) ? x : ::Io::Flow::V0::Models::Delivery.new(x)) }
9885
+ @selections = HttpClient::Preconditions.assert_class('selections', opts.delete(:selections), Array).map { |v| HttpClient::Preconditions.assert_class('selections', v, String) }
9893
9886
  @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedPrice) ? x : ::Io::Flow::V0::Models::LocalizedPrice.new(x)) }
9894
9887
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::LocalizedPrice) ? x : ::Io::Flow::V0::Models::LocalizedPrice.new(x))
9895
9888
  end
@@ -9910,6 +9903,7 @@ module Io
9910
9903
  :expires_at => expires_at,
9911
9904
  :destination => destination.to_hash,
9912
9905
  :deliveries => deliveries.map { |o| o.to_hash },
9906
+ :selections => selections,
9913
9907
  :prices => prices.map { |o| o.to_hash },
9914
9908
  :total => total.to_hash
9915
9909
  }
@@ -9918,7 +9912,7 @@ module Io
9918
9912
  end
9919
9913
 
9920
9914
  # Represents an order that has been booked. Booked orders can no longer be
9921
- # deleted as they represent transactions in the real world
9915
+ # deleted as they represent transactions in the real world.
9922
9916
  class OrderBooking
9923
9917
 
9924
9918
  attr_reader :id, :order, :created_at
@@ -9949,17 +9943,19 @@ module Io
9949
9943
 
9950
9944
  end
9951
9945
 
9952
- # Books an order. This means two things: a. all pricing in the quote will be
9953
- # guaranteed by Flow (subject to an active contract); b. you will be invoiced
9954
- # for any relevant costs.
9955
- class OrderBookingForm
9946
+ # The order form is used to create an open order, providing the details on
9947
+ # pricing and delivery options for destination and items/quantities specified
9948
+ class OrderForm
9956
9949
 
9957
- attr_reader :options
9950
+ attr_reader :number, :customer, :destination, :items
9958
9951
 
9959
9952
  def initialize(incoming={})
9960
9953
  opts = HttpClient::Helper.symbolize_keys(incoming)
9961
- HttpClient::Preconditions.require_keys(opts, [:options], 'OrderBookingForm')
9962
- @options = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| HttpClient::Preconditions.assert_class('options', v, String) }
9954
+ HttpClient::Preconditions.require_keys(opts, [:number, :customer, :destination, :items], 'OrderForm')
9955
+ @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
9956
+ @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
9957
+ @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Location) ? x : ::Io::Flow::V0::Models::Location.new(x))
9958
+ @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ItemSummary) ? x : ::Io::Flow::V0::Models::ItemSummary.new(x)) }
9963
9959
  end
9964
9960
 
9965
9961
  def to_json
@@ -9967,30 +9963,29 @@ module Io
9967
9963
  end
9968
9964
 
9969
9965
  def copy(incoming={})
9970
- OrderBookingForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
9966
+ OrderForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
9971
9967
  end
9972
9968
 
9973
9969
  def to_hash
9974
9970
  {
9975
- :options => options
9971
+ :number => number,
9972
+ :customer => customer.to_hash,
9973
+ :destination => destination.to_hash,
9974
+ :items => items.map { |o| o.to_hash }
9976
9975
  }
9977
9976
  end
9978
9977
 
9979
9978
  end
9980
9979
 
9981
- # The order form is used to create an open order, providing the details on
9982
- # pricing and delivery options for destination and items/quantities specified
9983
- class OrderForm
9980
+ # Updates the selections on an order.
9981
+ class OrderPutForm
9984
9982
 
9985
- attr_reader :number, :customer, :destination, :items
9983
+ attr_reader :options
9986
9984
 
9987
9985
  def initialize(incoming={})
9988
9986
  opts = HttpClient::Helper.symbolize_keys(incoming)
9989
- HttpClient::Preconditions.require_keys(opts, [:number, :customer, :destination, :items], 'OrderForm')
9990
- @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
9991
- @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
9992
- @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Location) ? x : ::Io::Flow::V0::Models::Location.new(x))
9993
- @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Line) ? x : ::Io::Flow::V0::Models::Line.new(x)) }
9987
+ HttpClient::Preconditions.require_keys(opts, [:options], 'OrderPutForm')
9988
+ @options = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| HttpClient::Preconditions.assert_class('options', v, String) }
9994
9989
  end
9995
9990
 
9996
9991
  def to_json
@@ -9998,15 +9993,12 @@ module Io
9998
9993
  end
9999
9994
 
10000
9995
  def copy(incoming={})
10001
- OrderForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
9996
+ OrderPutForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10002
9997
  end
10003
9998
 
10004
9999
  def to_hash
10005
10000
  {
10006
- :number => number,
10007
- :customer => customer.to_hash,
10008
- :destination => destination.to_hash,
10009
- :items => items.map { |o| o.to_hash }
10001
+ :options => options
10010
10002
  }
10011
10003
  end
10012
10004
 
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.19
4
+ version: 0.0.20
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-07-28 00:00:00.000000000 Z
11
+ date: 2016-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json