flowcommerce 0.2.18 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72a5107c84e60eb68dd95478e53bc389f652ee8a
4
- data.tar.gz: c70fa4bde6b7e370fe4f2438f24cfe1f64514e20
3
+ metadata.gz: afc95c1997b26e43995dcb615a80a2da52d561b6
4
+ data.tar.gz: 65b268ec436733976c79b6dcea4421632dd3aa02
5
5
  SHA512:
6
- metadata.gz: 93064d8cb7d0cdc0218a63efe6fb9e570c4e28bf07d127bc7e56cf29e168efa839d08251ae3ff430a24ef3a6a07399fa11dfbe322ede4749ed73881a3fc66004
7
- data.tar.gz: a699e831f89e1444ba38d2c82bd3a3f4d3130bf7bb6fdf26a6daaac66dcc4775917c2b3b16f779ee205f0f67dd5465632c06e0fc4d7f00b00c61d084410e263b
6
+ metadata.gz: 63fd6e67c8b29f727623fbdb97f09f1e88baf87387fb4d48cad18a5bdf5e53227efe773aa0202c5bae3e3a8fa01bbe66b87f25e3a31548df8557ae6b64097784
7
+ data.tar.gz: 38c2917e4a1e35e67c09eb7e42d670f3af2fca18e6493979b8a6a0c8a38aad20e9ec9efe0791b44f8da663fe48d39112b49a568ea150cfaf48fae50173ec5276
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.3.28
3
- # apidoc:0.11.84 http://www.apidoc.me/flow/api/0.3.30/ruby_client
3
+ # apidoc:0.11.89 http://www.apidoc.me/flow/api/0.3.34/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -25,7 +25,7 @@ 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.84 http://www.apidoc.me/flow/api/0.3.30/ruby_client' unless defined?(Constants::USER_AGENT)
28
+ USER_AGENT = 'apidoc:0.11.89 http://www.apidoc.me/flow/api/0.3.34/ruby_client' unless defined?(Constants::USER_AGENT)
29
29
  VERSION = '0.3.28' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
@@ -4223,13 +4223,6 @@ module Io
4223
4223
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
4224
4224
  end
4225
4225
 
4226
- def post_shopify_by_shop(shop, session_form)
4227
- HttpClient::Preconditions.assert_class('shop', shop, String)
4228
- (x = session_form; x.is_a?(::Io::Flow::V0::Models::SessionForm) ? x : ::Io::Flow::V0::Models::SessionForm.new(x))
4229
- r = @client.request("/sessions/shopify/#{CGI.escape(shop)}").with_json(session_form.to_json).post
4230
- ::Io::Flow::V0::Models::OrganizationSession.new(r)
4231
- end
4232
-
4233
4226
  end
4234
4227
 
4235
4228
  class SessionAuthorizations
@@ -6637,7 +6630,13 @@ module Io
6637
6630
  end
6638
6631
 
6639
6632
  def AttributeIntent.ALL
6640
- @@all ||= [AttributeIntent.price]
6633
+ @@all ||= [AttributeIntent.fulfillment_method, AttributeIntent.price, AttributeIntent.taxability]
6634
+ end
6635
+
6636
+ # Attributes with this data type imply whether delivery is a package or digital
6637
+ # good.
6638
+ def AttributeIntent.fulfillment_method
6639
+ @@_fulfillment_method ||= AttributeIntent.new('fulfillment_method')
6641
6640
  end
6642
6641
 
6643
6642
  # Attributes with this data type are inferred to be prices in the organization's
@@ -6646,6 +6645,11 @@ module Io
6646
6645
  @@_price ||= AttributeIntent.new('price')
6647
6646
  end
6648
6647
 
6648
+ # Attributes with this data type imply whether taxes are applicable to an item.
6649
+ def AttributeIntent.taxability
6650
+ @@_taxability ||= AttributeIntent.new('taxability')
6651
+ end
6652
+
6649
6653
  def to_hash
6650
6654
  value
6651
6655
  end
@@ -8040,6 +8044,91 @@ module Io
8040
8044
 
8041
8045
  end
8042
8046
 
