Class: UptimeRobot::Client
- Inherits:
-
Object
- Object
- UptimeRobot::Client
- Defined in:
- lib/uptime_robot/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #get(resource, headers = {}) ⇒ Object
-
#initialize(api_key) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key) ⇒ Client
Returns a new instance of Client.
6 7 8 |
# File 'lib/uptime_robot/client.rb', line 6 def initialize api_key @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/uptime_robot/client.rb', line 4 def api_key @api_key end |
Instance Method Details
#get(resource, headers = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/uptime_robot/client.rb', line 10 def get resource, headers={} JSON.parse(RestClient.get(resource_url(resource), rest_headers(headers))) rescue RestClient::Exception => e raise UptimeRobot::Exception.new(e.response) end |