Sha256: f6c2ded1d06297ffc21a4ea73a1916df7eae15bb2a4a4c954a89920f284dd04c

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

require "active_support/core_ext/string"
require "active_support/core_ext/module"
require "active_support/core_ext/hash"
require "active_support/core_ext/object/blank"
require "active_support/concern"
require "virtus"
require "httparty"
require "digest/md5"

require "survey_gizmo/resource"
require "survey_gizmo/collection"

require "survey_gizmo/api/survey"
require "survey_gizmo/api/survey_campaign"
require "survey_gizmo/api/question"
require "survey_gizmo/api/option"
require "survey_gizmo/api/page"
require "survey_gizmo/api/contact"
require "survey_gizmo/api/response"
require "survey_gizmo/api/email_message"

module SurveyGizmo
  include HTTParty
  debug_output $stderr if ENV['GIZMO_DEBUG']
  default_timeout 600  # 10 minutes, SurveyGizmo has serious problems.

  format :json

  URLError = Class.new(RuntimeError)

  # The base uri for this version of the API is $1
  base_uri 'https://restapi.surveygizmo.com/v3'

  @@options = {}
  mattr_accessor :options

  # Setup the account credentials to access the API
  # @param [Hash] opts
  # @option opts [#to_s] :user
  #   The username for your account. Usually your email address
  # @option opts [#to_s] :password
  #   The account password
  def self.setup(opts = {})
    self.options = opts
    default_params({ "user:md5" => "#{opts[:user]}:#{Digest::MD5.hexdigest(opts[:password])}" })
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
survey-gizmo-ruby-1.0.5 lib/survey_gizmo/survey_gizmo.rb
survey-gizmo-ruby-1.0.4 lib/survey_gizmo/survey_gizmo.rb
survey-gizmo-ruby-1.0.3 lib/survey_gizmo/survey_gizmo.rb
survey-gizmo-ruby-1.0.1 lib/survey_gizmo/survey_gizmo.rb