ponto 1.0 → 2.0

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: 72c51c8d524e4611174a8e1cc4a4d477f824555a740b7deb230f46ebff7e15df
4
- data.tar.gz: f8970d162c5ffd3679f3d1074df2fb05709024f5150b430715efd9cbb428e96b
3
+ metadata.gz: d403bd62fb4b26e50f81df22fe97a6527c96052edeb2866ff4a19a1c88f85e46
4
+ data.tar.gz: a538f02a40d09f44bd17e62752e01c3f9810ef7f4285768c40ef25495128d10e
5
5
  SHA512:
6
- metadata.gz: 353f69bdb7f9e9de81c91535b64887563388a3c85f95036d4d7a752ba190b41cc2d139b722320546c4ce98ccbbfe053c1a333469377418e3c6451486b80ffadb
7
- data.tar.gz: 06ac1f093bcfcc6ae2e41a09f25e3996f52cdefe52193871687c2a07e7047e0c93d07f47fc48a0f3c1afb7481fde3b26587a0a6dd19c1ab2f2d84acf852ec849
6
+ metadata.gz: b5ab6723cd5248f45ba20d0ec1b683be593b16d0ff92f6720f2a60b48610c1f25aa0409931524a7d11052feff8ce2f9bc642ced6f9292af9614011c732a7ee33
7
+ data.tar.gz: 76faecf088d40bac6cf947b49d52d2bc641a4bc83f12cc40f8f0286675b744fc81f275a70f90b6d094975ad633fc5103a2455b8d86f6c5058d154d63069f50ab
@@ -0,0 +1,29 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby 2.6
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.6
18
+
19
+ - name: Publish to RubyGems
20
+ run: |
21
+ mkdir -p $HOME/.gem
22
+ touch $HOME/.gem/credentials
23
+ chmod 0600 $HOME/.gem/credentials
24
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
25
+ gem build *.gemspec
26
+ gem push *.gem
27
+ rm -rf $HOME/.gem/credentials
28
+ env:
29
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,32 @@
1
+ name: Ruby CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby-version: ['2.6', '2.7', '3.0']
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20
+ - name: Install dependencies
21
+ run: bundle install
22
+ - name: Run tests
23
+ run: bundle exec rspec
24
+ - name: Notify slack failure on master branch
25
+ if: contains(github.ref, 'master') && failure()
26
+ env:
27
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
28
+ uses: voxmedia/github-action-slack-notify-build@v1.1.2
29
+ with:
30
+ channel: ibanity-support-tech
31
+ status: FAILED
32
+ color: danger
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.travis.yml CHANGED
@@ -12,9 +12,9 @@ notifications:
12
12
  email: false
13
13
  slack:
14
14
  - rooms:
15
- - secure: Gnd8fTAuv30PF4GfUR9RVmEeJ9zyPJ+DS0LCuynDgnHZj8q3bV7TL7zGY39HNjn5C0GDhmVXy5ZbUj/VBo8wW69zrKTugqIzhu6FkVq7hOQIANkUWWqJ4bh13mX5LSS7F9klpBxMA9Q3dOPGSo1VTpJqGaCX1Jc0ffY4I2fK6IbdNAsoYV1/DQAjFAmzuqRYEmEfYO3brGvrhXHDtgfTVmNqRJIhYdstGmmIOhIC5zSgQrjXofxYtW+nZNifhW9KfknZJk2g2dwIZm271i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y9VSedYAdoMsRWGQuoeyxJYTGDd2/ErKIdOVX/dUCyA58ZQizOX1itE6pCtU6eYkXAHIMGjcbiUgptQsEiiKw4dWuMBjTTfekSaoIP3S7aPsZx86hOEj4N5ZBohXBzu+xDVetBm71L1VVKdvmzTxJwa7aM9Ty+CWOfS4klT2cGUTXcxKEVgwa+Ig2IHYF4+tOmzAx18l3L+yjO45fd8VpAvdnGzKFInvvNAYnq1R0j3BHo4dT6arxOC2Sedh3hI/8mU5OEXeTGWQgmYP4u7x9YsIRkoHwf7uZXsr2OJR6QjGV3a86rtwW9koVYN6XOwxClomK9v1mx1uLyOUDz9VLTmvCHS3bupyjkfOqC5iCNfLW2g8rNabGQAMNaychX8zLVUIom950="
19
19
  on_success: change
