Class: Geckoboard::Connection
- Inherits:
-
Object
- Object
- Geckoboard::Connection
- Defined in:
- lib/geckoboard/connection.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path) ⇒ Object
-
#initialize(api_key) ⇒ Connection
constructor
A new instance of Connection.
- #post(path, body) ⇒ Object
- #put(path, body) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Connection
Returns a new instance of Connection.
5 6 7 |
# File 'lib/geckoboard/connection.rb', line 5 def initialize(api_key) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/geckoboard/connection.rb', line 3 def api_key @api_key end |
Instance Method Details
#delete(path) ⇒ Object
15 16 17 18 19 |
# File 'lib/geckoboard/connection.rb', line 15 def delete(path) request = Net::HTTP::Delete.new(path) make_request(request) end |
#get(path) ⇒ Object
9 10 11 12 13 |
# File 'lib/geckoboard/connection.rb', line 9 def get(path) request = Net::HTTP::Get.new(path) make_request(request) end |
#post(path, body) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/geckoboard/connection.rb', line 29 def post(path, body) request = Net::HTTP::Post.new(path) request['Content-Type'] = 'application/json' request.body = body make_request(request) end |
#put(path, body) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/geckoboard/connection.rb', line 21 def put(path, body) request = Net::HTTP::Put.new(path) request['Content-Type'] = 'application/json' request.body = body make_request(request) end |