Class: Mirror::Api::Request
- Inherits:
-
Object
- Object
- Mirror::Api::Request
- Defined in:
- lib/mirror-api/request.rb
Constant Summary collapse
- TIMELINE =
"timeline"
- SUBSCRIPTIONS =
"subscriptions"
- LOCATIONS =
"locations"
- CONTACTS =
"contacts"
- VALID_RESOURCES =
[TIMELINE, SUBSCRIPTIONS, LOCATIONS, CONTACTS]
Instance Attribute Summary collapse
-
#creds ⇒ Object
Returns the value of attribute creds.
-
#data ⇒ Object
Returns the value of attribute data.
-
#host ⇒ Object
Returns the value of attribute host.
-
#last_error ⇒ Object
Returns the value of attribute last_error.
-
#last_exception ⇒ Object
Returns the value of attribute last_exception.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#params ⇒ Object
Returns the value of attribute params.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#response ⇒ Object
Returns the value of attribute response.
-
#throw_on_fail ⇒ Object
Returns the value of attribute throw_on_fail.
Instance Method Summary collapse
- #delete ⇒ Object
- #get ⇒ Object
-
#initialize(creds, options = {}) ⇒ Request
constructor
A new instance of Request.
- #patch ⇒ Object
- #post ⇒ Object
- #put ⇒ Object
Constructor Details
#initialize(creds, options = {}) ⇒ Request
Returns a new instance of Request.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mirror-api/request.rb', line 23 def initialize(creds, ={}) self.resource = [:resource] self.params = [:params] self.logger = [:logger] @id = [:id] @expected_response = [:expected_response] @creds = creds @last_exception = nil @throw_on_fail = [:raise_errors] || false @host = [:host] || HOST @last_error = nil end |
Instance Attribute Details
#creds ⇒ Object
Returns the value of attribute creds.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def creds @creds end |
#data ⇒ Object
Returns the value of attribute data.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def data @data end |
#host ⇒ Object
Returns the value of attribute host.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def host @host end |
#last_error ⇒ Object
Returns the value of attribute last_error.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def last_error @last_error end |
#last_exception ⇒ Object
Returns the value of attribute last_exception.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def last_exception @last_exception end |
#logger ⇒ Object
Returns the value of attribute logger.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def logger @logger end |
#params ⇒ Object
Returns the value of attribute params.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def params @params end |
#resource ⇒ Object
Returns the value of attribute resource.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def resource @resource end |
#response ⇒ Object
Returns the value of attribute response.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def response @response end |
#throw_on_fail ⇒ Object
Returns the value of attribute throw_on_fail.
20 21 22 |
# File 'lib/mirror-api/request.rb', line 20 def throw_on_fail @throw_on_fail end |
Instance Method Details
#delete ⇒ Object
86 87 88 |
# File 'lib/mirror-api/request.rb', line 86 def delete get_verb(:delete) end |
#get ⇒ Object
90 91 92 |
# File 'lib/mirror-api/request.rb', line 90 def get get_verb end |
#patch ⇒ Object
82 83 84 |
# File 'lib/mirror-api/request.rb', line 82 def patch do_verb(:patch) end |
#post ⇒ Object
74 75 76 |
# File 'lib/mirror-api/request.rb', line 74 def post do_verb(:post) end |
#put ⇒ Object
78 79 80 |
# File 'lib/mirror-api/request.rb', line 78 def put do_verb(:put) end |