20
20
  on_failure: always
@@ -12,6 +12,18 @@ module Ponto
12
12
  new(raw_item["data"])
13
13
  end
14
14
 
15
+ def self.update_by_uri(uri:, resource_type:, attributes:, access_token:, meta: nil)
16
+ payload = {
17
+ data: {
18
+ type: resource_type,
19
+ attributes: attributes
20
+ }
21
+ }
22
+ payload[:data][:meta] = meta if meta
23
+ raw_item = Ponto.client.patch(uri: uri, payload: payload, access_token: access_token)
24
+ new(raw_item["data"])
25
+ end
26
+
15
27
  def self.list_by_uri(uri:, access_token:, query_params: {}, headers: nil)
16
28
  raw_response = Ponto.client.get(uri: uri, query_params: query_params, headers: headers, access_token: access_token)
17
29
  items = raw_response["data"].map do |raw_item|
@@ -28,7 +40,7 @@ module Ponto
28
40
  end
29
41
 
30
42
  def self.find_by_uri(uri:, access_token:, headers: nil)
31
- new(find_raw_by_uri(uri: uri, headers: headers, access_token: access_token))
43
+ new(find_raw_by_uri(uri: uri, headers: headers, access_token: access_token), access_token)
32
44
  end
33
45
 
34
46
  def self.find_raw_by_uri(uri:, access_token:, headers: nil)
@@ -41,12 +53,12 @@ module Ponto
41
53
  new(raw_item["data"])
42
54
  end
43
55
 
44
- def initialize(raw)
56
+ def initialize(raw, access_token = nil)
45
57
  attributes = prepare_attributes(raw)
46
58
  super(attributes)
47
59
 
48
60
  relationships = raw["relationships"] || {}
49
- setup_relationships(relationships)
61
+ setup_relationships(relationships, access_token)
50
62
 
51
63
  links = raw["links"] || {}
52
64
  setup_links(links)
@@ -75,22 +87,28 @@ module Ponto
75
87
  Ponto::Util.underscorize_hash(params)
76
88
  end
77
89
 
78
- def setup_relationships(relationships)
90
+ def setup_relationships(relationships, access_token)
79
91
  relationships.each do |key, relationship|
80
92
  if relationship["data"]
81
- klass = Ponto.const_get(Ponto::Util.camelize(key))
93
+ resource = relationship.dig("data", "type") || key
82
94
  method_name = Ponto::Util.underscore(key)
83
95
  define_singleton_method(method_name) do |headers: nil|
84
- klass.find_by_uri(uri: relationship["links"]["related"], headers: headers)
96
+ get_klass(resource).find_by_uri(uri: relationship["links"]["related"], headers: headers, access_token: access_token)
85
97
  end
86
98
  self[Ponto::Util.underscore("#{key}_id")] = relationship["data"]["id"]
99
+ elsif relationship.dig("links", "meta", "type")
100
+ resource = relationship.dig("links", "meta", "type")
101
+ method_name = Ponto::Util.underscore(key)
102
+ define_singleton_method(method_name) do |headers: nil, **query_params|
103
+ uri = relationship["links"]["related"]
104
+ get_klass(resource).list_by_uri(uri: uri, headers: headers, query_params: query_params, access_token: access_token)
105
+ end
87
106
  else
88
107
  singular_key = key[0..-2]
89
- klass = Ponto.const_get(Ponto::Util.camelize(singular_key))
90
108
  method_name = Ponto::Util.underscore(key)
91
109
  define_singleton_method(method_name) do |headers: nil, **query_params|
92
110
  uri = relationship["links"]["related"]
93
- klass.list_by_uri(uri: uri, headers: headers, query_params: query_params)
111
+ get_klass(singular_key).list_by_uri(uri: uri, headers: headers, query_params: query_params, access_token: access_token)
94
112
  end
