Class: StraddlePay::Resources::EmbedRepresentatives

Inherits:
Base
  • Object
show all
Defined in:
lib/straddle_pay/resources/embed_representatives.rb

Overview

Manage representatives for embedded accounts. Accessed via StraddlePay::Resources::Embed#representatives.

Constant Summary

Constants inherited from Base

Base::HEADER_KEYS

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from StraddlePay::Resources::Base

Instance Method Details

#create(account_id:, first_name:, last_name:, email:, dob:, mobile_number:, relationship:, ssn_last4:, **options) ⇒ Hash

Create a representative.

Parameters:

  • account_id (String)

    parent account ID

  • first_name (String)

    first name

  • last_name (String)

    last name

  • email (String)

    email address

  • dob (String)

    date of birth (YYYY-MM-DD)

  • mobile_number (String)

    phone in E.164 format

  • relationship (String)

    relationship to business (e.g. "owner")

  • ssn_last4 (String)

    last 4 digits of SSN

Returns:

  • (Hash)

    created representative



19
20
21
22
23
24
25
26
27
28
# File 'lib/straddle_pay/resources/embed_representatives.rb', line 19

def create(account_id:, first_name:, last_name:, email:, dob:, mobile_number:, relationship:, ssn_last4:,
           **options)
  payload = {
    account_id: , first_name: first_name, last_name: last_name,
    email: email, dob: dob, mobile_number: mobile_number,
    relationship: relationship, ssn_last4: ssn_last4, **options
  }.compact
  headers = extract_headers(payload)
  @client.post("v1/representatives", payload, headers: headers)
end

#get(id, **options) ⇒ Hash

Retrieve a representative by ID.

Parameters:

  • id (String)

    representative ID

Returns:

  • (Hash)

    representative details



34
35
36
37
# File 'lib/straddle_pay/resources/embed_representatives.rb', line 34

def get(id, **options)
  headers = extract_headers(options)
  @client.get("v1/representatives/#{id}", headers: headers)
end

#list(**options) ⇒ Hash

List representatives with optional filters.

Returns:

  • (Hash)

    paginated representative list



42
43
44
45
# File 'lib/straddle_pay/resources/embed_representatives.rb', line 42

def list(**options)
  headers = extract_headers(options)
  @client.get("v1/representatives", params: options, headers: headers)
end

#unmask(id, **options) ⇒ Hash

Retrieve unmasked representative details.

Parameters:

  • id (String)

    representative ID

Returns:

  • (Hash)

    unmasked representative details



60
61
62
63
# File 'lib/straddle_pay/resources/embed_representatives.rb', line 60

def unmask(id, **options)
  headers = extract_headers(options)
  @client.get("v1/representatives/#{id}/unmask", headers: headers)
end

#update(id, **options) ⇒ Hash

Update a representative.

Parameters:

  • id (String)

    representative ID

Returns:

  • (Hash)

    updated representative



51
52
53
54
# File 'lib/straddle_pay/resources/embed_representatives.rb', line 51

def update(id, **options)
  headers = extract_headers(options)
  @client.put("v1/representatives/#{id}", options, headers: headers)
end