flowcommerce 0.0.26 → 0.0.27

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: e98204cc3cfbdea5327930e9a5d14bc2e1296b08
4
- data.tar.gz: 068456152943b1e9ecc1271472f0f516abe1aeab
3
+ metadata.gz: f06577a69e75af48cbc81200b08e5d46159278bb
4
+ data.tar.gz: 4f908d7183721013d65ddcc8fd0c5a7aa71e6a8b
5
5
  SHA512:
6
- metadata.gz: cacfb3be1afec5231a458dc9a02517032b45cec056b5d18d0808da53465b6c557ff336a02a11069af6ed233c04d76df8cb8d372da0072196ed4a96ce7fa87dfc
7
- data.tar.gz: 670dc71ce8bd8f3e52f3e3a0903a564078761ff65f9ce9ae12b4042bad633ee17f2381b0e9bae521a9850dce81782c68cc499a2446fcf0abc6188f1b1a076eab
6
+ metadata.gz: 54b89c6e1a78ea5e4959ce11ad18c5e1e951c0ae106a8a08eb171b4c6de527f07ad94ea920a4543278beff0a7f9567941260395a354c8dd7ade9cc82a73c63f7
7
+ data.tar.gz: 0a745b8c378dd170277612c87c67ad3c5bc8fd770ec0081c4764fd57100fb9893a13a7c876797b0ddddab1dc3ab46761f33d226f2c044c2541e2472bbcea1c36
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.82
3
- # apidoc:0.11.33 http://www.apidoc.me/flow/api/0.0.82/ruby_client
2
+ # Service version: 0.0.83
3
+ # apidoc:0.11.33 http://www.apidoc.me/flow/api/0.0.83/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.33 http://www.apidoc.me/flow/api/0.0.82/ruby_client' unless defined?(Constants::USER_AGENT)
29
- VERSION = '0.0.82' unless defined?(Constants::VERSION)
28
+ USER_AGENT = 'apidoc:0.11.33 http://www.apidoc.me/flow/api/0.0.83/ruby_client' unless defined?(Constants::USER_AGENT)
29
+ VERSION = '0.0.83' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
32
32
  end
@@ -249,6 +249,10 @@ module Io
249
249
  @addresses ||= ::Io::Flow::V0::Clients::Addresses.new(self)
250
250
  end
251
251
 
252
+ def country_defaults
253
+ @country_defaults ||= ::Io::Flow::V0::Clients::CountryDefaults.new(self)
254
+ end
255
+
252
256
  def countries
253
257
  @countries ||= ::Io::Flow::V0::Clients::Countries.new(self)
254
258
  end
@@ -731,17 +735,27 @@ module Io
731
735
  ::Io::Flow::V0::Models::Order.new(r)
732
736
  end
733
737
 
734
- # Update an order.
735
- def put_by_number(organization, number, order_put_form)
738
+ # Upserts an order. using the localized information from the experience
739
+ # selected by the query parameters. Note the order must be booked (see
740
+ # bookings) before its expiration
741
+ def put_by_number(organization, number, order_put_form, incoming={})
736
742
  HttpClient::Preconditions.assert_class('organization', organization, String)
737
743
  HttpClient::Preconditions.assert_class('number', number, String)
744
+ opts = HttpClient::Helper.symbolize_keys(incoming)
745
+ query = {
746
+ :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)),
747
+ :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
748
+ :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
749
+ :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
750
+ :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
751
+ }.delete_if { |k, v| v.nil? }
738
752
  HttpClient::Preconditions.assert_class('order_put_form', order_put_form, ::Io::Flow::V0::Models::OrderPutForm)
739
- r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_json(order_put_form.to_json).put
753
+ r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_query(query).with_json(order_put_form.to_json).put
740
754
  ::Io::Flow::V0::Models::Order.new(r)
741
755
  end
742
756
 
743
- # Delete an order. Note that only orders that have not yet been booked may be
744
- # deleted.
757
+ # Delete an order. Note that production orders that have already been booked
758
+ # cannot be deleted (you will see a 422 response in these cases).
745
759
  def delete_by_number(organization, number)
746
760
  HttpClient::Preconditions.assert_class('organization', organization, String)
747
761
  HttpClient::Preconditions.assert_class('number', number, String)
@@ -3091,9 +3105,7 @@ module Io
3091
3105
  opts = HttpClient::Helper.symbolize_keys(incoming)
3092
3106
  query = {
3093
3107
  :address => (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String)),
3094
- :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
3095
- :latitude => (x = opts.delete(:latitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('latitude', x, String)),
3096
- :longitude => (x = opts.delete(:longitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('longitude', x, String))
3108
+ :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
3097
3109
  }.delete_if { |k, v| v.nil? }
3098
3110
  r = @client.request("/addresses").with_query(query).get
3099
3111
  r.map { |x| ::Io::Flow::V0::Models::Address.new(x) }
@@ -3101,6 +3113,31 @@ module Io
3101
3113
 
3102
3114
  end
3103
3115
 
3116
+ class CountryDefaults
3117
+
3118
+ def initialize(client)
3119
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
3120
+ end
3121
+
3122
+ def get(incoming={})
3123
+ opts = HttpClient::Helper.symbolize_keys(incoming)
3124
+ query = {
3125
+ :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
3126
+ :address => (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String)),
3127
+ :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
3128
+ }.delete_if { |k, v| v.nil? }
3129
+ r = @client.request("/geolocation/defaults").with_query(query).get
3130
+ r.map { |x| ::Io::Flow::V0::Models::CountryDefaults.new(x) }
3131
+ end
3132
+
3133
+ def get_by_country(country)
3134
+ HttpClient::Preconditions.assert_class('country', country, String)
3135
+ r = @client.request("/geolocation/defaults/#{CGI.escape(country)}").get
3136
+ ::Io::Flow::V0::Models::CountryDefaults.new(r)
3137
+ end
3138
+
3139
+ end
3140
+
3104
3141
  class Countries