95
113
  end
96
114
  end
@@ -101,5 +119,9 @@ module Ponto
101
119
  self[Ponto::Util.underscore("#{key}_link")] = link
102
120
  end
103
121
  end
122
+
123
+ def get_klass(key)
124
+ Ponto.const_get(Ponto::Util.camelize(key))
125
+ end
104
126
  end
105
127
  end
@@ -0,0 +1,30 @@
1
+ module Ponto
2
+ class BulkPayment < Ponto::BaseResource
3
+ def self.create(account_id:, access_token: nil, **attributes)
4
+ path = Ponto.api_schema["account"]["bulkPayments"]
5
+ .gsub("{accountId}", account_id)
6
+ .gsub("{bulkPaymentId}", "")
7
+ uri = Ponto.client.build_uri(path)
8
+ create_by_uri(
9
+ uri: uri,
10
+ resource_type: "bulkPayment",
11
+ attributes: attributes,
12
+ access_token: access_token
13
+ )
14
+ end
15
+
16
+ def self.find(id:, account_id:, access_token:)
17
+ uri = Ponto.api_schema["account"]["bulkPayments"]
18
+ .gsub("{accountId}", account_id)
19
+ .sub("{bulkPaymentId}", id)
20
+ find_by_uri(uri: uri, access_token: access_token)
21
+ end
22
+
23
+ def self.delete(id:, account_id:, access_token:)
24
+ uri = Ponto.api_schema["account"]["bulkPayments"]
25
+ .gsub("{accountId}", account_id)
26
+ .sub("{bulkPaymentId}", id)
27
+ destroy_by_uri(uri: uri, access_token: access_token)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module Ponto
2
+ module Sandbox
3
+ class FinancialInstitution < Ponto::BaseResource
4
+ def self.list(access_token:, **query_params)
5
+ uri = Ponto.api_schema["sandbox"]["financialInstitutions"].sub("{financialInstitutionId}", "")
6
+ list_by_uri(uri: uri, query_params: query_params, access_token: access_token)
7
+ end
8
+
9
+ def self.find(id:, access_token:)
10
+ uri = Ponto.api_schema["sandbox"]["financialInstitutions"].sub("{financialInstitutionId}", id)
11
+ find_by_uri(uri: uri, access_token: access_token)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Ponto
2
+ module Sandbox
3
+ class FinancialInstitutionAccount < Ponto::BaseResource
4
+ def self.list(financial_institution_id:, access_token:, **query_params)
5
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccounts"].sub("{financialInstitutionId}", financial_institution_id).sub("{financialInstitutionAccountId}", "")
6
+ list_by_uri(uri: uri, query_params: query_params, access_token: access_token)
7
+ end
8
+
9
+ def self.find(id:, financial_institution_id:, access_token:)
10
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccounts"].sub("{financialInstitutionId}", financial_institution_id).sub("{financialInstitutionAccountId}", id)
11
+ find_by_uri(uri: uri, access_token: access_token)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,37 @@
1
+ module Ponto
2
+ module Sandbox
3
+ class FinancialInstitutionTransaction < Ponto::BaseResource
4
+ def self.list(access_token:, financial_institution_id:, financial_institution_account_id:, **query_params)
5
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccount"]["financialInstitutionTransactions"]
6
+ .sub("{financialInstitutionId}", financial_institution_id)
7
+ .sub("{financialInstitutionAccountId}", financial_institution_account_id)
8
+ .sub("{financialInstitutionTransactionId}", "")
9
+ list_by_uri(uri: uri, query_params: query_params, access_token: access_token)
10
+ end
11
+
12
+ def self.find(access_token:, id:, financial_institution_id:, financial_institution_account_id:)
13
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccount"]["financialInstitutionTransactions"]
14
+ .sub("{financialInstitutionId}", financial_institution_id)
15
+ .sub("{financialInstitutionAccountId}", financial_institution_account_id)
16
+ .sub("{financialInstitutionTransactionId}", id)
17
+ find_by_uri(uri: uri, access_token: access_token)
18
+ end
19
+
20
+ def self.create(access_token:, financial_institution_id:, financial_institution_account_id:, **attributes)
21
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccount"]["financialInstitutionTransactions"]
22
+ .sub("{financialInstitutionId}", financial_institution_id)
23
+ .sub("{financialInstitutionAccountId}", financial_institution_account_id)
24
+ .sub("{financialInstitutionTransactionId}", "")
25
+ create_by_uri(uri: uri, resource_type: "financialInstitutionTransaction", attributes: attributes, access_token: access_token)
26
+ end
27
+
28
+ def self.update(access_token:, id:, financial_institution_id:, financial_institution_account_id:, **attributes)
29
+ uri = Ponto.api_schema["sandbox"]["financialInstitution"]["financialInstitutionAccount"]["financialInstitutionTransactions"]
30
+ .sub("{financialInstitutionId}", financial_institution_id)
31
+ .sub("{financialInstitutionAccountId}", financial_institution_account_id)
32
+ .sub("{financialInstitutionTransactionId}", id)
33
+ update_by_uri(uri: uri, resource_type: "financialInstitutionTransaction", attributes: attributes, access_token: access_token)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,9 +1,15 @@
1
1
  module Ponto
