Class: Sydecar::Subscription
- Inherits:
-
Object
- Object
- Sydecar::Subscription
- Defined in:
- lib/sydecar/subscription.rb
Constant Summary collapse
- URL =
'/v1/subscriptions'
- CREATE_URL =
"#{URL}/create"
- FUNDING_COUNTRIES_URL =
'/v1/subscriptions/funding_countries'
Class Method Summary collapse
- .amend(id:, body:) ⇒ Object
- .amend_url(id:) ⇒ Object
- .create(body:, idempotency_key:) ⇒ Object
- .create_agreement_preview(id:) ⇒ Object
- .create_agreement_preview_url(id:) ⇒ Object
- .create_virtual_bank_account(id:, body:) ⇒ Object
- .create_virtual_bank_account_url(id:) ⇒ Object
- .delete(id:) ⇒ Object
-
.finalize(id:, body:) ⇒ Object
‘id’ [String] id of subscriber body [Hash] argument expects to have the following keys: document_signer: { “name”: [String], “title”: [String] } “name” The name of the signer.
- .find(id:) ⇒ Object
-
.find_all(params: {}, body: {}) ⇒ Object
- String
-
sort: asc / desc [Integer] limit [Integer] offset [String] start_date (format: yyyy-mm-dd) [String] end_date (format: yyyy-mm-dd) [Boolean] reveal_bank_info [String] include (example: ‘ach_transfers’).
- .funding_countries_list ⇒ Object
- .refund(id:, body:, idempotency_key:) ⇒ Object
- .refund_ach_with_plaid(id:, body:, idempotency_key:) ⇒ Object
- .refund_ach_with_plaid_url(id:) ⇒ Object
- .refund_url(id:) ⇒ Object
- .send_ach_with_plaid(id:, body:, idempotency_key:) ⇒ Object
- .send_ach_with_plaid_url(id:) ⇒ Object
- .set_balance(id:, body:) ⇒ Object
- .set_balance_url(id:) ⇒ Object
- .sign(id:, body:) ⇒ Object
- .sign_url(id:) ⇒ Object
- .update(id:, body:) ⇒ Object
- .url(id) ⇒ Object
Class Method Details
.amend(id:, body:) ⇒ Object
89 90 91 92 |
# File 'lib/sydecar/subscription.rb', line 89 def amend(id:, body:) url = amend_url(id: id) Connection.instance.post(url, body) end |
.amend_url(id:) ⇒ Object
83 84 85 |
# File 'lib/sydecar/subscription.rb', line 83 def amend_url(id:) "/v1/subscriptions/#{id}/amend" end |
.create(body:, idempotency_key:) ⇒ Object
12 13 14 |
# File 'lib/sydecar/subscription.rb', line 12 def create(body:, idempotency_key:) Connection.instance.post(CREATE_URL, body, { 'idempotency-key': idempotency_key }) end |
.create_agreement_preview(id:) ⇒ Object
42 43 44 45 |
# File 'lib/sydecar/subscription.rb', line 42 def create_agreement_preview(id:) url = create_agreement_preview_url(id: id) Connection.instance.post(url) end |
.create_agreement_preview_url(id:) ⇒ Object
37 38 39 |
# File 'lib/sydecar/subscription.rb', line 37 def create_agreement_preview_url(id:) "/v1/subscriptions/#{id}/subscription_agreement/preview?streamable_file=true" end |
.create_virtual_bank_account(id:, body:) ⇒ Object
54 55 56 57 |
# File 'lib/sydecar/subscription.rb', line 54 def create_virtual_bank_account(id:, body:) url = create_virtual_bank_account_url(id: id) Connection.instance.post(url, body) end |
.create_virtual_bank_account_url(id:) ⇒ Object
48 49 50 |
# File 'lib/sydecar/subscription.rb', line 48 def create_virtual_bank_account_url(id:) "/v1/subscriptions/#{id}/create_account" end |
.delete(id:) ⇒ Object
32 33 34 |
# File 'lib/sydecar/subscription.rb', line 32 def delete(id:) Connection.instance.delete("#{URL}/#{id}") end |
.finalize(id:, body:) ⇒ Object
‘id’ [String] id of subscriber body [Hash] argument expects to have the following keys: document_signer: { “name”: [String], “title”: [String] }
"name" The name of the signer.
"title" The title of the signer as relates to the entity it represents.
Finalize a subscription to be ready to create a bank account.
161 162 163 164 |
# File 'lib/sydecar/subscription.rb', line 161 def finalize(id:, body:) url = url id Connection.instance.post(url, body) end |
.find(id:) ⇒ Object
21 22 23 |
# File 'lib/sydecar/subscription.rb', line 21 def find(id:) Connection.instance.get("#{URL}/#{id}", { reveal_bank_info: true, include: 'ach_transfers' }) end |
.find_all(params: {}, body: {}) ⇒ Object
- String
-
sort: asc / desc
- Integer
-
limit
- Integer
-
offset
- String
-
start_date (format: yyyy-mm-dd)
- String
-
end_date (format: yyyy-mm-dd)
- Boolean
-
reveal_bank_info
- String
-
include (example: ‘ach_transfers’)
142 143 144 145 146 |
# File 'lib/sydecar/subscription.rb', line 142 def find_all(params: {}, body: {}) query = '?' query += URI.encode_www_form(params) Connection.instance.post("#{URL}#{query}", body) end |
.funding_countries_list ⇒ Object
16 17 18 |
# File 'lib/sydecar/subscription.rb', line 16 def funding_countries_list Connection.instance.get(FUNDING_COUNTRIES_URL) end |
.refund(id:, body:, idempotency_key:) ⇒ Object
128 129 130 131 |
# File 'lib/sydecar/subscription.rb', line 128 def refund(id:, body:, idempotency_key:) url = refund_url(id: id) Connection.instance.post(url, body, { 'idempotency-key': idempotency_key }) end |
.refund_ach_with_plaid(id:, body:, idempotency_key:) ⇒ Object
115 116 117 118 |
# File 'lib/sydecar/subscription.rb', line 115 def refund_ach_with_plaid(id:, body:, idempotency_key:) url = refund_ach_with_plaid_url(id: id) Connection.instance.post(url, body, { 'idempotency-key': idempotency_key }) end |
.refund_ach_with_plaid_url(id:) ⇒ Object
108 109 110 |
# File 'lib/sydecar/subscription.rb', line 108 def refund_ach_with_plaid_url(id:) "/v1/subscriptions/#{id}/refund_ach_with_plaid" end |
.refund_url(id:) ⇒ Object
121 122 123 |
# File 'lib/sydecar/subscription.rb', line 121 def refund_url(id:) "/v1/subscriptions/#{id}/refund" end |
.send_ach_with_plaid(id:, body:, idempotency_key:) ⇒ Object
102 103 104 105 |
# File 'lib/sydecar/subscription.rb', line 102 def send_ach_with_plaid(id:, body:, idempotency_key:) url = send_ach_with_plaid_url(id: id) Connection.instance.post(url, body, { 'idempotency-key': idempotency_key }) end |
.send_ach_with_plaid_url(id:) ⇒ Object
95 96 97 |
# File 'lib/sydecar/subscription.rb', line 95 def send_ach_with_plaid_url(id:) "/v1/subscriptions/#{id}/send_ach_with_plaid" end |
.set_balance(id:, body:) ⇒ Object
66 67 68 69 |
# File 'lib/sydecar/subscription.rb', line 66 def set_balance(id:, body:) url = set_balance_url(id: id) Connection.instance.post(url, body) end |
.set_balance_url(id:) ⇒ Object
60 61 62 |
# File 'lib/sydecar/subscription.rb', line 60 def set_balance_url(id:) "/v1/subscriptions/#{id}/fund" end |
.sign(id:, body:) ⇒ Object
78 79 80 81 |
# File 'lib/sydecar/subscription.rb', line 78 def sign(id:, body:) url = sign_url(id: id) Connection.instance.post(url, body) end |
.sign_url(id:) ⇒ Object
72 73 74 |
# File 'lib/sydecar/subscription.rb', line 72 def sign_url(id:) "/v1/subscriptions/#{id}/sign" end |
.update(id:, body:) ⇒ Object
27 28 29 |
# File 'lib/sydecar/subscription.rb', line 27 def update(id:, body:) Connection.instance.patch("#{URL}/#{id}", body) end |
.url(id) ⇒ Object
148 149 150 |
# File 'lib/sydecar/subscription.rb', line 148 def url(id) "#{URL}/#{id}/finalize" end |