unit-ruby 0.11.0 → 0.12.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unit-ruby/recurring_credit_ach_payment.rb +40 -0
- data/lib/unit-ruby/types/date.rb +8 -1
- data/lib/unit-ruby/types/schedule.rb +45 -0
- data/lib/unit-ruby/util/connection.rb +11 -0
- data/lib/unit-ruby/util/error.rb +4 -0
- data/lib/unit-ruby/util/resource_operations.rb +8 -0
- data/lib/unit-ruby/version.rb +1 -1
- data/lib/unit-ruby.rb +2 -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: 611999a90eb76e2e38260184e44648705f496868a151479b26e723afe6c3934e
|
4
|
+
data.tar.gz: 8bb363a47f476ff15efa348e7e1319b05bc80402bfce5afe62355aac8021f0fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 380415c5203e9a65cea4b573215868ec10c5da4d3d0a517ae4d14b5adbbbb7c7b3c96896d0241f531cb8c39aa3c24cdd4f4f1dbd00606fb945d7a6ca2789a0ad
|
7
|
+
data.tar.gz: 53d601f49d7821628cdbacfa0759ddd4f74d2a9b29c15f3990da5a35c7e80bd7fd5513ad57cf7bd2c80e3dc9b19766d46d6babf268c2195f7a844facaa68ca2f
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Unit
|
2
|
+
class RecurringCreditAchPayment < APIResource
|
3
|
+
path '/recurring-payments'
|
4
|
+
|
5
|
+
attribute :idempotency_key, Types::String # Optional
|
6
|
+
attribute :tags, Types::Hash # Optional
|
7
|
+
|
8
|
+
attribute :amount, Types::Integer # Amount to transfer in cents.
|
9
|
+
attribute :description, Types::String # Description of the transfer. Max of 10 characters.
|
10
|
+
attribute :addenda, Types::String # Optional. Additional payment description. Max of 80 characters.
|
11
|
+
attribute :schedule, Types::Schedule # Schedule for the transfer.
|
12
|
+
|
13
|
+
attribute :status, Types::String, readonly: true
|
14
|
+
attribute :number_of_payments, Types::Integer, readonly: true
|
15
|
+
attribute :created_at, Types::DateTime, readonly: true
|
16
|
+
|
17
|
+
belongs_to :account, class_name: 'Unit::DepositAccount'
|
18
|
+
belongs_to :counterparty, class_name: 'Unit::AchCounterparty'
|
19
|
+
belongs_to :customer, class_name: 'Unit::IndividualCustomer'
|
20
|
+
|
21
|
+
def disable
|
22
|
+
updated_resource = self.class.connection.post(
|
23
|
+
"#{self.class.resource_path(id)}/disable"
|
24
|
+
)
|
25
|
+
update_resource_from_json_api(updated_resource)
|
26
|
+
end
|
27
|
+
|
28
|
+
def enable
|
29
|
+
updated_resource = self.class.connection.post(
|
30
|
+
"#{self.class.resource_path(id)}/enable"
|
31
|
+
)
|
32
|
+
update_resource_from_json_api(updated_resource)
|
33
|
+
end
|
34
|
+
|
35
|
+
include ResourceOperations::List
|
36
|
+
include ResourceOperations::Create
|
37
|
+
include ResourceOperations::Find
|
38
|
+
include ResourceOperations::Destroy
|
39
|
+
end
|
40
|
+
end
|
data/lib/unit-ruby/types/date.rb
CHANGED
@@ -5,8 +5,15 @@ module Unit
|
|
5
5
|
class Date
|
6
6
|
def self.cast(value)
|
7
7
|
return nil if value.nil?
|
8
|
+
return value if value.is_a?(::Date)
|
8
9
|
|
9
|
-
::Date.parse(value)
|
10
|
+
::Date.parse(value)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.as_json_api(value)
|
14
|
+
return nil if value.nil?
|
15
|
+
|
16
|
+
value.strftime('%F')
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Unit
|
2
|
+
module Types
|
3
|
+
class Schedule
|
4
|
+
attr_reader :start_time, :end_time, :interval,
|
5
|
+
:day_of_month, :day_of_week,
|
6
|
+
:total_number_of_payments, :next_scheduled_action
|
7
|
+
|
8
|
+
def initialize(schedule_params)
|
9
|
+
@start_time = schedule_params[:start_time]
|
10
|
+
@end_time = schedule_params[:end_time]
|
11
|
+
@interval = schedule_params[:interval]
|
12
|
+
@day_of_month = schedule_params[:day_of_month]
|
13
|
+
@day_of_week = schedule_params[:day_of_week]
|
14
|
+
@total_number_of_payments = schedule_params[:total_number_of_payments]
|
15
|
+
@next_scheduled_action = schedule_params[:next_scheduled_action]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.cast(val)
|
19
|
+
return val if val.is_a? self
|
20
|
+
return nil if val.nil?
|
21
|
+
|
22
|
+
new(
|
23
|
+
start_time: Unit::Types::Date.cast(val[:start_time]),
|
24
|
+
end_time: Unit::Types::Date.cast(val[:end_time]),
|
25
|
+
next_scheduled_action: Unit::Types::Date.cast(val[:next_scheduled_action]),
|
26
|
+
interval: val[:interval],
|
27
|
+
day_of_month: val[:day_of_month],
|
28
|
+
day_of_week: val[:day_of_week],
|
29
|
+
total_number_of_payments: val[:total_number_of_payments],
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def as_json_api
|
34
|
+
{
|
35
|
+
start_time: Unit::Types::Date.as_json_api(start_time),
|
36
|
+
end_time: Unit::Types::Date.as_json_api(end_time),
|
37
|
+
interval: interval,
|
38
|
+
day_of_month: day_of_month,
|
39
|
+
day_of_week: day_of_week,
|
40
|
+
total_number_of_payments: total_number_of_payments
|
41
|
+
}.compact
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -47,6 +47,17 @@ module Unit
|
|
47
47
|
from_json_api(response.body)
|
48
48
|
end
|
49
49
|
|
50
|
+
# Executes a DELETE request to the API
|
51
|
+
#
|
52
|
+
# @return boolean
|
53
|
+
def delete(path)
|
54
|
+
response = connection.delete(path)
|
55
|
+
|
56
|
+
handle_errors(response)
|
57
|
+
|
58
|
+
from_json_api(response.body)
|
59
|
+
end
|
60
|
+
|
50
61
|
# Executes a PATCH request to the API
|
51
62
|
def patch(path, data = nil)
|
52
63
|
response = connection.patch do |req|
|
data/lib/unit-ruby/util/error.rb
CHANGED
@@ -97,5 +97,13 @@ module Unit
|
|
97
97
|
replace(JSON.parse(json_attributes))
|
98
98
|
end
|
99
99
|
end
|
100
|
+
|
101
|
+
module Destroy
|
102
|
+
def destroy
|
103
|
+
updated_resource = self.class.connection.delete(self.class.resource_path(id))
|
104
|
+
|
105
|
+
update_resource_from_json_api(updated_resource)
|
106
|
+
end
|
107
|
+
end
|
100
108
|
end
|
101
109
|
end
|
data/lib/unit-ruby/version.rb
CHANGED
data/lib/unit-ruby.rb
CHANGED
@@ -22,6 +22,7 @@ require 'unit-ruby/types/full_name'
|
|
22
22
|
require 'unit-ruby/types/hash'
|
23
23
|
require 'unit-ruby/types/integer'
|
24
24
|
require 'unit-ruby/types/phone'
|
25
|
+
require 'unit-ruby/types/schedule'
|
25
26
|
require 'unit-ruby/types/string'
|
26
27
|
|
27
28
|
require 'unit-ruby/ach_payment'
|
@@ -39,6 +40,7 @@ require 'unit-ruby/institution'
|
|
39
40
|
require 'unit-ruby/customer_bank_migration'
|
40
41
|
require 'unit-ruby/outreach_settings'
|
41
42
|
require 'unit-ruby/received_payment'
|
43
|
+
require 'unit-ruby/recurring_credit_ach_payment'
|
42
44
|
require 'unit-ruby/pin_status'
|
43
45
|
require 'unit-ruby/statement'
|
44
46
|
require 'unit-ruby/transaction'
|
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.
|
4
|
+
version: 0.12.0
|
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: 2025-02-
|
12
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/unit-ruby/outreach_settings.rb
|
184
184
|
- lib/unit-ruby/pin_status.rb
|
185
185
|
- lib/unit-ruby/received_payment.rb
|
186
|
+
- lib/unit-ruby/recurring_credit_ach_payment.rb
|
186
187
|
- lib/unit-ruby/statement.rb
|
187
188
|
- lib/unit-ruby/tax_form.rb
|
188
189
|
- lib/unit-ruby/transaction.rb
|
@@ -204,6 +205,7 @@ files:
|
|
204
205
|
- lib/unit-ruby/types/hash.rb
|
205
206
|
- lib/unit-ruby/types/integer.rb
|
206
207
|
- lib/unit-ruby/types/phone.rb
|
208
|
+
- lib/unit-ruby/types/schedule.rb
|
207
209
|
- lib/unit-ruby/types/string.rb
|
208
210
|
- lib/unit-ruby/util/api_resource.rb
|
209
211
|
- lib/unit-ruby/util/connection.rb
|