gecko-ruby 0.9.1 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.github/config/rubocop_linter_action.yml +7 -0
  3. data/.github/workflows/testing.yml +26 -0
  4. data/.rubocop.yml +23 -16
  5. data/CHANGELOG.md +18 -0
  6. data/Gemfile +2 -0
  7. data/README.md +1 -1
  8. data/Rakefile +3 -1
  9. data/gecko-ruby.gemspec +11 -10
  10. data/generate.thor +4 -1
  11. data/lib/gecko-ruby.rb +2 -0
  12. data/lib/gecko.rb +3 -0
  13. data/lib/gecko/client.rb +17 -14
  14. data/lib/gecko/ext/liquid_compat.rb +10 -10
  15. data/lib/gecko/ext/log_subscriber.rb +6 -6
  16. data/lib/gecko/helpers/association_helper.rb +14 -12
  17. data/lib/gecko/helpers/inspection_helper.rb +4 -2
  18. data/lib/gecko/helpers/record_helper.rb +2 -0
  19. data/lib/gecko/helpers/serialization_helper.rb +5 -1
  20. data/lib/gecko/helpers/validation_helper.rb +3 -1
  21. data/lib/gecko/record/account.rb +4 -1
  22. data/lib/gecko/record/address.rb +2 -0
  23. data/lib/gecko/record/base.rb +5 -3
  24. data/lib/gecko/record/base_adapter.rb +33 -22
  25. data/lib/gecko/record/company.rb +3 -0
  26. data/lib/gecko/record/contact.rb +2 -0
  27. data/lib/gecko/record/currency.rb +2 -0
  28. data/lib/gecko/record/exceptions.rb +2 -0
  29. data/lib/gecko/record/fulfillment.rb +2 -0
  30. data/lib/gecko/record/fulfillment_line_item.rb +2 -1
  31. data/lib/gecko/record/image.rb +13 -8
  32. data/lib/gecko/record/invoice.rb +7 -3
  33. data/lib/gecko/record/invoice_line_item.rb +2 -1
  34. data/lib/gecko/record/location.rb +2 -0
  35. data/lib/gecko/record/note.rb +2 -0
  36. data/lib/gecko/record/order.rb +2 -0
  37. data/lib/gecko/record/order_line_item.rb +3 -0
  38. data/lib/gecko/record/payment_method.rb +15 -0
  39. data/lib/gecko/record/payment_term.rb +2 -1
  40. data/lib/gecko/record/product.rb +4 -0
  41. data/lib/gecko/record/purchase_order.rb +2 -1
  42. data/lib/gecko/record/purchase_order_line_item.rb +2 -1
  43. data/lib/gecko/record/tax_type.rb +2 -1
  44. data/lib/gecko/record/user.rb +3 -1
  45. data/lib/gecko/record/variant.rb +9 -7
  46. data/lib/gecko/record/webhook.rb +3 -1
  47. data/lib/gecko/version.rb +3 -1
  48. data/test/client_test.rb +4 -2
  49. data/test/fixtures/vcr_cassettes/images.yml +1 -1
  50. data/test/fixtures/vcr_cassettes/payment_methods.yml +69 -0
  51. data/test/fixtures/vcr_cassettes/payment_methods_count.yml +66 -0
  52. data/test/gecko_test.rb +2 -0
  53. data/test/helpers/association_helper_test.rb +7 -5
  54. data/test/helpers/inspection_helper_test.rb +6 -4
  55. data/test/helpers/serialization_helper_test.rb +16 -14
  56. data/test/helpers/validation_helper_test.rb +3 -1
  57. data/test/record/account_adapter_test.rb +2 -0
  58. data/test/record/address_adapter_test.rb +2 -0
  59. data/test/record/address_test.rb +2 -0
  60. data/test/record/company_adapter_test.rb +2 -0
  61. data/test/record/company_test.rb +2 -0
  62. data/test/record/contact_adapter_test.rb +2 -0
  63. data/test/record/contact_test.rb +3 -1
  64. data/test/record/currency_adapter_test.rb +2 -0
  65. data/test/record/currency_test.rb +2 -0
  66. data/test/record/fulfillment_adapter_test.rb +2 -0
  67. data/test/record/fulfillment_line_item_adapter_test.rb +2 -0
  68. data/test/record/fulfillment_line_item_test.rb +2 -0
  69. data/test/record/fulfillment_test.rb +4 -2
  70. data/test/record/image_adapter_test.rb +2 -0
  71. data/test/record/image_test.rb +18 -0
  72. data/test/record/invoice_adapter_test.rb +2 -0
  73. data/test/record/invoice_line_item_adapter_test.rb +2 -0
  74. data/test/record/invoice_line_item_test.rb +2 -0
  75. data/test/record/invoice_test.rb +2 -0
  76. data/test/record/location_adapter_test.rb +2 -0
  77. data/test/record/location_test.rb +2 -0
  78. data/test/record/note_test.rb +2 -0
  79. data/test/record/order_adapter_test.rb +2 -0
  80. data/test/record/order_line_item_adapter_test.rb +2 -0
  81. data/test/record/order_line_item_test.rb +2 -0
  82. data/test/record/order_test.rb +2 -0
  83. data/test/record/payment_method_adapter_test.rb +16 -0
  84. data/test/record/payment_method_test.rb +20 -0
  85. data/test/record/payment_term_adapter_test.rb +2 -0
  86. data/test/record/payment_term_test.rb +2 -0
  87. data/test/record/product_adapter_test.rb +2 -0
  88. data/test/record/product_test.rb +2 -0
  89. data/test/record/purchase_order_adapter_test.rb +2 -0
  90. data/test/record/purchase_order_line_item_adapter_test.rb +2 -0
  91. data/test/record/purchase_order_line_item_test.rb +2 -0
  92. data/test/record/purchase_order_test.rb +2 -0
  93. data/test/record/tax_type_adapter_test.rb +2 -0
  94. data/test/record/tax_type_test.rb +2 -0
  95. data/test/record/user_adapter_test.rb +2 -0
  96. data/test/record/user_test.rb +2 -0
  97. data/test/record/variant_adapter_test.rb +2 -0
  98. data/test/record/variant_test.rb +6 -4
  99. data/test/record/webhook_test.rb +2 -0
  100. data/test/support/let.rb +2 -0
  101. data/test/support/shared_adapter_examples.rb +35 -31
  102. data/test/support/shared_record_examples.rb +3 -1
  103. data/test/support/shared_sideloaded_data_parsing_examples.rb +2 -1
  104. data/test/support/testing_adapter.rb +2 -0
  105. data/test/support/vcr_support.rb +2 -0
  106. data/test/test_helper.rb +12 -0
  107. metadata +33 -23
  108. data/.travis.yml +0 -8
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SharedRecordExamples
2
4
  def test_sets_up_id
