gecko-ruby 0.12.0 → 0.12.1

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
  SHA256:
3
- metadata.gz: ebfbdacb19b2e0dbc4478c614578298de91e01e1ee79d29ace8833da5ef5ce4d
4
- data.tar.gz: 4d4e8551a79728045733fb7fa336a30b655e779c152ae7d0a8ec49af1c746aff
3
+ metadata.gz: c97b7ad1371972ed3a07bb3745d1d70659d408e143364ddc46ad443765fd7f1d
4
+ data.tar.gz: e88e6fd28b7b52097ba0959317f671ccd97e07a85d5bb81c9883b38922dfdad4
5
5
  SHA512:
6
- metadata.gz: 92333d13c62ab98a009c8d8a6396dcd89be342fa3d58fb152a024330f419d44d113aaa19aedbe34de10ba7a3741bb8fd54bab20ee6bb33597edee8131629f386
7
- data.tar.gz: e74fb5237da5c6a1a023517c6cc8fa76f5f45f4674362f887ccb82d7887d159aa95f3e329a6faf65fa8bcdfe359874735791db1d3d1b08362e5c2a67afee28cb
6
+ metadata.gz: 7139cb60747d866cf6e1a12ffda87c930d8282a17baab4b4e22cbc74c985532aa64bca5053465f0fc3f7f7edda278dcc72460a619f1bb6a377751e95b431f9fa
7
+ data.tar.gz: b72da9d0b232d076d6a18a5e4dc69a6ef408f71e59beea4f9f28b3627f47e2d329e1e867d2defd7dc2c7f7dada2fc7af501926fd5cfb04205149797f9ccce510
@@ -1,3 +1,6 @@
1
+ ## 0.12.1 (2020-07-20)
2
+ - Add `Gecko::Record::PaymentMethod` model.
3
+
1
4
  ## 0.12.0 (2020-07-09)
2
5
  - Silence warnings in Ruby 2.7
3
6
  - Ensure response is passed to `ActiveSupport::Notifications` on error
@@ -32,6 +32,7 @@ require 'gecko/record/user'
32
32
  require 'gecko/record/purchase_order'
33
33
  require 'gecko/record/purchase_order_line_item'
34
34
  require 'gecko/record/tax_type'
35
+ require 'gecko/record/payment_method'
35
36
  require 'gecko/record/payment_term'
36
37
  require 'gecko/record/webhook'
37
38
 
@@ -33,6 +33,7 @@ module Gecko
33
33
  record :PurchaseOrder
34
34
  record :PurchaseOrderLineItem
35
35
  record :TaxType
36
+ record :PaymentMethod
36
37
  record :PaymentTerm
37
38
  record :Webhook
38
39
 
@@ -11,6 +11,7 @@ module Gecko
11
11
  belongs_to :primary_location, class_name: "Location"
12
12
  belongs_to :primary_billing_location, class_name: "Location"
13
13
  belongs_to :default_currency, class_name: "Currency"
14
+ belongs_to :default_payment_method, class_name: "PaymentMethod"
14
15
  belongs_to :default_payment_term, class_name: "PaymentTerm"
15
16
  belongs_to :billing_contact, class_name: "User"
16
17
  belongs_to :default_sales_order_tax_type, class_name: "TaxType"
@@ -7,6 +7,7 @@ module Gecko
7
7
  class Company < Base
8
8
  belongs_to :assignee, class_name: "User"
9
9
  belongs_to :default_tax_type, class_name: "TaxType"
10
+ belongs_to :default_payment_method, class_name: "PaymentMethod"
10
11
  belongs_to :default_payment_term, class_name: "PaymentTerm"
11
12
  belongs_to :default_stock_location, class_name: "Location"
12
13
  # belongs_to :default_price_list, class_name: "PriceList"
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gecko/record/base'
4
+
5
+ module Gecko
6
+ module Record
7
+ class PaymentMethod < Base
8
+ attribute :name, String
9
+ attribute :is_default, Boolean, readonly: true
10
+ end
11
+
12
+ class PaymentMethodAdapter < BaseAdapter
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gecko
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
5
5
  end
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.lvh.me:3000/payment_methods?limit=5
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Gecko/0.12.0 OAuth2/1.4.1 Faraday/0.15.4 Ruby/2.5.7
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Bearer <__ACCESS_TOKEN__>
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Download-Options:
32
+ - noopen
33
+ X-Permitted-Cross-Domain-Policies:
34
+ - none
35
+ Referrer-Policy:
36
+ - strict-origin-when-cross-origin
37
+ X-Rate-Limit-Limit:
38
+ - '300'
39
+ X-Rate-Limit-Remaining:
40
+ - '299'
41
+ X-Rate-Limit-Reset:
42
+ - '1594871400'
43
+ Cache-Control:
44
+ - no-cache, no-store
45
+ X-Pagination:
46
+ - '{"total_records":11,"total_pages":3,"first_page":true,"last_page":false,"out_of_bounds":false,"offset":0}'
47
+ Link:
48
+ - <http://api.lvh.me:3000/ajax/payment_methods?limit=5&page=2>; rel="next",
49
+ <http://api.lvh.me:3000/ajax/payment_methods?limit=5&page=3>; rel="last"
50
+ Content-Type:
51
+ - application/json; charset=utf-8
52
+ Etag:
53
+ - W/"7462907dae56049f84e55abca4a15c5e"
54
+ X-Request-Id:
55
+ - ac553ee8-d518-404c-bd7b-215a168d164c
56
+ X-Runtime:
57
+ - '0.108324'
58
+ Connection:
59
+ - close
60
+ Server:
61
+ - thin
62
+ body:
63
+ encoding: UTF-8
64
+ string: '{"payment_methods":[{"id":32,"created_at":"2020-07-16T03:46:03.946Z","updated_at":"2020-07-16T03:46:03.946Z","name":"PayNow","is_default":false},{"id":31,"created_at":"2020-07-16T03:45:50.096Z","updated_at":"2020-07-16T03:45:50.096Z","name":"Singtel
65
+ Dash","is_default":false},{"id":30,"created_at":"2020-07-16T03:45:36.276Z","updated_at":"2020-07-16T03:45:36.276Z","name":"eNets","is_default":false},{"id":29,"created_at":"2020-07-16T03:45:21.473Z","updated_at":"2020-07-16T03:45:21.473Z","name":"Voucher","is_default":false},{"id":28,"created_at":"2020-07-16T03:45:15.160Z","updated_at":"2020-07-16T03:45:15.160Z","name":"Credit
66
+ Note","is_default":false}]}'
67
+ http_version: null
68
+ recorded_at: Thu, 16 Jul 2020 03:48:15 GMT
69
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,66 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.lvh.me:3000/payment_methods?limit=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Gecko/0.12.0 OAuth2/1.4.1 Faraday/0.15.4 Ruby/2.5.7
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Bearer <__ACCESS_TOKEN__>
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Download-Options:
32
+ - noopen
33
+ X-Permitted-Cross-Domain-Policies:
34
+ - none
35
+ Referrer-Policy:
36
+ - strict-origin-when-cross-origin
37
+ X-Rate-Limit-Limit:
38
+ - '300'
39
+ X-Rate-Limit-Remaining:
40
+ - '299'
41
+ X-Rate-Limit-Reset:
42
+ - '1594871400'
43
+ Cache-Control:
44
+ - no-cache, no-store
45
+ X-Pagination:
46
+ - '{"total_records":11,"total_pages":1,"first_page":true,"last_page":true,"out_of_bounds":false,"offset":0}'
47
+ Link:
48
+ - <http://api.lvh.me:3000/ajax/payment_methods?limit=0&page=1>; rel="last"
49
+ Content-Type:
50
+ - application/json; charset=utf-8
51
+ Etag:
52
+ - W/"98c458ef2a733afd7d9fbf88e776e5c2"
53
+ X-Request-Id:
54
+ - 89f1b27c-35d7-4b3c-a356-d87c0a1d4cc1
55
+ X-Runtime:
56
+ - '0.160860'
57
+ Connection:
58
+ - close
59
+ Server:
60
+ - thin
61
+ body:
62
+ encoding: UTF-8
63
+ string: '{"payment_methods":[]}'
64
+ http_version: null
65
+ recorded_at: Thu, 16 Jul 2020 03:48:14 GMT
66
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class Gecko::Record::PaymentMethodAdapterTest < Minitest::Test
6
+ include TestingAdapter
7
+ include SharedAdapterExamples
8
+
9
+ let(:adapter) { @client.PaymentMethod }
10
+ let(:plural_name) { "payment_methods" }
11
+ let(:record_class) { Gecko::Record::PaymentMethod }
12
+
13
+ def test_initializes_adapter
14
+ assert_instance_of(Gecko::Record::PaymentMethodAdapter, @client.PaymentMethod)
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class Gecko::PaymentMethodTest < Minitest::Test
6
+ include VCRHelper
7
+ include SharedRecordExamples
8
+
9
+ let(:plural_name) { "payment_methods" }
10
+ let(:record_class) { Gecko::Record::PaymentMethod }
11
+
12
+ def setup
13
+ @json = load_vcr_hash("payment_methods", "payment_methods").first
14
+ @record = record_class.new(client, @json)
15
+ end
16
+
17
+ def test_initializes_record
18
+ assert_instance_of(Gecko::Record::PaymentMethod, @record)
19
+ end
20
+ end
@@ -15,9 +15,19 @@ require 'support/shared_sideloaded_data_parsing_examples'
15
15
  require 'support/testing_adapter'
