Class: TypedForm::Client
- Inherits:
-
Object
- Object
- TypedForm::Client
- Includes:
- HTTParty
- Defined in:
- lib/typed_form/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #find_form_by(form_id:, token:, **query_params) ⇒ Object
- #forms_by_id(form_id:, **query_params) ⇒ Object
-
#initialize(api_key:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key:) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/typed_form/client.rb', line 7 def initialize(api_key:) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/typed_form/client.rb', line 3 def api_key @api_key end |
Instance Method Details
#find_form_by(form_id:, token:, **query_params) ⇒ Object
17 18 19 |
# File 'lib/typed_form/client.rb', line 17 def find_form_by(form_id:, token:, **query_params) forms_by_id(form_id: form_id, token: token, **query_params) end |
#forms_by_id(form_id:, **query_params) ⇒ Object
11 12 13 14 15 |
# File 'lib/typed_form/client.rb', line 11 def forms_by_id(form_id:, **query_params) url_params = query_params.map { |k, v| "#{k}=#{v}" } request_url = [form_id, authenticated_slug(url_params)].join("?") get(request_url).body end |