3
- assert_instance_of(Fixnum, @record.id)
5
+ assert_instance_of(Integer, @record.id)
4
6
  assert_equal(@json['id'], @record.id)
5
7
  end
6
8
 
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SharedSideloadedDataParsingExamples
2
4
  def test_adapter_sideloaded_data_parsing
3
5
  VCR.use_cassette(plural_name + '_sideloaded') do
4
-
5
6
  collection = adapter.where(limit: 5, _include: children.join(","))
6
7
 
7
8
  children.each do |child|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TestingAdapter
2
4
  require 'dotenv'
3
5
  def setup
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VCRHelper
2
4
  def load_vcr_hash(fixture, key)
3
5
  yaml = YAML.load_file(VCR.configuration.cassette_library_dir + "/#{fixture}.yml")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gecko'
2
4
  require 'minitest/autorun'
3
5
  require 'minitest/pride'
@@ -13,9 +15,19 @@ require 'support/shared_sideloaded_data_parsing_examples'
13
15
  require 'support/testing_adapter'
14
16
  require 'support/vcr_support'
15
17
 
18
+ ENV_SECRETS = %w[
19
+ OAUTH_ID
20
+ OAUTH_SECRET
21
+ ACCESS_TOKEN
22
+ REFRESH_TOKEN
23
+ ].freeze
24
+
16
25
  VCR.configure do |c|
17
26
  c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
18
27
  c.hook_into :webmock
28
+ ENV_SECRETS.each do |variable|
29
+ c.filter_sensitive_data("<__#{variable}__>") { ENV[variable] }
30
+ end
19
31
  end
20
32
 
