Module: Surveymonkey
- Defined in:
- lib/surveymonkey.rb,
lib/surveymonkey/version.rb
Overview
Specify the version of the surveymonkey gem.
Defined Under Namespace
Modules: Logging Classes: API, Client, Error, Request
Constant Summary collapse
- VERSION =
"0.3.0"
Class Method Summary collapse
-
.method_missing(method_name, *args) ⇒ Object
Catch-all method; matches SurveyMonkey API method names.
Class Method Details
.method_missing(method_name, *args) ⇒ Object
Catch-all method; matches SurveyMonkey API method names. Call like so:
Surveymonkey.get_user_details({'method_params' => {'foo' => 'bar'}})
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/surveymonkey.rb', line 22 def method_missing(method_name, *args) begin $log.debug(sprintf("%s: %s\n", __method__, 'enter')) method_params = Hash(Array(args).shift) || {} $log.debug(sprintf("%s: method_params: %s\n", __method__, method_params.inspect)) request = Surveymonkey::Request.new(method_name.to_s, method_params) response = request.execute response rescue TypeError => e $log.fatal(sprintf("%s: method parameters must be a hash\n", __method__)) exit 1 rescue KeyError => e $log.fatal(sprintf("%s: method '%s' not implemented\n", __method__, method_name.to_s)) exit 1 rescue StandardError => e $log.error(sprintf("%s: %s\n", __method__, e.)) raise end end |