Class: Dalia::Api::SurveyPlatform::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dalia_api_survey_platform/client.rb

Direct Known Subclasses

MockClient

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dalia_api_survey_platform/client.rb', line 6

def initialize(opts = {})
  @options = {
    :debug_mode => false,
    :api_host => "http://daliaresearch.com"
  }.merge!(opts)

  @log = Dalia::Api::SurveyPlatform::Log.new(options[:debug_mode])

  log.log_options(options)

  check_required_options(options, :api_host, :account_id)
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



3
4
5
# File 'lib/dalia_api_survey_platform/client.rb', line 3

def log
  @log
end

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/dalia_api_survey_platform/client.rb', line 2

def options
  @options
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/dalia_api_survey_platform/client.rb', line 4

def response
  @response
end

Instance Method Details

#create_query(opts) ⇒ Object



58
59
60
61
# File 'lib/dalia_api_survey_platform/client.rb', line 58

def create_query(opts)
  check_required_options(opts, :survey_id, :question_id)
  make_request_create_query(opts)
end

#fetch_completion(opts) ⇒ Object



48
49
50
51
# File 'lib/dalia_api_survey_platform/client.rb', line 48

def fetch_completion(opts)
  check_required_options(opts, :survey_id, :completion_id)
  make_request_fetch_completion(opts)
end

#fetch_completions(opts) ⇒ Object



38
39
40
41
# File 'lib/dalia_api_survey_platform/client.rb', line 38

def fetch_completions(opts)
  check_required_options(opts, :survey_id)
  make_request_fetch_completions(opts)
end

#fetch_completions_csv(opts) ⇒ Object



43
44
45
46
# File 'lib/dalia_api_survey_platform/client.rb', line 43

def fetch_completions_csv(opts)
  check_required_options(opts, :survey_id)
  make_request_fetch_completions_csv(opts)
end

#fetch_survey(opts) ⇒ Object



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

def fetch_survey(opts)
  check_required_options(opts, :survey_id)
  make_request_fetch_survey(opts)
end

#fetch_survey_price(opts) ⇒ Object



53
54
55
56
# File 'lib/dalia_api_survey_platform/client.rb', line 53

def fetch_survey_price(opts)
  check_required_options(opts)
  make_request_fetch_survey_price(opts)
end

#fetch_surveysObject



19
20
21
# File 'lib/dalia_api_survey_platform/client.rb', line 19

def fetch_surveys
  make_request_fetch_surveys({})
end

#send_survey(opts) ⇒ Object



28
29
30
31
# File 'lib/dalia_api_survey_platform/client.rb', line 28

def send_survey(opts)
  check_required_options(opts, :data)
  make_request_send_survey(opts)
end

#update_survey(opts) ⇒ Object



33
34
35
36
# File 'lib/dalia_api_survey_platform/client.rb', line 33

def update_survey(opts)
  check_required_options(opts, :survey_id, :data)
  make_request_update_survey(opts)
end