3105
3142
 
3106
3143
  def initialize(client)
@@ -7314,6 +7351,37 @@ module Io
7314
7351
 
7315
7352
  end
7316
7353
 
7354
+ # Provides country level default settings for currency, language, etc.
7355
+ class CountryDefaults
7356
+
7357
+ attr_reader :country, :currency, :language
7358
+
7359
+ def initialize(incoming={})
7360
+ opts = HttpClient::Helper.symbolize_keys(incoming)
7361
+ HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language], 'CountryDefaults')
7362
+ @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
7363
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
7364
+ @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
7365
+ end
7366
+
7367
+ def to_json
7368
+ JSON.dump(to_hash)
7369
+ end
7370
+
7371
+ def copy(incoming={})
7372
+ CountryDefaults.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
7373
+ end
7374
+
7375
+ def to_hash
7376
+ {
7377
+ :country => country,
7378
+ :currency => currency,
7379
+ :language => language
7380
+ }
7381
+ end
7382
+
7383
+ end
7384
+
7317
7385
  # ISO 4217 3-character currency code. See
7318
7386
  # https://api.flow.io/reference/currencies
7319
7387
  class Currency
@@ -10990,15 +11058,18 @@ module Io
10990
11058
 
10991
11059
  end
10992
11060
 
10993
- # Updates the selections on an order.
11061
+ # The order put form is used to upsert an order, providing the details on
11062
+ # pricing and delivery options for destination and items/quantities specified.
10994
11063
  class OrderPutForm
10995
11064
 
10996
- attr_reader :options
11065
+ attr_reader :customer, :destination, :items
10997
11066
 
10998
11067
  def initialize(incoming={})
10999
11068
  opts = HttpClient::Helper.symbolize_keys(incoming)
11000
- HttpClient::Preconditions.require_keys(opts, [:options], 'OrderPutForm')
11001
- @options = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| HttpClient::Preconditions.assert_class('options', v, String) }
11069
+ HttpClient::Preconditions.require_keys(opts, [:customer, :destination, :items], 'OrderPutForm')
11070
+ @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
11071
+ @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
11072
+ @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)) }
11002
11073
  end
11003
11074
 
11004
11075
  def to_json
@@ -11011,7 +11082,9 @@ module Io
11011
11082
 
11012
11083
  def to_hash
11013
11084
  {
11014
- :options => options
11085
+ :customer => customer.to_hash,
11086
+ :destination => destination.to_hash,
11087
+ :items => items.map { |o| o.to_hash }
11015
11088
  }
11016
11089
  end
11017
11090
 
@@ -11043,6 +11116,33 @@ module Io
11043
11116
 
11044
11117
  end
11045
11118
 
11119
+ # Updates the selections on an order.
11120
+ class OrderSelectionsForm
11121
+
11122
+ attr_reader :selections
11123
+
11124
+ def initialize(incoming={})
11125
+ opts = HttpClient::Helper.symbolize_keys(incoming)
11126
+ HttpClient::Preconditions.require_keys(opts, [:selections], 'OrderSelectionsForm')
11127
+ @selections = HttpClient::Preconditions.assert_class('selections', opts.delete(:selections), Array).map { |v| HttpClient::Preconditions.assert_class('selections', v, String) }
11128
+ end
11129
+
11130
+ def to_json
11131
+ JSON.dump(to_hash)
11132
+ end
11133
+
11134
+ def copy(incoming={})
11135
+ OrderSelectionsForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
11136
+ end
11137
+
11138
+ def to_hash
11139
+ {
11140
+ :selections => selections
11141
+ }
11142
+ end
11143
+
11144
+ end
11145
+
11046
11146
  class OrderVersion
11047
11147
 
11048
11148
  attr_reader :id, :timestamp, :type, :order
@@ -11386,15 +11486,16 @@ module Io
11386
11486
 
11387
11487
  class OversizedShipment < RatecardFee
11388
11488
 
11389
- attr_reader :weight_threshold, :weight_unit, :percentage
11489
+ attr_reader :weight_threshold, :weight_unit, :margin, :amount
11390
11490
 
11391
11491
  def initialize(incoming={})
11392
11492
  super(:name => RatecardFee::Types::OVERSIZED_SHIPMENT)
11393
11493
  opts = HttpClient::Helper.symbolize_keys(incoming)
11394
- HttpClient::Preconditions.require_keys(opts, [:weight_threshold, :weight_unit, :percentage], 'OversizedShipment')
11494
+ HttpClient::Preconditions.require_keys(opts, [:weight_threshold, :weight_unit], 'OversizedShipment')
11395
11495
  @weight_threshold = HttpClient::Preconditions.assert_class('weight_threshold', opts.delete(:weight_threshold), Numeric)
11396
11496
  @weight_unit = (x = opts.delete(:weight_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x))
11397
- @percentage = HttpClient::Preconditions.assert_class('percentage', opts.delete(:percentage), Numeric)
11497
+ @margin = (x = opts.delete(:margin); x.nil? ? nil : HttpClient::Preconditions.assert_class('margin', x, Numeric))
11498
+ @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, Numeric))
11398
11499
  end
11399
11500
 
11400
11501
  def to_json
@@ -11409,7 +11510,8 @@ module Io
11409
11510
  {
11410
11511
  :weight_threshold => weight_threshold,
11411
11512
  :weight_unit => weight_unit.value,
11412
- :percentage => percentage
11513
+ :margin => margin,
11514
+ :amount => amount
11413
11515
  }
11414
11516
  end
11415
11517
 
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.26
4
+ version: 0.0.27
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-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json