Class: Forms::Client

Inherits:
Common::Client::Base show all
Includes:
Common::Client::Concerns::Monitoring, SentryLogging
Defined in:
lib/forms/client.rb

Overview

Proxy Service for Forms API.

Examples:

Get all forms or filter by a wildcard query.

Constant Summary collapse

STATSD_KEY_PREFIX =
'api.forms'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::Client::Concerns::Monitoring

#with_monitoring

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Constructor Details

#initialize(search_term) ⇒ Client

Returns a new instance of Client.



23
24
25
# File 'lib/forms/client.rb', line 23

def initialize(search_term)
  @search_term = search_term
end

Instance Attribute Details

#search_termObject (readonly)

Returns the value of attribute search_term.



21
22
23
# File 'lib/forms/client.rb', line 21

def search_term
  @search_term
end

Instance Method Details

#get_allObject

Get all forms with an optional query parameter “query” for wildcard filtering.



29
30
31
32
33
34
35
36
# File 'lib/forms/client.rb', line 29

def get_all
  with_monitoring do
    raw_response = perform(:get, 'forms', query: search_term)
    Forms::Responses::Response.new(raw_response.status, raw_response.body, 'forms')
  end
rescue => e
  handle_error(e)
end