class Qualaroo::Client

Attributes

api_key[RW]
api_secret[RW]
api_key[RW]
api_secret[RW]

Public Class Methods

method_missing(sym, *args, &block) click to toggle source
# File lib/qualaroo.rb, line 39
def method_missing(sym, *args, &block)
  new(api_key, api_secret).send(sym, *args, &block)
end
new(api_key, api_secret) click to toggle source
# File lib/qualaroo.rb, line 12
def initialize(api_key, api_secret)
  @auth = {
    username: api_key || self.class.api_key || ENV['QUALAROO_API_KEY'],
    password: api_secret || self.class.api_secret || ENV['QUALAROO_API_SECRET']
  }
end

Public Instance Methods

all_responses(nudge_id, query={}, options={}) click to toggle source
# File lib/qualaroo.rb, line 24
def all_responses(nudge_id, query={}, options={})
  offset = 0
  all_responses = []

  while (page_responses = responses(nudge_id, query.merge(offset: offset), options)) && page_responses.any?
    all_responses += page_responses
    offset += 500
  end

  all_responses
end
responses(nudge_id, query={}, options={}) click to toggle source
# File lib/qualaroo.rb, line 19
def responses(nudge_id, query={}, options={})
  options.merge!(basic_auth: @auth, query: query)
  self.class.get("/nudges/#{nudge_id}/responses.json", options)
end