Class: Pinnacle::Forms::Submissions::Client
- Inherits:
-
Object
- Object
- Pinnacle::Forms::Submissions::Client
- Defined in:
- lib/pinnacle/forms/submissions/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListFormSubmissionsResponse
Paginated list of completed submissions for a form, newest first.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/pinnacle/forms/submissions/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListFormSubmissionsResponse
Paginated list of completed submissions for a form, newest first. Each row includes the submitted ‘data` keyed by field `key`, the sender/recipient, IP, user-agent, and timestamps.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pinnacle/forms/submissions/client.rb', line 27 def list(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request_data = Pinnacle::Forms::Submissions::Types::ListFormSubmissionsParams.new(params).to_h non_body_param_names = ["id"] body = request_data.except(*non_body_param_names) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "forms/#{URI.encode_uri_component(params[:id].to_s)}/submissions/list", body: body, 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::ListFormSubmissionsResponse.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |