Class: Sydecar::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/sydecar/profile.rb,
lib/sydecar/profile/entity.rb,
lib/sydecar/profile/individual.rb

Defined Under Namespace

Classes: Entity, Individual

Constant Summary collapse

URL =
'/v1/profiles'
ACCREDITATION_QUALIFICATION_URL =
"#{URL}/accreditation_qualification_options"

Class Method Summary collapse

Class Method Details

.accreditation_qualification_opts(sub_type:, entity_type:) ⇒ Object

“SINGLE_MEMBER_LLC” “LLC” “PARTNERSHIP” “C_CORPORATION” “S_CORPORATION” “TRUST” “IRA_OR_TAX_EXEMPT” “NON_US_CORPORATION” “PRIVATE_LIMITED_COMPANY” “PUBLIC_LIMITED_COMPANY” “TAX_EXEMPT_ENTITY” “FOREIGN_TRUST” “OTHER”

Parameters:

  • sub_type. (String)

    Enum: “ENTITY”, “PERSON”

  • entity_type. (String)

    Enum: “SOLE_PROPRIETOR”



63
64
65
66
# File 'lib/sydecar/profile.rb', line 63

def accreditation_qualification_opts(sub_type: , entity_type:)
  body = { sub_type: sub_type, entity_type: entity_type }
  Connection.instance.post(ACCREDITATION_QUALIFICATION_URL, body)
end

.activate_spv(id:) ⇒ Object

TODO: check with Sydecar why this is called “activate SPV” whereas a PROFILE_ID is passed

Parameters:

  • id. (UUID)

    Warning: this must be PROFILE_ID. Not SPV ID



20
21
22
# File 'lib/sydecar/profile.rb', line 20

def activate_spv(id:)
  Connection.instance.post(activate_spv_url(id: id))
end

.activate_spv_url(id:) ⇒ Object

Parameters:

  • id. (UUID)

    Warning: this must be PROFILE_ID. Not SPV ID



14
15
16
# File 'lib/sydecar/profile.rb', line 14

def activate_spv_url(id:)
  "/v1/profiles/#{id}/activate"
end

.deactivate_spv(id:) ⇒ Object

TODO: check with Sydecar why this is called “deactivate SPV” whereas a PROFILE_ID is passed

Parameters:

  • id. (UUID)

    Warning: this must be PROFILE_ID. Not SPV ID



31
32
33
# File 'lib/sydecar/profile.rb', line 31

def deactivate_spv(id:)
  Connection.instance.post(deactivate_spv_url(id: id))
end

.deactivate_spv_url(id:) ⇒ Object

Parameters:

  • id. (UUID)

    Warning: this must be PROFILE_ID. Not SPV ID



25
26
27
# File 'lib/sydecar/profile.rb', line 25

def deactivate_spv_url(id:)
  "/v1/profiles/#{id}/deactivate"
end

.find(id:) ⇒ Object



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

def find(id:)
  url = "#{URL}/#{id}"
  Connection.instance.get(url, { reveal_pii: true, include: 'subscriptions,spvs' })
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



42
43
44
45
46
# File 'lib/sydecar/profile.rb', line 42

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