Class: Rafflesia::Environments

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Environments

Returns a new instance of Environments.



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

def initialize(client)
  @client = client
end

Instance Method Details

#get(environment_id:, request_options: {}) ⇒ Rafflesia::EnvelopeEnvironment

GET /v1/environments/environment_id

Parameters:

  • environment_id (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/environments.rb', line 43

def get(
  environment_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/environments/#{Rafflesia::Util.encode_path(environment_id)}",
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeEnvironment.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

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

GET /v1/environments

Parameters:

  • limit (Integer, nil) (defaults to: 25)
  • 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/environments.rb', line 18

def list(
  limit: 25,
  starting_after: nil,
  request_options: {}
)
  params = {
    'limit' => limit,
    'starting_after' => starting_after
  }.compact
  response = @client.request(
    method: :get,
    path: '/v1/environments',
    auth: true,
    params: params,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeListEnvironment.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