Class: Pinnacle::Network::Requests::Client
- Inherits:
-
Object
- Object
- Pinnacle::Network::Requests::Client
- Defined in:
- lib/pinnacle/network/requests/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Pinnacle::Types::NetworkRequestSummary
Retrieve one Network API request by ID.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListNetworkRequestsResponse
List Network API request records for your team, sorted newest first.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/pinnacle/network/requests/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Pinnacle::Types::NetworkRequestSummary
Retrieve one Network API request by ID. The response includes lifecycle timestamps, request status, your ‘clientRef`, and result fields from the original check.
<Note>
Limited availability. Contact [founders@pinnacle.sh](mailto:founders@pinnacle.sh) to request access.
</Note>
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/pinnacle/network/requests/client.rb', line 70 def get(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "network/requests/#{URI.encode_uri_component(params[:request_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::NetworkRequestSummary.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListNetworkRequestsResponse
List Network API request records for your team, sorted newest first. Use filters to audit recent checks by type, status, or your own ‘clientRef`.
<Note>
Limited availability. Contact [founders@pinnacle.sh](mailto:founders@pinnacle.sh) to request access.
</Note>
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pinnacle/network/requests/client.rb', line 30 def list(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "network/requests/list", body: Pinnacle::Network::Requests::Types::ListNetworkRequestsParams.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::ListNetworkRequestsResponse.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |