Class: Sydecar::Spv

Inherits:
Object
  • Object
show all
Defined in:
lib/sydecar/spv.rb

Constant Summary collapse

URL =
'/v1/spvs'
CREATE_URL =
"#{URL}/create"

Class Method Summary collapse

Class Method Details

.adjust_disbursements(id:, body:) ⇒ Object



127
128
129
130
# File 'lib/sydecar/spv.rb', line 127

def adjust_disbursements(id:, body:)
  url = adjust_disbursements_url(id: id)
  Connection.instance.post(url, body)
end

.adjust_disbursements_url(id:) ⇒ Object



123
124
125
# File 'lib/sydecar/spv.rb', line 123

def adjust_disbursements_url(id:)
  "/v1/spvs/#{id}/adjust_disbursements"
end

.adjust_fund_deal_investments(id:) ⇒ Object



136
137
138
139
# File 'lib/sydecar/spv.rb', line 136

def adjust_fund_deal_investments(id:)
  url = adjust_fund_deal_investments_url(id: id)
  Connection.instance.post(url)
end

.adjust_fund_deal_investments_url(id:) ⇒ Object



132
133
134
# File 'lib/sydecar/spv.rb', line 132

def adjust_fund_deal_investments_url(id:)
  "/v1/spvs/#{id}/adjust_fund_deal_investments"
end

.counter_sign_close(id:, idempotency_key:) ⇒ Object



91
92
93
94
# File 'lib/sydecar/spv.rb', line 91

def counter_sign_close(id:, idempotency_key:)
  url = counter_sign_close_url(id: id)
  Connection.instance.post(url, nil, { 'idempotency-key': idempotency_key })
end

.counter_sign_close_url(id:) ⇒ Object



87
88
89
# File 'lib/sydecar/spv.rb', line 87

def counter_sign_close_url(id:)
  "/v1/spvs/#{id}/close/counter_sign"
end

.create(body:, idempotency_key:) ⇒ Object

Parameters:

  • body (Hash)


9
10
11
# File 'lib/sydecar/spv.rb', line 9

def create(body:, idempotency_key:)
  Connection.instance.post(CREATE_URL, body, { 'idempotency-key': idempotency_key })
end

.disburse_close(id:, idempotency_key:) ⇒ Object



82
83
84
85
# File 'lib/sydecar/spv.rb', line 82

def disburse_close(id:, idempotency_key:)
  url = disburse_close_url(id: id)
  Connection.instance.post(url, nil, { 'idempotency-key': idempotency_key })
end

.disburse_close_url(id:) ⇒ Object



78
79
80
# File 'lib/sydecar/spv.rb', line 78

def disburse_close_url(id:)
  "/v1/spvs/#{id}/close/disburse"
end

.disbursements(id:) ⇒ Object



118
119
120
121
# File 'lib/sydecar/spv.rb', line 118

def disbursements(id:)
  url = disbursements_url(id: id)
  Connection.instance.get(url)
end

.disbursements_url(id:) ⇒ Object



114
115
116
# File 'lib/sydecar/spv.rb', line 114

def disbursements_url(id:)
  "/v1/spvs/#{id}/disbursements"
end

.find(id:, bank_accounts: false, capital_call_events: false, dates: false, docset: false, documents: false, expenses: false, profile: false, subscriptions: false) ⇒ Object

Parameters:

  • id (UUID)
  • bank_accounts (Boolean) (defaults to: false)
  • capital_call_events (Boolean) (defaults to: false)
  • dates (Boolean) (defaults to: false)
  • docset (Boolean) (defaults to: false)
  • documents (Boolean) (defaults to: false)
  • expenses (Boolean) (defaults to: false)
  • profile (Boolean) (defaults to: false)
  • subscriptions (Boolean) (defaults to: false)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/sydecar/spv.rb', line 22

def find(
  id:,
  bank_accounts: false,
  capital_call_events: false,
  dates: false,
  docset: false,
  documents: false,
  expenses: false,
  profile: false,
  subscriptions: false
)
  query = compile_find_params(
    bank_accounts: bank_accounts,
    capital_call_events: capital_call_events,
    dates: dates,
    docset: docset,
    documents: documents,
    expenses: expenses,
    profile: profile,
    subscriptions: subscriptions
  )

  Connection.instance.get("#{URL}/#{id}", query)
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)

Parameters:

  • params (Hash) (defaults to: {})

    argument expects to have the following keys

  • body: (Hash) (defaults to: {})

    expects to have “ids” key



60
61
62
63
64
# File 'lib/sydecar/spv.rb', line 60

def find_all(params: {}, body: {})
  query = '?'
  query += URI.encode_www_form(params)
  Connection.instance.post("#{URL}#{query}", body)
end

.initiate_close(id:, idempotency_key:) ⇒ Object

Parameters:

  • id (UUID)
  • idempotency_key (UUID)


73
74
75
76
# File 'lib/sydecar/spv.rb', line 73

def initiate_close(id:, idempotency_key:)
  url = initiate_close_url(id: id)
  Connection.instance.post(url, nil, { 'idempotency-key': idempotency_key })
end

.initiate_close_url(id:) ⇒ Object

Parameters:

  • id (UUID)


67
68
69
# File 'lib/sydecar/spv.rb', line 67

def initiate_close_url(id:)
  "/v1/spvs/#{id}/close/initiate"
end

.request_approval(id:, body:) ⇒ Object



100
101
102
103
# File 'lib/sydecar/spv.rb', line 100

def request_approval(id:, body:)
  url = request_approval_url(id: id)
  Connection.instance.post(url, body)
end

.request_approval_url(id:) ⇒ Object



96
97
98
# File 'lib/sydecar/spv.rb', line 96

def request_approval_url(id:)
  "/v1/spvs/#{id}/request_approval"
end

.request_bank_account(id:, idempotency_key:) ⇒ Object



109
110
111
112
# File 'lib/sydecar/spv.rb', line 109

def (id:, idempotency_key:)
  url = (id: id)
  Connection.instance.post(url, nil, { 'idempotency-key': idempotency_key })
end

.request_bank_account_url(id:) ⇒ Object



105
106
107
# File 'lib/sydecar/spv.rb', line 105

def (id:)
  "/v1/spvs/#{:id}/request_bank_account"
end

.update(id:, body:) ⇒ Object

Parameters:

  • id (UUID)
  • body (Hash)


49
50
51
# File 'lib/sydecar/spv.rb', line 49

def update(id:, body:)
  Connection.instance.patch("#{URL}/#{id}", body)
end