Class: Togglehq::Request
- Inherits:
-
Object
- Object
- Togglehq::Request
- Defined in:
- lib/togglehq/request.rb
Constant Summary collapse
- V1 =
"application/vnd.togglehq.com;version=1"
- ACCESS_TOKEN_KEY =
"togglehq-api-access-token"
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #delete! ⇒ Object
- #get! ⇒ Object
-
#initialize(path = "", params = {}, version = V1) ⇒ Request
constructor
A new instance of Request.
- #patch! ⇒ Object
- #post! ⇒ Object
- #put! ⇒ Object
Constructor Details
#initialize(path = "", params = {}, version = V1) ⇒ Request
Returns a new instance of Request.
14 15 16 17 18 19 20 |
# File 'lib/togglehq/request.rb', line 14 def initialize(path="", params={}, version=V1) @path = path @params = params @headers = { 'Accept' => version, } end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/togglehq/request.rb', line 12 def headers @headers end |
#params ⇒ Object
Returns the value of attribute params.
11 12 13 |
# File 'lib/togglehq/request.rb', line 11 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'lib/togglehq/request.rb', line 11 def path @path end |
Instance Method Details
#delete! ⇒ Object
38 39 40 |
# File 'lib/togglehq/request.rb', line 38 def delete! request(:delete, path, params) end |
#get! ⇒ Object
22 23 24 |
# File 'lib/togglehq/request.rb', line 22 def get! request(:get, path, params) end |
#patch! ⇒ Object
34 35 36 |
# File 'lib/togglehq/request.rb', line 34 def patch! request(:patch, path, params) end |
#post! ⇒ Object
26 27 28 |
# File 'lib/togglehq/request.rb', line 26 def post! request(:post, path, params) end |
#put! ⇒ Object
30 31 32 |
# File 'lib/togglehq/request.rb', line 30 def put! request(:put, path, params) end |