flowcommerce 0.0.13 → 0.0.14

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: 82faaecc51e8bbe2c684bff2467fe1406f7a676d
4
- data.tar.gz: 49c1cfb2bbcd6d741d15545f09836560a6f637fa
3
+ metadata.gz: 28fee24529abcbf10840eee6cf0e77926516faea
4
+ data.tar.gz: 950dda47161f972e510dd21174fc384d987ce754
5
5
  SHA512:
6
- metadata.gz: 522398ddc3ade9f3a8cfe0d61f7273f1d027e74cb08f90eea4981b43a4c5695a5a86a522a075cd598447c29b1c155d77c6334109bb9d7e676b44c2a8bbbbd3bf
7
- data.tar.gz: cc4d2f5c9a3289f95ea1010c780d8328095e837fa8e9d72a60035210541b8c85648506eeced90426569438db8ee5fa4ad317581e27571caf9f19ef69e6fe3b21
6
+ metadata.gz: 8a5edb94ebeb2b379ad103bc0c32e2bd6f9c6f30560addbfc655b3c673ef1e11f180cb5abdd08b2a55a22f288bf6deab76a529b7c50413450732c9c2ffc5ea05
7
+ data.tar.gz: dc336665a37396f023a95cdfe1c7bd71d6809fd87f396691b958d60edc9062c1636445e1f97a8cae624129b877358f1e1b1d232f82e5eab86c7dc9cc2b3e6f48
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.0.44
3
- # apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.44/ruby_client
2
+ # Service version: 0.0.46
3
+ # apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.46/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.44/ruby_client' unless defined?(Constants::USER_AGENT)
29
- VERSION = '0.0.44' unless defined?(Constants::VERSION)
28
+ USER_AGENT = 'apidoc:0.11.32 http://www.apidoc.me/flow/api/0.0.46/ruby_client' unless defined?(Constants::USER_AGENT)
29
+ VERSION = '0.0.46' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
32
32
  end
@@ -205,6 +205,10 @@ module Io
205
205
  @languages ||= ::Io::Flow::V0::Clients::Languages.new(self)
206
206
  end
207
207
 
208
+ def regions
209
+ @regions ||= ::Io::Flow::V0::Clients::Regions.new(self)
210
+ end
211
+
208
212
  def timezones
209
213
  @timezones ||= ::Io::Flow::V0::Clients::Timezones.new(self)
210
214
  end
@@ -2172,6 +2176,24 @@ module Io
2172
2176
 
2173
2177
  end
2174
2178
 
2179
+ class Regions
2180
+
2181
+ def initialize(client)
2182
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
2183
+ end
2184
+
2185
+ # Returns a list of regions.
2186
+ def get(incoming={})
2187
+ opts = HttpClient::Helper.symbolize_keys(incoming)
2188
+ query = {
2189
+ :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String))
2190
+ }.delete_if { |k, v| v.nil? }
2191
+ r = @client.request("/regions").with_query(query).get
2192
+ r.map { |x| ::Io::Flow::V0::Models::Region.new(x) }
2193
+ end
2194
+
2195
+ end
2196
+
2175
2197
  class Timezones
2176
2198
 
2177
2199
  def initialize(client)
@@ -3887,9 +3909,13 @@ module Io
3887
3909
  class RuleOutcome
3888
3910
 
3889
3911
  module Types
3890
- FREE_SHIPPING = 'free_shipping' unless defined?(FREE_SHIPPING)
3912
+ # Add a certain amount on the actual base cost
3913
+ AMOUNT_MARGIN = 'amount_margin' unless defined?(AMOUNT_MARGIN)
3891
3914
  AT_COST = 'at_cost' unless defined?(AT_COST)
3892
3915
  FLAT_RATE = 'flat_rate' unless defined?(FLAT_RATE)
3916
+ FREE_SHIPPING = 'free_shipping' unless defined?(FREE_SHIPPING)
3917
+ # Add a certain percentage of the actual base cost
3918
+ PERCENT_MARGIN = 'percent_margin' unless defined?(PERCENT_MARGIN)
3893
3919
  end
3894
3920
 
3895
3921
  def initialize(incoming={})
@@ -3905,9 +3931,11 @@ module Io
3905
3931
  def RuleOutcome.from_json(hash)
3906
3932
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
3907
3933
  case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
3908
- when Types::FREE_SHIPPING; FreeShipping.new(hash)
3934
+ when Types::AMOUNT_MARGIN; AmountMargin.new(hash)
3909
3935
  when Types::AT_COST; AtCost.new(hash)
3910
3936
  when Types::FLAT_RATE; FlatRate.new(hash)
3937
+ when Types::FREE_SHIPPING; FreeShipping.new(hash)
3938
+ when Types::PERCENT_MARGIN; PercentMargin.new(hash)
3911
3939
  else RuleOutcomeUndefinedType.new(:name => union_type_name)
3912
3940
  end
3913
3941
  end
@@ -5406,6 +5434,35 @@ module Io
5406
5434
 
5407
5435
  end
5408
5436
 
5437
+ # Rule outcome where shipping surfaced in quote is actual cost plus a predefined
5438
+ # margin price
5439
+ class AmountMargin < RuleOutcome
5440
+
5441
+ attr_reader :addition
5442
+
5443
+ def initialize(incoming={})
5444
+ super(:name => RuleOutcome::Types::AMOUNT_MARGIN)
5445
+ opts = HttpClient::Helper.symbolize_keys(incoming)
5446
+ HttpClient::Preconditions.require_keys(opts, [:addition], 'AmountMargin')
5447
+ @addition = (x = opts.delete(:addition); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
5448
+ end
5449
+
5450
+ def to_json
5451
+ JSON.dump(to_hash)
5452
+ end
5453
+
5454
+ def copy(incoming={})
5455
+ AmountMargin.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
5456
+ end
5457
+
5458
+ def subtype_to_hash
5459
+ {
5460
+ :addition => addition.to_hash
5461
+ }
5462
+ end
5463
+
5464
+ end
5465
+
5409
5466
  # Rule outcome where shipping surfaced in quote is actual cost of the service
5410
5467
  class AtCost < RuleOutcome
5411
5468
 
@@ -5562,7 +5619,7 @@ module Io
5562
5619
  # capture up to the amount of the authorization.
5563
5620
  class Authorization
5564
5621
 
5565
- attr_reader :id, :reference, :card, :amount, :currency, :metadata, :shipping, :details
5622
+ attr_reader :id, :reference, :card, :amount, :currency, :metadata, :shipping, :ip, :details
5566
5623
 
5567
5624
  def initialize(incoming={})
5568
5625
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -5574,6 +5631,7 @@ module Io
5574
5631
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
5575
5632
  @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 }
5576
5633
  @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Location) ? x : ::Io::Flow::V0::Models::Location.new(x)))
5634
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
5577
5635
  @details = (x = opts.delete(:details); x.is_a?(::Io::Flow::V0::Models::AuthorizationDetails) ? x : ::Io::Flow::V0::Models::AuthorizationDetails.from_json(x))
5578
5636
  end
5579
5637
 
@@ -5594,6 +5652,7 @@ module Io
5594
5652
  :currency => currency,
5595
5653
  :metadata => metadata,
5596
5654
  :shipping => shipping.nil? ? nil : shipping.to_hash,
5655
+ :ip => ip,
5597
5656
  :details => details.to_hash
5598
5657
  }
5599
5658
  end
@@ -5666,7 +5725,7 @@ module Io
5666
5725
  # capture up to the amount of the authorization.
5667
5726
  class AuthorizationForm
5668
5727
 
5669
- attr_reader :reference, :token, :amount, :currency, :cvv, :metadata, :shipping
5728
+ attr_reader :reference, :token, :amount, :currency, :cvv, :metadata, :shipping, :ip
5670
5729
 
5671
5730
  def initialize(incoming={})
5672
5731
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -5678,6 +5737,7 @@ module Io
5678
5737
  @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
5679
5738
  @metadata = (x = opts.delete(:metadata); x.nil? ? nil : HttpClient::Preconditions.assert_class('metadata', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('metadata', d[1], String); h })
5680
5739
  @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Location) ? x : ::Io::Flow::V0::Models::Location.new(x)))
5740
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
5681
5741
  end
5682
5742
 
5683
5743
  def to_json
@@ -5696,7 +5756,8 @@ module Io
5696
5756
  :currency => currency,
5697
5757
  :cvv => cvv,
5698
5758
  :metadata => metadata.nil? ? nil : metadata,
5699
- :shipping => shipping.nil? ? nil : shipping.to_hash
5759
+ :shipping => shipping.nil? ? nil : shipping.to_hash,
5760
+ :ip => ip
5700
5761
  }
5701
5762
  end
5702
5763
 
@@ -10095,6 +10156,35 @@ module Io
10095
10156
 
10096
10157
  end
10097
10158
 
10159
+ # Rule outcome where shipping surfaced in quote is actual cost plus a predefined
10160
+ # margin percentage
10161
+ class PercentMargin < RuleOutcome
10162
+
10163
+ attr_reader :percentage
10164
+
10165
+ def initialize(incoming={})
10166
+ super(:name => RuleOutcome::Types::PERCENT_MARGIN)
10167
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10168
+ HttpClient::Preconditions.require_keys(opts, [:percentage], 'PercentMargin')
10169
+ @percentage = HttpClient::Preconditions.assert_class('percentage', opts.delete(:percentage), Numeric)
10170
+ end
10171
+
10172
+ def to_json
10173
+ JSON.dump(to_hash)
10174
+ end
10175
+
10176
+ def copy(incoming={})
10177
+ PercentMargin.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10178
+ end
10179
+
10180
+ def subtype_to_hash
10181
+ {
10182
+ :percentage => percentage
10183
+ }
10184
+ end
10185
+
10186
+ end
10187
+
10098
10188
  # Presentation for UI that is used to generate a localized price function
10099
10189
  class Presets
10100
10190
 
@@ -10413,6 +10503,42 @@ module Io
10413
10503
 
10414
10504
  end
10415
10505
 
10506
+ class Region
10507
+
10508
+ attr_reader :name, :code, :countries, :currencies, :languages, :measurement_systems
10509
+
10510
+ def initialize(incoming={})
10511
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10512
+ HttpClient::Preconditions.require_keys(opts, [:name, :code, :countries, :currencies, :languages, :measurement_systems], 'Region')
10513
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
10514
+ @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
10515
+ @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
10516
+ @currencies = HttpClient::Preconditions.assert_class('currencies', opts.delete(:currencies), Array).map { |v| HttpClient::Preconditions.assert_class('currencies', v, String) }
10517
+ @languages = HttpClient::Preconditions.assert_class('languages', opts.delete(:languages), Array).map { |v| HttpClient::Preconditions.assert_class('languages', v, String) }
10518
+ @measurement_systems = HttpClient::Preconditions.assert_class('measurement_systems', opts.delete(:measurement_systems), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::MeasurementSystem) ? x : ::Io::Flow::V0::Models::MeasurementSystem.apply(x)) }
10519
+ end
10520
+
10521
+ def to_json
10522
+ JSON.dump(to_hash)
10523
+ end
10524
+
10525
+ def copy(incoming={})
10526
+ Region.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10527
+ end
10528
+
10529
+ def to_hash
10530
+ {
10531
+ :name => name,
10532
+ :code => code,
10533
+ :countries => countries,
10534
+ :currencies => currencies,
10535
+ :languages => languages,
10536
+ :measurement_systems => measurement_systems.map { |o| o.value }
10537
+ }
10538
+ end
10539
+
10540
+ end
10541
+
10416
10542
  class Rounding < Adjustment
10417
10543
 
10418
10544
  attr_reader :name, :rounding_method, :value
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.13
4
+ version: 0.0.14
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-09 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json