2
2
  class Transaction < Ponto::BaseResource
3
- def self.list(account_id:, access_token: nil, headers: nil, **query_params)
4
- uri = Ponto.api_schema["account"]["transactions"]
5
- .sub("{accountId}", account_id)
6
- .sub("{transactionId}", "")
3
+ def self.list(account_id: nil, synchronization_id: nil, access_token: nil, headers: nil, **query_params)
4
+ uri = if synchronization_id
5
+ Ponto.api_schema["synchronization"]["updatedTransactions"]
6
+ .sub("{synchronizationId}", synchronization_id)
7
+ .sub("{transactionId}", "")
8
+ else
9
+ Ponto.api_schema["account"]["transactions"]
10
+ .sub("{accountId}", account_id)
11
+ .sub("{transactionId}", "")
12
+ end
7
13
  list_by_uri(uri: uri, query_params: query_params, headers: headers, access_token: access_token)
8
14
  end
9
15
 
data/lib/ponto/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ponto
2
- VERSION = "1.0"
2
+ VERSION = "2.0"
3
3
  end
data/lib/ponto.rb CHANGED
@@ -16,14 +16,18 @@ require_relative "ponto/api/account"
16
16
  require_relative "ponto/api/transaction"
17
17
  require_relative "ponto/api/financial_institution"
18
18
  require_relative "ponto/api/payment"
19
+ require_relative "ponto/api/bulk_payment"
19
20
  require_relative "ponto/api/synchronization"
20
21
  require_relative "ponto/api/access_token"
22
+ require_relative "ponto/api/sandbox/financial_institution"
23
+ require_relative "ponto/api/sandbox/financial_institution_account"
24
+ require_relative "ponto/api/sandbox/financial_institution_transaction"
21
25
 
22
26
  module Ponto
23
27
  class << self
24
28
  def client
25
29
  options = configuration.to_h.delete_if { |_, v| v.nil? }
26
- @client ||= Ponto::Client.new(options)
30
+ @client ||= Ponto::Client.new(**options)
27
31
  end
28
32
 
29
33
  def configure
data/ponto.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "rest-client", ">= 1.8.0"
22
- spec.add_development_dependency "rspec", "3.4.0"
22
+ spec.add_development_dependency "rspec", "3.9.0"
23
23
  spec.add_development_dependency "webmock", "1.24.2"
24
24
  end