8047
+ class FulfillmentMethodType
8048
+
8049
+ attr_reader :value
8050
+
8051
+ def initialize(value)
8052
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
8053
+ end
8054
+
8055
+ # Returns the instance of FulfillmentMethodType for this value, creating a new instance for an unknown value
8056
+ def FulfillmentMethodType.apply(value)
8057
+ if value.instance_of?(FulfillmentMethodType)
8058
+ value
8059
+ else
8060
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
8061
+ value.nil? ? nil : (from_string(value) || FulfillmentMethodType.new(value))
8062
+ end
8063
+ end
8064
+
8065
+ # Returns the instance of FulfillmentMethodType for this value, or nil if not found
8066
+ def FulfillmentMethodType.from_string(value)
8067
+ HttpClient::Preconditions.assert_class('value', value, String)
8068
+ FulfillmentMethodType.ALL.find { |v| v.value == value }
8069
+ end
8070
+
8071
+ def FulfillmentMethodType.ALL
8072
+ @@all ||= [FulfillmentMethodType.fulfillment_method]
8073
+ end
8074
+
8075
+ # Indicates how an item will be shipped or fulfilled. Acceptable values are
8076
+ # defined by the 'fulfillment_method_value' enum.
8077
+ def FulfillmentMethodType.fulfillment_method
8078
+ @@_fulfillment_method ||= FulfillmentMethodType.new('fulfillment_method')
8079
+ end
8080
+
8081
+ def to_hash
8082
+ value
8083
+ end
8084
+
8085
+ end
8086
+
8087
+ class FulfillmentMethodValue
8088
+
8089
+ attr_reader :value
8090
+
8091
+ def initialize(value)
8092
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
8093
+ end
8094
+
8095
+ # Returns the instance of FulfillmentMethodValue for this value, creating a new instance for an unknown value
8096
+ def FulfillmentMethodValue.apply(value)
8097
+ if value.instance_of?(FulfillmentMethodValue)
8098
+ value
8099
+ else
8100
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
8101
+ value.nil? ? nil : (from_string(value) || FulfillmentMethodValue.new(value))
8102
+ end
8103
+ end
8104
+
8105
+ # Returns the instance of FulfillmentMethodValue for this value, or nil if not found
8106
+ def FulfillmentMethodValue.from_string(value)
8107
+ HttpClient::Preconditions.assert_class('value', value, String)
8108
+ FulfillmentMethodValue.ALL.find { |v| v.value == value }
8109
+ end
8110
+
8111
+ def FulfillmentMethodValue.ALL
8112
+ @@all ||= [FulfillmentMethodValue.digital, FulfillmentMethodValue.physical]
8113
+ end
8114
+
8115
+ # Indicates item will be fulfilled digitally and no shipment is required (e.g.
8116
+ # Gift Card).
8117
+ def FulfillmentMethodValue.digital
8118
+ @@_digital ||= FulfillmentMethodValue.new('digital')
8119
+ end
8120
+
8121
+ # Indicates item will be shipped in a phystical package.
8122
+ def FulfillmentMethodValue.physical
8123
+ @@_physical ||= FulfillmentMethodValue.new('physical')
8124
+ end
8125
+
8126
+ def to_hash
8127
+ value
8128
+ end
8129
+
8130
+ end
8131
+
8043
8132
  class GenericErrorCode
8044
8133
 
8045
8134
  attr_reader :value
@@ -8625,6 +8714,62 @@ module Io
8625
8714
 
8626
8715
  end
8627
8716
 
8717
+ class OrderPaymentType
8718
+
8719
+ attr_reader :value
8720
+
8721
+ def initialize(value)
8722
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
8723
+ end
8724
+
8725
+ # Returns the instance of OrderPaymentType for this value, creating a new instance for an unknown value
8726
+ def OrderPaymentType.apply(value)
8727
+ if value.instance_of?(OrderPaymentType)
8728
+ value
8729
+ else
8730
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
8731
+ value.nil? ? nil : (from_string(value) || OrderPaymentType.new(value))
8732
+ end
8733
+ end
8734
+
8735
+ # Returns the instance of OrderPaymentType for this value, or nil if not found
8736
+ def OrderPaymentType.from_string(value)
8737
+ HttpClient::Preconditions.assert_class('value', value, String)
8738
+ OrderPaymentType.ALL.find { |v| v.value == value }
8739
+ end
8740
+
8741
+ def OrderPaymentType.ALL
8742
+ @@all ||= [OrderPaymentType.card, OrderPaymentType.online, OrderPaymentType.credit, OrderPaymentType.cash_on_delivery]
8743
+ end
8744
+
8745
+ # Represents a payment in the form of a credit or debit card
8746
+ def OrderPaymentType.card
8747
+ @@_card ||= OrderPaymentType.new('card')
8748
+ end
8749
+
8750
+ # Represents an online payment (e.g. paypal, alipay, etc)
8751
+ def OrderPaymentType.online
8752
+ @@_online ||= OrderPaymentType.new('online')
8753
+ end
8754
+
8755
+ # A payment in the form of a credit of some type (e.g. a store credit, gift
8756
+ # card) applied to an order
8757
+ def OrderPaymentType.credit
8758
+ @@_credit ||= OrderPaymentType.new('credit')
8759
+ end
8760
+
8761
+ # Request to pay the balance with cash on delivery. Offered only when the final
8762
+ # mile carriers support cash on delivery.
8763
+ def OrderPaymentType.cash_on_delivery
8764
+ @@_cash_on_delivery ||= OrderPaymentType.new('cash_on_delivery')
8765
+ end
8766
+
8767
+ def to_hash
8768
+ value
8769
+ end
8770
+
8771
+ end
8772
+
8628
8773
  class OrderPriceDetailComponentKey
