unit-ruby 0.2.1 → 0.2.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 +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +1 -0
- data/lib/unit-ruby/customer_token.rb +18 -0
- data/lib/unit-ruby/customer_token_verification.rb +14 -0
- data/lib/unit-ruby/types/address.rb +19 -3
- data/lib/unit-ruby/util/api_resource.rb +3 -1
- data/lib/unit-ruby/util/connection.rb +2 -1
- data/lib/unit-ruby/util/resource_operations.rb +3 -2
- data/lib/unit-ruby/version.rb +1 -1
- data/lib/unit-ruby.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb24533446bfd10538c49ee2a9c28c6428bcc93c316d64e5278308809ab963f
|
4
|
+
data.tar.gz: f995e561b1d6c63249dac9d9270ecae0ba01bf00c955a7ba9e07a89e7c082b5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac97dd5692904c8c2fd902343ea29f7c0da8d9e12fb8d042d5671795f4d221d9f3600415412cd4f6562c294f6549615a5d158781a9addceeae2ad3e971f8dea
|
7
|
+
data.tar.gz: 7263a5879b85e666707d506f10f0b0e4ad7b0023fd3e2760163d687268b865f6713bc437e1bedba9153517687fe5a07294a370e9d6e310befc31692b815c4ef4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
unit-ruby (0.2.
|
4
|
+
unit-ruby (0.2.4)
|
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.
|
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.
|
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.
|
44
|
+
i18n (1.10.0)
|
45
45
|
concurrent-ruby (~> 1.0)
|
46
46
|
method_source (1.0.0)
|
47
|
-
minitest (5.
|
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
|
88
|
+
zeitwerk (2.5.4)
|
89
89
|
|
90
90
|
PLATFORMS
|
91
91
|
ruby
|
data/README.md
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Unit
|
2
|
+
class CustomerToken < APIResource
|
3
|
+
path '/customers'
|
4
|
+
|
5
|
+
attribute :scope, Types::String
|
6
|
+
attribute :verification_token, Types::String
|
7
|
+
attribute :verification_code, Types::String
|
8
|
+
attribute :expires_in, Types::Integer
|
9
|
+
|
10
|
+
attribute :token, Types::String, readonly: true
|
11
|
+
|
12
|
+
def self.resources_path(id)
|
13
|
+
"#{super(id)}/token"
|
14
|
+
end
|
15
|
+
|
16
|
+
include ResourceOperations::Create
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Unit
|
2
|
+
class CustomerTokenVerification < APIResource
|
3
|
+
path '/customers'
|
4
|
+
|
5
|
+
attribute :channel, Types::String
|
6
|
+
attribute :verification_token, Types::String, readonly: true
|
7
|
+
|
8
|
+
def self.resources_path(id)
|
9
|
+
"#{super(id)}/token/verification"
|
10
|
+
end
|
11
|
+
|
12
|
+
include ResourceOperations::Create
|
13
|
+
end
|
14
|
+
end
|
@@ -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(
|
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
|
-
{
|
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
|
@@ -21,7 +21,8 @@ module Unit
|
|
21
21
|
|
22
22
|
module ClassMethods
|
23
23
|
def create(attributes)
|
24
|
-
|
24
|
+
id = attributes.fetch(:id, nil)
|
25
|
+
resource = new(attributes.without(:id))
|
25
26
|
|
26
27
|
data = {
|
27
28
|
type: resource.resource_type,
|
@@ -32,7 +33,7 @@ module Unit
|
|
32
33
|
resource.relationships
|
33
34
|
end
|
34
35
|
|
35
|
-
created_resource = connection.post(resources_path, { data: data })
|
36
|
+
created_resource = connection.post(resources_path(id), { data: data })
|
36
37
|
|
37
38
|
build_resource_from_json_api(created_resource)
|
38
39
|
end
|
data/lib/unit-ruby/version.rb
CHANGED
data/lib/unit-ruby.rb
CHANGED
@@ -23,6 +23,8 @@ require 'unit-ruby/types/string'
|
|
23
23
|
require 'unit-ruby/ach_payment'
|
24
24
|
require 'unit-ruby/application_form'
|
25
25
|
require 'unit-ruby/atm_location'
|
26
|
+
require 'unit-ruby/customer_token_verification'
|
27
|
+
require 'unit-ruby/customer_token'
|
26
28
|
require 'unit-ruby/deposit_account'
|
27
29
|
require 'unit-ruby/individual_application'
|
28
30
|
require 'unit-ruby/individual_customer'
|
@@ -38,6 +40,7 @@ module Unit
|
|
38
40
|
# Unit.configure do |config|
|
39
41
|
# config.api_key = '<your api key>'
|
40
42
|
# config.base_url = 'https://api.s.unit.sh'
|
43
|
+
# config.trust_token = '<your trust token key>'
|
41
44
|
# end
|
42
45
|
def self.configure
|
43
46
|
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.
|
4
|
+
version: 0.2.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-
|
12
|
+
date: 2022-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -163,6 +163,8 @@ files:
|
|
163
163
|
- lib/unit-ruby/ach_payment.rb
|
164
164
|
- lib/unit-ruby/application_form.rb
|
165
165
|
- lib/unit-ruby/atm_location.rb
|
166
|
+
- lib/unit-ruby/customer_token.rb
|
167
|
+
- lib/unit-ruby/customer_token_verification.rb
|
166
168
|
- lib/unit-ruby/deposit_account.rb
|
167
169
|
- lib/unit-ruby/individual_application.rb
|
168
170
|
- lib/unit-ruby/individual_customer.rb
|