@@ -0,0 +1,32 @@
1
+ require "ponto"
2
+
3
+ class Ponto::Car < Ponto::BaseResource; end
4
+ class Ponto::Manufacturer < Ponto::BaseResource; end
5
+
6
+ RSpec.describe Ponto::BaseResource do
7
+ describe "#relationship_klass" do
8
+ context "when 'data' attribute is present" do
9
+ it "retrieves the resource name from the 'type' attribute if it is present" do
10
+ car = Ponto::Car.new(Fixture.load_json("relationships/data_with_type.json"))
11
+
12
+ expect(car).to respond_to(:maker)
13
+ expect { car.maker }.to_not raise_error(NameError)
14
+ end
15
+
16
+ it "falls back to the element name otherwise" do
17
+ car = Ponto::Car.new(Fixture.load_json("relationships/data_without_type.json"))
18
+
19
+ expect(car).to respond_to(:manufacturer)
20
+ end
21
+ end
22
+
23
+ context "when the 'links' attribute is present" do
24
+ it "retrieves the resource name from the 'type' attribute within the 'links' attribute" do
25
+ car = Ponto::Car.new(Fixture.load_json("relationships/meta_with_type.json"))
26
+
27
+ expect(car).to respond_to(:makers)
28
+ expect { car.makers }.to_not raise_error(NameError)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,103 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+
17
+ Pathname.glob(Pathname.pwd().join("spec", "support", "**/*.rb")).each do |f|
18
+ require f
19
+ end
20
+
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
46
+ # have no way to turn it off -- the option exists only for backwards
47
+ # compatibility in RSpec 3). It causes shared context metadata to be
48
+ # inherited by the metadata hash of host groups and examples, rather than
49
+ # triggering implicit auto-inclusion in groups with matching metadata.
50
+ config.shared_context_metadata_behavior = :apply_to_host_groups
51
+
52
+ # The settings below are suggested to provide a good initial experience
53
+ # with RSpec, but feel free to customize to your heart's content.
54
+ =begin
55
+ # This allows you to limit a spec run to individual examples or groups
56
+ # you care about by tagging them with `:focus` metadata. When nothing
57
+ # is tagged with `:focus`, all examples get run. RSpec also provides
58
+ # aliases for `it`, `describe`, and `context` that include `:focus`
59
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
60
+ config.filter_run_when_matching :focus
61
+
62
+ # Allows RSpec to persist some state between runs in order to support
63
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
64
+ # you configure your source control system to ignore this file.
65
+ config.example_status_persistence_file_path = "spec/examples.txt"
66
+
67
+ # Limits the available syntax to the non-monkey patched syntax that is
68
+ # recommended. For more details, see:
69
+ # https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
70
+ config.disable_monkey_patching!
71
+
72
+ # This setting enables warnings. It's recommended, but in some cases may
73
+ # be too noisy due to issues in dependencies.
74
+ config.warnings = true
75
+
76
+ # Many RSpec users commonly either run the entire suite or an individual
77
+ # file, and it's useful to allow more verbose output when running an
78
+ # individual spec file.
79
+ if config.files_to_run.one?
80
+ # Use the documentation formatter for detailed output,
81
+ # unless a formatter has already been configured
82
+ # (e.g. via a command-line flag).
83
+ config.default_formatter = "doc"
84
+ end
85
+
86
+ # Print the 10 slowest examples and example groups at the
87
+ # end of the spec run, to help surface which specs are running
88
+ # particularly slow.
89
+ config.profile_examples = 10
90
+
91
+ # Run specs in random order to surface order dependencies. If you find an
92
+ # order dependency and want to debug it, you can fix the order by providing
93
+ # the seed, which is printed after each run.
94
+ # --seed 1234
95
+ config.order = :random
96
+
97
+ # Seed global randomization in this process using the `--seed` CLI option.
98
+ # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # test failures related to randomization by passing the same `--seed` value
100
+ # as the one that triggered the failure.
101
+ Kernel.srand config.seed
102
+ =end
103
+ end
@@ -0,0 +1,8 @@
1
+ require "json"
2
+
3
+ module Fixture
4
+ def self.load_json(filename)
5
+ path = Pathname([File.dirname(__FILE__ ), "fixtures", "json", filename].join("/"))
6
+ JSON.parse(File.read(path))
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ {
2
+ "attributes": {
3
+ "color": "blue"
4
+ },
5
+ "id": "62ebd4687e",
6
+ "links": {
7
+ "self": "https://www.cardb.com/models/62ebd4687e"
8
+ },
9
+ "relationships": {
10
+ "maker": {
11
+ "data": {
12
+ "id": "c4ebf0f7",
13
+ "type": "manufacturer"
14
+ },
15
+ "links": {
16
+ "related": "https://www.cardb.com/manufacturers/c4ebf0f7"
17
+ }
18
+ }
19
+ },
20
+ "type": "car"
21
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "attributes": {
3
+ "color": "blue"
4
+ },
5
+ "id": "62ebd4687e",
6
+ "links": {
7
+ "self": "https://www.cardb.com/models/62ebd4687e"
8
+ },
9
+ "relationships": {
10
+ "manufacturer": {
11
+ "data": {
12
+ "id": "c4ebf0f7"
13
+ },
14
+ "links": {
15
+ "related": "https://www.cardb.com/manufacturers/c4ebf0f7"
16
+ }
17
+ }
18
+ },
19
+ "type": "car"
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "attributes": {
3
+ "color": "blue"
4
+ },
5
+ "id": "62ebd4687e",
6
+ "links": {
7
+ "self": "https://www.cardb.com/models/62ebd4687e"
8
+ },
9
+ "relationships": {
10
+ "makers": {
11
+ "links": {
12
+ "related": "https://www.cardb.com/manufacturers/c4ebf0f7",
13
+ "meta": {
14
+ "type": "manufacturer"
15
+ }
16
+ }
17
+ }
18
+ },
19
+ "type": "car"
20
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ponto
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ponto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.4.0
33
+ version: 3.9.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.4.0
40
+ version: 3.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webmock
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -59,8 +59,11 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/gem-push.yml"
63
+ - ".github/workflows/ruby-ci.yml"
62
64
  - ".gitignore"
63
65
  - ".gitkeep"
66
+ - ".rspec"
64
67
  - ".travis.yml"
65
68
  - Gemfile
66
69
  - LICENSE.txt
@@ -70,9 +73,13 @@ files:
70
73
  - lib/ponto/api/access_token.rb
71
74
  - lib/ponto/api/account.rb
72
75
  - lib/ponto/api/base_resource.rb
76
+ - lib/ponto/api/bulk_payment.rb
73
77
  - lib/ponto/api/financial_institution.rb
74
78
  - lib/ponto/api/o_auth_resource.rb
75
79
  - lib/ponto/api/payment.rb
80
+ - lib/ponto/api/sandbox/financial_institution.rb
81
+ - lib/ponto/api/sandbox/financial_institution_account.rb
82
+ - lib/ponto/api/sandbox/financial_institution_transaction.rb
76
83
  - lib/ponto/api/synchronization.rb
77
84
  - lib/ponto/api/transaction.rb
78
85
  - lib/ponto/client.rb
@@ -81,6 +88,12 @@ files:
81
88
  - lib/ponto/util.rb
82
89
  - lib/ponto/version.rb
83
90
  - ponto.gemspec
91
+ - spec/lib/ponto/base_resource_spec.rb
92
+ - spec/spec_helper.rb
93
+ - spec/support/fixture.rb
94
+ - spec/support/fixtures/json/relationships/data_with_type.json
95
+ - spec/support/fixtures/json/relationships/data_without_type.json
96
+ - spec/support/fixtures/json/relationships/meta_with_type.json
84
97
  homepage: https://documentation.myponto.com/api/ruby
85
98
  licenses:
86
99
  - MIT
@@ -100,8 +113,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
113
  - !ruby/object:Gem::Version
101
114
  version: '0'
102
115
  requirements: []
103
- rubygems_version: 3.0.3
116
+ rubygems_version: 3.0.3.1
104
117
  signing_key:
105
118
  specification_version: 4
106
119
  summary: Ponto Ruby Client
107
- test_files: []
120
+ test_files:
121
+ - spec/lib/ponto/base_resource_spec.rb
122
+ - spec/spec_helper.rb
123
+ - spec/support/fixture.rb
124
+ - spec/support/fixtures/json/relationships/data_with_type.json
125
+ - spec/support/fixtures/json/relationships/data_without_type.json
126
+ - spec/support/fixtures/json/relationships/meta_with_type.json