Class: TypedForm::API::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/typed_form/api/client.rb

Overview

API wrapper for querying typeform's Data API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:) ⇒ Client

Creates a new instance of an API client for querying the Typeform Data API.

Parameters:

  • api_key (String)

    Typeform API Key



15
16
17
# File 'lib/typed_form/api/client.rb', line 15

def initialize(api_key:)
  @api_key = api_key
end

Instance Attribute Details

#api_keyString

Your Typeform API key.

Returns:

  • (String)

    the current value of api_key



7
8
9
# File 'lib/typed_form/api/client.rb', line 7

def api_key
  @api_key
end

Instance Method Details

#find_form_by(form_id:, token:, **query_params) ⇒ Object

Queries the Typeform Data API /form/ endpoint to retrieve a specific response (filtered by token) for a specific Form.

parameters to the form's query. See https://www.typeform.com/help/data-api/ under Filtering Options for more information.

Parameters:

  • form_id (String)

    Typeform Form ID

  • token (String)

    The token for the form response you are querying

  • query_params (Hash<Object>)

    Splats and passes along query



28
29
30
# File 'lib/typed_form/api/client.rb', line 28

def find_form_by(form_id:, token:, **query_params)
  forms_by_id(form_id: form_id, token: token, **query_params)
end