8629
8774
 
8630
8775
  attr_reader :value
@@ -10044,6 +10189,85 @@ module Io
10044
10189
 
10045
10190
  end
10046
10191
 
10192
+ class TaxabilityType
10193
+
10194
+ attr_reader :value
10195
+
10196
+ def initialize(value)
10197
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
10198
+ end
10199
+
10200
+ # Returns the instance of TaxabilityType for this value, creating a new instance for an unknown value
10201
+ def TaxabilityType.apply(value)
10202
+ if value.instance_of?(TaxabilityType)
10203
+ value
10204
+ else
10205
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
10206
+ value.nil? ? nil : (from_string(value) || TaxabilityType.new(value))
10207
+ end
10208
+ end
10209
+
10210
+ # Returns the instance of TaxabilityType for this value, or nil if not found
10211
+ def TaxabilityType.from_string(value)
10212
+ HttpClient::Preconditions.assert_class('value', value, String)
10213
+ TaxabilityType.ALL.find { |v| v.value == value }
10214
+ end
10215
+
10216
+ def TaxabilityType.ALL
10217
+ @@all ||= [TaxabilityType.tax_rule]
10218
+ end
10219
+
10220
+ # Rule indicating how taxes should be applied. Acceptable values are defined by
10221
+ # the 'taxability_value' enum.
10222
+ def TaxabilityType.tax_rule
10223
+ @@_tax_rule ||= TaxabilityType.new('tax_rule')
10224
+ end
10225
+
10226
+ def to_hash
10227
+ value
10228
+ end
10229
+
10230
+ end
10231
+
10232
+ class TaxabilityValue
10233
+
10234
+ attr_reader :value
10235
+
10236
+ def initialize(value)
10237
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
10238
+ end
10239
+
10240
+ # Returns the instance of TaxabilityValue for this value, creating a new instance for an unknown value
10241
+ def TaxabilityValue.apply(value)
10242
+ if value.instance_of?(TaxabilityValue)
10243
+ value
10244
+ else
10245
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
10246
+ value.nil? ? nil : (from_string(value) || TaxabilityValue.new(value))
10247
+ end
10248
+ end
10249
+
10250
+ # Returns the instance of TaxabilityValue for this value, or nil if not found
10251
+ def TaxabilityValue.from_string(value)
10252
+ HttpClient::Preconditions.assert_class('value', value, String)
10253
+ TaxabilityValue.ALL.find { |v| v.value == value }
10254
+ end
10255
+
10256
+ def TaxabilityValue.ALL
10257
+ @@all ||= [TaxabilityValue.exempt]
10258
+ end
10259
+
10260
+ # An item with this value is exempt from being taxed.
10261
+ def TaxabilityValue.exempt
10262
+ @@_exempt ||= TaxabilityValue.new('exempt')
10263
+ end
10264
+
10265
+ def to_hash
10266
+ value
10267
+ end
10268
+
10269
+ end
10270
+
10047
10271
  class TierDirection
10048
10272
 
10049
10273
  attr_reader :value
@@ -19208,7 +19432,7 @@ module Io
19208
19432
  # payment authorization for an order.
19209
19433
  class Order
19210
19434
 
19211
- attr_reader :id, :number, :experience, :customer, :delivered_duty, :destination, :expires_at, :items, :deliveries, :selections, :prices, :total, :attributes, :submitted_at, :lines, :identifiers, :promotions
19435
+ attr_reader :id, :number, :experience, :customer, :delivered_duty, :destination, :expires_at, :items, :deliveries, :selections, :prices, :total, :attributes, :submitted_at, :lines, :identifiers, :promotions, :payments, :balance
19212
19436
 
19213
19437
  def initialize(incoming={})
19214
19438
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -19230,6 +19454,8 @@ module Io
19230
19454
  @lines = (x = opts.delete(:lines); x.nil? ? nil : HttpClient::Preconditions.assert_class('lines', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Line) ? x : ::Io::Flow::V0::Models::Line.new(x)) })
19231
19455
  @identifiers = (x = opts.delete(:identifiers); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifiers', x, Array).map { |v| HttpClient::Preconditions.assert_class('identifiers', v, String) })
19232
19456
  @promotions = (x = opts.delete(:promotions); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Promotions) ? x : ::Io::Flow::V0::Models::Promotions.new(x)))
