unit-ruby 0.2.0 → 0.2.3

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: 757733c93a8d4c1e620bb1ecd5593207572173fda4a27c366350a6dc8fc6507f
4
- data.tar.gz: 4b56794d11b4706cc08b997be2cda10132e67cd70125c592be16f93e00d0a727
3
+ metadata.gz: a6cb6013957f5fb86b11a7112b26b4d012c5cba20a35d214667be9f4cc352057
4
+ data.tar.gz: 299368d998697e2522f914cc68adf61bae766231dc2c5ce3b3b273d8765e87ad
5
5
  SHA512:
6
- metadata.gz: dee301d80de736e5864ff137c3374bbce1250e7946dc2f3d2433aee89006976abc2e8bd310c31a4466fb92de3cc8f2631304172916634f3cfdcdad66979f5b05
7
- data.tar.gz: cd7479a13fbc53233335ef99222a2e2a2587f1a8fa7cbdb8856606fab1d4e79093511cc925f799a50a0c49fc1cddda10c107e3055eefa254ea9c1090e016f82f
6
+ metadata.gz: 965abcbb2f9fd0f214b50560f06d73b70e9e1e50be2a74d9d90de62a391136cd7501c6fcb04290181048b3683e55e0062a60dc43f16d857d8b8ece2f0de3f748
7
+ data.tar.gz: 377c38ccff1bcbc1f5065057960ed518832037e89aba038f5d9fd73f54451594290750fdc800e11458666a1d1aa41526b777e0b4a86be9ed0dfd7f34bcd6bb8d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unit-ruby (0.2.0)
4
+ unit-ruby (0.2.3)
5
5
  activesupport
6
6
  faraday (~> 1.8.0)
7
7
  faraday_middleware (~> 1.0.0)
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.1.4.1)
12
+ activesupport (6.1.5)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 1.6, < 2)
15
15
  minitest (>= 5.1)
@@ -17,7 +17,7 @@ GEM
17
17
  zeitwerk (~> 2.3)
18
18
  ast (2.4.2)
19
19
  coderay (1.1.3)
20
- concurrent-ruby (1.1.9)
20
+ concurrent-ruby (1.1.10)
21
21
  diff-lcs (1.5.0)
22
22
  dotenv (2.7.6)
23
23
  faraday (1.8.0)
@@ -41,10 +41,10 @@ GEM
41
41
  faraday-rack (1.0.0)
42
42
  faraday_middleware (1.0.0)
43
43
  faraday (~> 1.0)
44
- i18n (1.8.10)
44
+ i18n (1.10.0)
45
45
  concurrent-ruby (~> 1.0)
46
46
  method_source (1.0.0)
47
- minitest (5.14.4)
47
+ minitest (5.15.0)
48
48
  multipart-post (2.1.1)
49
49
  parallel (1.21.0)
50
50
  parser (3.1.0.0)
@@ -85,7 +85,7 @@ GEM
85
85
  tzinfo (2.0.4)
86
86
  concurrent-ruby (~> 1.0)
87
87
  unicode-display_width (2.1.0)
88
- zeitwerk (2.4.2)
88
+ zeitwerk (2.5.4)
89
89
 
90
90
  PLATFORMS
91
91
  ruby
data/README.md CHANGED
@@ -28,6 +28,7 @@ require 'unit-ruby'
28
28
  Unit.configure do |config|
29
29
  config.api_key = ENV['UNIT_API_KEY']
30
30
  config.base_url = ENV['UNIT_BASE_URL']
31
+ config.trust_token = ENV['UNIT_TRUST_TOKEN] # optional
31
32
  end
32
33
 
33
34
  ```
@@ -12,6 +12,7 @@ module Unit
12
12
  attribute :verify_counterparty_balance, Types::Hash # Optional
13
13
 
14
14
  attribute :status, Types::String, readonly: true
15
+ attribute :reason, Types::String, readonly: true
15
16
  attribute :settlement_date, Types::DateTime, readonly: true
16
17
  attribute :created_at, Types::DateTime, readonly: true
17
18
 
@@ -1,10 +1,18 @@
1
1
  module Unit
2
2
  module Types
3
3
  class Address
4
- attr_reader :street, :city, :state, :postal_code, :country
4
+ attr_reader :street, :street2, :city, :state, :postal_code, :country
5
5
 
6
- def initialize(street:, city:, state:, postal_code:, country:)
6
+ def initialize(
7
+ street:,
8
+ city:,
9
+ state:,
10
+ postal_code:,
11
+ country:,
12
+ street2: nil
13
+ )
7
14
  @street = street
15
+ @street2 = street2
8
16
  @city = city
9
17
  @state = state
10
18
  @postal_code = postal_code
@@ -17,6 +25,7 @@ module Unit
17
25
 
18
26
  new(
19
27
  street: val[:street],
28
+ street2: val[:street2],
20
29
  city: val[:city],
21
30
  state: val[:state],
22
31
  postal_code: val[:postal_code],
@@ -25,7 +34,14 @@ module Unit
25
34
  end
26
35
 
27
36
  def as_json_api
28
- { street: street, city: city, state: state, postal_code: postal_code, country: country }
37
+ {
38
+ street: street,
39
+ street2: street2,
40
+ city: city,
41
+ state: state,
42
+ postal_code: postal_code,
43
+ country: country
44
+ }.compact
29
45
  end
30
46
  end
31
47
  end
@@ -5,13 +5,14 @@ require 'active_support/core_ext/hash'
5
5
  module Unit
6
6
  class Connection
7
7
  class << self
8
- attr_accessor :api_key, :base_url
8
+ attr_accessor :api_key, :base_url, :trust_token
9
9
  end
10
10
 
11
11
  attr_reader :connection
12
12
 
13
13
  def initialize
14
14
  @connection = Faraday.new(self.class.base_url) do |f|
15
+ f.headers['UNIT_TRUST_TOKEN'] = self.class.trust_token if self.class.trust_token
15
16
  f.headers['Authorization'] = "Bearer #{self.class.api_key}"
16
17
  f.request :json # encode req bodies as JSON
17
18
  f.request :retry # retry transient failures
@@ -1,3 +1,3 @@
1
1
  module Unit
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.3'
3
3
  end
data/lib/unit-ruby.rb CHANGED
@@ -38,6 +38,7 @@ module Unit
38
38
  # Unit.configure do |config|
39
39
  # config.api_key = '<your api key>'
40
40
  # config.base_url = 'https://api.s.unit.sh'
41
+ # config.trust_token = '<your trust token key>'
41
42
  # end
42
43
  def self.configure
43
44
  yield(Connection)
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.2.0
4
+ version: 0.2.3
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-03-15 00:00:00.000000000 Z
12
+ date: 2022-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport