unit-ruby 0.1.1 → 0.1.4

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: 59f7e21224f067de8f06a1a569279ce2d3a6d242f44725c10d44f9d723627a4a
4
- data.tar.gz: 58a09d8c0de08370dc789d15968893acfcfa449d0aa0d1f9acb7d2c1f0c84fce
3
+ metadata.gz: 775bc7cc6ab257a7cdb6301183720658136fc15d97a484e071f38ccaf99f53ed
4
+ data.tar.gz: d43a28ebaaafb1cb40b15c695fcdb384175b5eca6e1f5010b690fdaf345243f2
5
5
  SHA512:
6
- metadata.gz: 7bdca7d29ac184aaa4fa095bd9f5f1f4e4e027a8d889a608e4d3f11dbfd53991ab9f17f198a8a29c4f212ce17a2903015ae8183f7580c5463e7e331cd238d492
7
- data.tar.gz: '0782d46df4e8cfdf9659945939fb40fbb7e8f5d5cfc965745e88b1d2249b18e8230efcb80079e559f97670bb46341bc533b0abc4f21bac76818ba1737062a398'
6
+ metadata.gz: 83b1ec0f1f87388fe6f4381952d6c988e0022ad75be7876fd8e82298418595125ae33bcced528d16511f0b67d2f26aa499cb426a321ea4e793a9598714feff9e
7
+ data.tar.gz: 32797f1a06a231fad2e0baa50b7e303ef19cd2d912c465745274abc21583dccb1b7a61f2a911bb34f040ec26a7a032c43db1304ec5f17fdc83b37044d18a94ae
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unit-ruby (0.1.1)
4
+ unit-ruby (0.1.4)
5
5
  faraday (~> 1.8.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,13 @@
1
+ module Unit
2
+ class PinStatus < APIResource
3
+ path '/cards'
4
+
5
+ attribute :status, Types::String
6
+
7
+ def self.resource_path(id)
8
+ "#{super(id)}/secure-data/pin/status"
9
+ end
10
+
11
+ include ResourceOperations::Find
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ module Unit
2
+ class Statement < APIResource
3
+ path '/statements'
4
+
5
+ attribute :period, Types::String
6
+
7
+ def self.pdf_for(statement_id:, customer_id:)
8
+ url = base_url(statement_id, :pdf, customer_id)
9
+ statement_connection(url).get.body
10
+ end
11
+
12
+ def self.html_for(statement_id:, customer_id:)
13
+ url = base_url(statement_id, :html, customer_id)
14
+ statement_connection(url).get.body
15
+ end
16
+
17
+ def self.base_url(statement_id, response_type, customer_id)
18
+ "#{Unit::Connection.base_url}statements/#{statement_id}/#{response_type}" \
19
+ "?filter[customerId]=#{customer_id}"
20
+ end
21
+
22
+ def self.statement_connection(url)
23
+ # Establishing a new connection to avoid having to alter the existing connection to support pdf / html responses
24
+ Faraday.new(url) do |f|
25
+ f.headers['Authorization'] = "Bearer #{Unit::Connection.api_key}"
26
+ end
27
+ end
28
+
29
+ include ResourceOperations::List
30
+ end
31
+ end
@@ -79,17 +79,13 @@ module Unit
79
79
  self.class.name.split('::').last.camelize(:lower)
80
80
  end
81
81
 
82
- def resource_path
83
- "#{self.class.path}/#{id}"
84
- end
85
-
86
82
  # Creates an association to a related resource
87
83
  # This will create a helper method to traverse into a resource's related resource(s)
88
84
  def self.belongs_to(resource_name, class_name: nil)
89
85
  class_name ||= resource_name.to_s.camelize
90
86
 
91
87
  define_method(resource_name) do
92
- relationship_id = relationships[resource_name][:data]&.fetch(:id)
88
+ relationship_id = relationships.dig(resource_name, :data, :id)
93
89
 
94
90
  return nil unless relationship_id
95
91
 
@@ -1,3 +1,3 @@
1
1
  module Unit
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.4'
3
3
  end
data/lib/unit-ruby.rb CHANGED
@@ -26,6 +26,8 @@ require 'unit-ruby/individual_application'
26
26
  require 'unit-ruby/individual_customer'
27
27
  require 'unit-ruby/individual_debit_card'
28
28
  require 'unit-ruby/institution'
29
+ require 'unit-ruby/pin_status'
30
+ require 'unit-ruby/statement'
29
31
  require 'unit-ruby/transaction'
30
32
  require 'unit-ruby/version'
31
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chloe Isacke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-02-15 00:00:00.000000000 Z
12
+ date: 2022-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -111,6 +111,8 @@ files:
111
111
  - lib/unit-ruby/individual_customer.rb
112
112
  - lib/unit-ruby/individual_debit_card.rb
113
113
  - lib/unit-ruby/institution.rb
114
+ - lib/unit-ruby/pin_status.rb
115
+ - lib/unit-ruby/statement.rb
114
116
  - lib/unit-ruby/transaction.rb
115
117
  - lib/unit-ruby/types/address.rb
116
118
  - lib/unit-ruby/types/application_form_prefill.rb