19457
+ @payments = (x = opts.delete(:payments); x.nil? ? nil : HttpClient::Preconditions.assert_class('payments', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPayment) ? x : ::Io::Flow::V0::Models::OrderPayment.new(x)) })
19458
+ @balance = (x = opts.delete(:balance); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalizedTotal) ? x : ::Io::Flow::V0::Models::LocalizedTotal.new(x)))
19233
19459
  end
19234
19460
 
19235
19461
  def to_json
@@ -19258,7 +19484,9 @@ module Io
19258
19484
  :submitted_at => submitted_at,
19259
19485
  :lines => lines.nil? ? nil : lines.map { |o| o.to_hash },
19260
19486
  :identifiers => identifiers.nil? ? nil : identifiers,
19261
- :promotions => promotions.nil? ? nil : promotions.to_hash
19487
+ :promotions => promotions.nil? ? nil : promotions.to_hash,
19488
+ :payments => payments.nil? ? nil : payments.map { |o| o.to_hash },
19489
+ :balance => balance.nil? ? nil : balance.to_hash
19262
19490
  }
19263
19491
  end
19264
19492
 
@@ -19708,6 +19936,42 @@ module Io
19708
19936
 
19709
19937
  end
19710
19938
 
19939
+ # An Order Payment represents an individual payment applied to an order. The
19940
+ # type of the payment can be used to further lookup transaction level detail
19941
+ class OrderPayment
19942
+
19943
+ attr_reader :id, :type, :reference, :description, :total
19944
+
19945
+ def initialize(incoming={})
19946
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19947
+ HttpClient::Preconditions.require_keys(opts, [:id, :type, :reference, :description, :total], 'OrderPayment')
19948
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
19949
+ @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::OrderPaymentType) ? x : ::Io::Flow::V0::Models::OrderPaymentType.apply(x))
19950
+ @reference = HttpClient::Preconditions.assert_class('reference', opts.delete(:reference), String)
19951
+ @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String)
19952
+ @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))
19953
+ end
19954
+
19955
+ def to_json
19956
+ JSON.dump(to_hash)
19957
+ end
19958
+
19959
+ def copy(incoming={})
19960
+ OrderPayment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19961
+ end
19962
+
19963
+ def to_hash
19964
+ {
19965
+ :id => id,
19966
+ :type => type.value,
19967
+ :reference => reference,
19968
+ :description => description,
19969
+ :total => total.to_hash
19970
+ }
19971
+ end
19972
+
19973
+ end
19974
+
19711
19975
  # Represents a top-level order price detail, e.g. 'Subtotal' or 'VAT'.
19712
19976
  class OrderPriceDetail
19713
19977
 
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.2.18
4
+ version: 0.2.19
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: 2017-05-27 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -45,7 +45,6 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - README.md
48
- - lib/flow_commerce/#client.rb#
49
48
  - lib/flow_commerce/client.rb
50
49
  - lib/flow_commerce/flow_api_v0_client.rb
51
50
  - lib/flowcommerce.rb
@@ -1,48 +0,0 @@
1
- module FlowCommerce
2
-
3
- DEFAULT_TOKEN_FILE_LOCATION = "~/.flow/token"
4
-
5
- # Creates a new instance of the flow cient, using standard
6
- # conventions to identify the API TOKEN, checking in order:
7
- #
8
- # 1. an environment variable named FLOW_TOKEN
9
- # 2. an environment variable named FLOW_TOKEN_FILE containing
10
- # the path of the file with the token in it
11
- #
12
- # @param base_url Alternate URL for the API
13
- def FlowCommerce.instance(opts={})
14
- base_url = opts[:base_url].to_s.strip
15
- token = opts[:token].to_s.strip
16
- http_handler = opts[:http_handler]
17
-
18
- if token.empty?
19
- token = ENV['FLOW_TOKEN'].to_s.strip
20
-
21
- if token.empty?
22
- file = ENV['FLOW_TOKEN_FILE'].to_s.strip
23
- if file.empty?
24
- file = DEFAULT_TOKEN_FILE_LOCATION
25
- end
26
- path = File.expand_path(file)
27
-
28
- if !File.exists?(path)
29
- raise "File %s does not exist. You can specify environment variable FLOW_TOKEN or FLOW_TOKEN_FILE to explicitly provide the token" % path
30
- end
31
-
32
- token = IO.read(path).strip
33
- if token.empty?
34
- raise "File %s did not contain an API Token" % path
35
- end
36
- end
37
- end
38
-
39
- auth = Io::Flow::V0::HttpClient::Authorization.basic(token)
40
-
41
- if base_url.empty?
42
- Io::Flow::V0::Client.at_base_url(:authorization => auth, :http_handler => http_handler)
43
- else
44
- Io::Flow::V0::Client.new(base_url, :authorization => auth, :http_handler => http_handler)
45
- end
46
- end
47
-
48
- end