21
33
  class Minitest::Test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gecko-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Priest
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: vcr
56
+ name: mocha
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: webmock
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: mocha
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: timecop
98
+ name: thor
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: dotenv
112
+ name: timecop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: thor
126
+ name: vcr
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: pry
140
+ name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,35 +151,35 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: oauth2
154
+ name: activesupport
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 1.1.0
159
+ version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 1.1.0
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: virtus
168
+ name: oauth2
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - ">"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: 1.1.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - ">"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: 1.1.0
181
181
  - !ruby/object:Gem::Dependency
182
- name: activesupport
182
+ name: virtus
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -199,10 +199,11 @@ executables: []
199
199
  extensions: []
200
200
  extra_rdoc_files: []
201
201
  files:
202
+ - ".github/config/rubocop_linter_action.yml"
203
+ - ".github/workflows/testing.yml"
202
204
  - ".gitignore"
203
205
  - ".hound.yml"
204
206
  - ".rubocop.yml"
205
- - ".travis.yml"
206
207
  - CHANGELOG.md
207
208
  - CONTRIBUTING.md
208
209
  - Gemfile
@@ -238,6 +239,7 @@ files:
238
239
  - lib/gecko/record/note.rb
239
240
  - lib/gecko/record/order.rb
240
241
  - lib/gecko/record/order_line_item.rb
242
+ - lib/gecko/record/payment_method.rb
241
243
  - lib/gecko/record/payment_term.rb
242
244
  - lib/gecko/record/product.rb
243
245
  - lib/gecko/record/purchase_order.rb
@@ -274,6 +276,8 @@ files:
274
276
  - test/fixtures/vcr_cassettes/order_line_items_specific_count.yml
275
277
  - test/fixtures/vcr_cassettes/orders.yml
276
278
  - test/fixtures/vcr_cassettes/orders_count.yml
279
+ - test/fixtures/vcr_cassettes/payment_methods.yml
280
+ - test/fixtures/vcr_cassettes/payment_methods_count.yml
277
281
  - test/fixtures/vcr_cassettes/payment_terms.yml
278
282
  - test/fixtures/vcr_cassettes/payment_terms_count.yml
279
283
  - test/fixtures/vcr_cassettes/products.yml
@@ -324,6 +328,8 @@ files:
324
328
  - test/record/order_line_item_adapter_test.rb
325
329
  - test/record/order_line_item_test.rb
326
330
  - test/record/order_test.rb
331
+ - test/record/payment_method_adapter_test.rb
332
+ - test/record/payment_method_test.rb
327
333
  - test/record/payment_term_adapter_test.rb
328
334
  - test/record/payment_term_test.rb
329
335
  - test/record/product_adapter_test.rb
@@ -365,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
371
  - !ruby/object:Gem::Version
366
372
  version: '0'
367
373
  requirements: []
368
- rubygems_version: 3.0.4
374
+ rubygems_version: 3.1.2
369
375
  signing_key:
370
376
  specification_version: 4
371
377
  summary: A Ruby interface to the TradeGecko API.
@@ -397,6 +403,8 @@ test_files:
397
403
  - test/fixtures/vcr_cassettes/order_line_items_specific_count.yml
398
404
  - test/fixtures/vcr_cassettes/orders.yml
399
405
  - test/fixtures/vcr_cassettes/orders_count.yml
406
+ - test/fixtures/vcr_cassettes/payment_methods.yml
407
+ - test/fixtures/vcr_cassettes/payment_methods_count.yml
400
408
  - test/fixtures/vcr_cassettes/payment_terms.yml
401
409
  - test/fixtures/vcr_cassettes/payment_terms_count.yml
402
410
  - test/fixtures/vcr_cassettes/products.yml
@@ -447,6 +455,8 @@ test_files:
447
455
  - test/record/order_line_item_adapter_test.rb
448
456
  - test/record/order_line_item_test.rb
449
457
  - test/record/order_test.rb
458
+ - test/record/payment_method_adapter_test.rb
459
+ - test/record/payment_method_test.rb
450
460
  - test/record/payment_term_adapter_test.rb
451
461
  - test/record/payment_term_test.rb
452
462
  - test/record/product_adapter_test.rb
@@ -1,8 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem install bundler
4
- rvm:
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
- - ruby-head