Class: Rafflesia::Relations

Inherits:
Object
  • Object
show all
Defined in:
lib/rafflesia/relations.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Relations

Returns a new instance of Relations.



9
10
11
# File 'lib/rafflesia/relations.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#list(limit: nil, starting_after: nil, request_options: {}) ⇒ Rafflesia::EnvelopeRelationListData

GET /v1/relations

Parameters:

  • limit (Integer, nil) (defaults to: nil)
  • starting_after (String, nil) (defaults to: nil)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rafflesia/relations.rb', line 18

def list(
  limit: nil,
  starting_after: nil,
  request_options: {}
)
  params = {
    'limit' => limit,
    'starting_after' => starting_after
  }.compact
  response = @client.request(
    method: :get,
    path: '/v1/relations',
    auth: true,
    params: params,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeRelationListData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#show(relation:, request_options: {}) ⇒ Rafflesia::EnvelopeRelationDescriptor

GET /v1/relations/relation

Parameters:

  • relation (String)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rafflesia/relations.rb', line 43

def show(
  relation:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/relations/#{Rafflesia::Util.encode_path(relation)}",
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeRelationDescriptor.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end