16
16
  require 'support/vcr_support'
17
17
 
18
+ ENV_SECRETS = %w[
19
+ OAUTH_ID
20
+ OAUTH_SECRET
21
+ ACCESS_TOKEN
22
+ REFRESH_TOKEN
23
+ ].freeze
24
+
18
25
  VCR.configure do |c|
19
26
  c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
20
27
  c.hook_into :webmock
28
+ ENV_SECRETS.each do |variable|
29
+ c.filter_sensitive_data("<__#{variable}__>") { ENV[variable] }
30
+ end
21
31
  end
22
32
 
23
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.12.0
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: 2020-07-09 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
@@ -239,6 +239,7 @@ files:
239
239
  - lib/gecko/record/note.rb
240
240
  - lib/gecko/record/order.rb
241
241
  - lib/gecko/record/order_line_item.rb
242
+ - lib/gecko/record/payment_method.rb
242
243
  - lib/gecko/record/payment_term.rb
243
244
  - lib/gecko/record/product.rb
244
245
  - lib/gecko/record/purchase_order.rb
@@ -275,6 +276,8 @@ files:
275
276
  - test/fixtures/vcr_cassettes/order_line_items_specific_count.yml
276
277
  - test/fixtures/vcr_cassettes/orders.yml
277
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
278
281
  - test/fixtures/vcr_cassettes/payment_terms.yml
279
282
  - test/fixtures/vcr_cassettes/payment_terms_count.yml
280
283
  - test/fixtures/vcr_cassettes/products.yml
@@ -325,6 +328,8 @@ files:
325
328
  - test/record/order_line_item_adapter_test.rb
326
329
  - test/record/order_line_item_test.rb
327
330
  - test/record/order_test.rb
331
+ - test/record/payment_method_adapter_test.rb
332
+ - test/record/payment_method_test.rb
328
333
  - test/record/payment_term_adapter_test.rb
329
334
  - test/record/payment_term_test.rb
330
335
  - test/record/product_adapter_test.rb
@@ -398,6 +403,8 @@ test_files:
398
403
  - test/fixtures/vcr_cassettes/order_line_items_specific_count.yml
399
404
  - test/fixtures/vcr_cassettes/orders.yml
400
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
401
408
  - test/fixtures/vcr_cassettes/payment_terms.yml
402
409
  - test/fixtures/vcr_cassettes/payment_terms_count.yml
403
410
  - test/fixtures/vcr_cassettes/products.yml
@@ -448,6 +455,8 @@ test_files:
448
455
  - test/record/order_line_item_adapter_test.rb
449
456
  - test/record/order_line_item_test.rb
450
457
  - test/record/order_test.rb
458
+ - test/record/payment_method_adapter_test.rb
459
+ - test/record/payment_method_test.rb
451
460
  - test/record/payment_term_adapter_test.rb
452
461
  - test/record/payment_term_test.rb
453
462
  - test/record/product_adapter_test.rb