Class: Sydecar::CapitalCall

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

Constant Summary collapse

CAPITAL_CALL_EVENTS_URL =
'v1/capital_call_events'

Class Method Summary collapse

Class Method Details

.create_spv_capital_call(body:, idempotency_key:) ⇒ Hash

This method create an SPV capital call event }

- Create one or more capital call events. A valid SPV id is needed.

} More detail see on the api-docs.sydecar.io/api/#tag/Capital-Call-Management/operation/createOneOrMoreCapitalCallEvents

Examples:

RESPONSE SAMPLE
{
"data": [
  {
    "id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "spv_id": "string",
    "memo": "string",
    "percentage": 0,
    "capital_calls": [
      {
        "id": "string",
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "amount": 0,
        "amount_funded": 0,
        "due_date": "2019-08-24T14:15:22Z",
        "stage": "CREATED",
        "subscription_id": "string",
        "capital_call_event_id": "string"
      }
    ]
  }
]

Parameters:

  • HEADER

    PARAMETERS:

    • idempotency-key [String]

    REQUEST BODY SCHEMA: application/json

    • {

    “capital_call_events”: [ (required)

    {
      "percentage": 100,   (required 0..100)
      "memo": "string"
    }
    

    ], “spv_id”: “string” (required)

Returns:

  • (Hash)

    Responses: > ‘201’



104
105
106
# File 'lib/sydecar/capital_call.rb', line 104

def create_spv_capital_call(body:, idempotency_key:)
 Connection.instance.post("#{CAPITAL_CALL_EVENTS_URL}/create", body, { 'idempotency-key': idempotency_key })
end

.delete_spv_capital_call(capital_call_event_id:) ⇒ Hash

Delete an SPV capital call event by id Delete an SPV capital call event. You can only delete a capital call event before subscription captial calls have been made (e.g. if the capital call event has been created but no subscriptions have been created for the spv so far).

} More detail see on the api-docs.sydecar.io/api/#tag/Capital-Call-Management/operation/removeCapitalCallEvent

Parameters:

  • PATH

    PARAMETERS

    • ‘capital_call_event_id’ [String] (required)

Returns:

  • (Hash)

    see example Response: > ‘200’



192
193
194
# File 'lib/sydecar/capital_call.rb', line 192

def delete_spv_capital_call(capital_call_event_id:)
 Connection.instance.delete("#{CAPITAL_CALL_EVENTS_URL}/#{capital_call_event_id}")
end

.fetch_capital_calls_for_spv(params: {}, body: {}) ⇒ Object

Fetch all capital call events for an SPV RESPONSE DATA (Sample):

{
"data": [
  {
    "id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "spv_id": "string",
    "memo": "string",
    "percentage": 0,
    "capital_calls": [
      {
        "id": "string",
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "amount": 0,
        "amount_funded": 0,
        "due_date": "2019-08-24T14:15:22Z",
        "stage": "CREATED",
        "subscription_id": "string",
        "capital_call_event_id": "string"
      }
    ]
  }
],
"pagination": {
  "limit": 0,
  "offset": 0,
  "total": 0
}

} See on the api-docs.sydecar.io/api/#tag/Capital-Call-Management/operation/getAllCapitalCallEvents

Parameters:

  • Query

    parameters [Hash]

    • ‘sort’ [String] (Enum: ‘asc’, ‘desc’)

    • ‘limit’ [Number] (<=100)

    • ‘offset’ [Number]

    • ‘start_date’ [String]

    • ‘end_date’ [String]

    • ‘include’ [String] (Value: ‘capital_calls’)

    REQUEST BODY SCHEMA: application/json

    • ‘ids’ [Array of string]

Returns:

  • See example RESPONSES: > ‘200’



54
55
56
57
58
# File 'lib/sydecar/capital_call.rb', line 54

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

.fetch_spv_capital_call(capital_call_event_id:, query: {}) ⇒ Hash

Fetch an SPV capital call event by id }

Parameters:

  • PATH

    PARAMETERS

    • ‘capital_call_event_id’ [String] (required)

    QUERY PARAMETERS

    • ‘include’ [String] (Value: “capital_calls”)

Returns:

  • (Hash)

    see example Response: > ‘200’



138
139
140
141
# File 'lib/sydecar/capital_call.rb', line 138

def fetch_spv_capital_call(capital_call_event_id:, query: {})
 query = "?#{URI.encode_www_form(query)}"
 Connection.instance.get("#{CAPITAL_CALL_EVENTS_URL}/#{capital_call_event_id}#{query}")
end

.get_capital_call_for_disbursement(body:, query: {}) ⇒ Hash

Get the capital call needed for a disbursement Returns the capital call percentage needed for sufficient funds for a given disbursement. Uses reserved subscription amounts, unless ‘use_spv_allocation’ is passed as ‘true’.

} More detail see on the api-docs.sydecar.io/api/#tag/Capital-Call-Management/operation/getCapitalCallNeededForDisbursement

Parameters:

  • QUERY

    PARAMETERS

    • ‘use_spv_allocation’ [boolean] (optional)

    REQUEST BODY SCHEMA: application/json

    • ‘spv_id’ [String] (required)

    • ‘disbursement’ [Number >=0 ] (required)

Returns:

  • (Hash)

    see example Response: > ‘200’



217
218
219
220
# File 'lib/sydecar/capital_call.rb', line 217

def get_capital_call_for_disbursement(body:, query: {})
 query = "?#{URI.encode_www_form(query)}"
 Connection.instance.post("#{CAPITAL_CALL_EVENTS_URL}/capital_call_needed_for_disbursement#{query}", body)
end

.update_spv_capital_call(capital_call_event_id:, body: {}) ⇒ Hash

Update an SPV capital call event Update an SPV capital call event. You can only update a capital call event before subscription captial calls have been made (e.g. if the capital call event has been created and the spv has no subscriptions created yet).

More detail see on the api-docs.sydecar.io/api/#tag/Capital-Call-Management/operation/updateCapitalCallEvent

Parameters:

  • PATH

    PARAMETERS

    • ‘capital_call_event_id’ [String] (required)

    REQUEST BODY SCHEMA: application/json

    • ‘percentage’ [Number] [ 0 .. 100 ]

    • ‘memo’ [String]

Returns:

  • (Hash)

    see example Response: > ‘200’



167
168
169
# File 'lib/sydecar/capital_call.rb', line 167

def update_spv_capital_call(capital_call_event_id:, body: {})
 Connection.instance.patch("#{CAPITAL_CALL_EVENTS_URL}/#{capital_call_event_id}", body)
end