Class: Surveymonkey::Client
- Inherits:
-
Object
- Object
- Surveymonkey::Client
- Includes:
- HTTParty
- Defined in:
- lib/surveymonkey/client.rb
Overview
Class encapsulating the HTTParty client used to communicate with the SurveyMonkey API.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
public methods.
-
#api_key ⇒ Object
readonly
public methods.
-
#baseuri ⇒ Object
readonly
public methods.
Instance Method Summary collapse
-
#initialize(baseuri, access_token, api_key) ⇒ Client
constructor
Create a new Surveymonkey::Client object.
-
#to_s ⇒ Object
Stringify a Surveymonkey::Client object.
Constructor Details
#initialize(baseuri, access_token, api_key) ⇒ Client
Create a new Surveymonkey::Client object. Requires the following parameters:
-
baseuri
-
access_token
-
api_key
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/surveymonkey/client.rb', line 25 def initialize(baseuri, access_token, api_key) begin @baseuri = baseuri @access_token = access_token @api_key = api_key self.class.logger $log, :debug $log.debug(sprintf("%s: setting base_uri to '%s'", __method__, @baseuri)) self.class.base_uri @baseuri http_headers = _http_headers(@access_token) self.class.headers http_headers rescue StandardError => e $log.error(sprintf("%s: %s", __method__, e.)) raise e end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
public methods
17 18 19 |
# File 'lib/surveymonkey/client.rb', line 17 def access_token @access_token end |
#api_key ⇒ Object (readonly)
public methods
17 18 19 |
# File 'lib/surveymonkey/client.rb', line 17 def api_key @api_key end |
#baseuri ⇒ Object (readonly)
public methods
17 18 19 |
# File 'lib/surveymonkey/client.rb', line 17 def baseuri @baseuri end |
Instance Method Details
#to_s ⇒ Object
Stringify a Surveymonkey::Client object
48 49 50 |
# File 'lib/surveymonkey/client.rb', line 48 def to_s self.baseuri end |