Class: KloutAPI::KloutAPI
- Inherits:
-
Object
- Object
- KloutAPI::KloutAPI
- Includes:
- HTTParty
- Defined in:
- lib/klout_stable.rb
Constant Summary collapse
- @@base_uri =
"http://api.klout.com/v2/"
- @@api_key =
""
Class Method Summary collapse
-
.api_key ⇒ Object
Get the API key.
-
.api_key=(api_key) ⇒ Object
Set the API key.
-
.base_uri ⇒ Object
Get the Base URI.
- .delete(*args) ⇒ Object
- .get(*args) ⇒ Object
-
.handle_response(response) ⇒ Object
:nodoc:.
- .post(*args) ⇒ Object
- .put(*args) ⇒ Object
Class Method Details
.api_key ⇒ Object
Get the API key
62 |
# File 'lib/klout_stable.rb', line 62 def api_key; @@api_key end |
.api_key=(api_key) ⇒ Object
Set the API key
65 66 67 68 |
# File 'lib/klout_stable.rb', line 65 def api_key=(api_key) return @@api_key unless api_key @@api_key = api_key end |
.base_uri ⇒ Object
Get the Base URI.
71 |
# File 'lib/klout_stable.rb', line 71 def base_uri; @@base_uri end |
.delete(*args) ⇒ Object
76 |
# File 'lib/klout_stable.rb', line 76 def delete(*args); handle_response super end |
.get(*args) ⇒ Object
73 |
# File 'lib/klout_stable.rb', line 73 def get(*args); handle_response super end |
.handle_response(response) ⇒ Object
:nodoc:
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/klout_stable.rb', line 78 def handle_response(response) # :nodoc: case response.code when 400 raise BadRequest.new response.parsed_response when 401 raise Unauthorized.new when 404 raise NotFound.new when 400...500 raise ClientError.new response.parsed_response when 500...600 raise ServerError.new else response end end |
.post(*args) ⇒ Object
74 |
# File 'lib/klout_stable.rb', line 74 def post(*args); handle_response super end |
.put(*args) ⇒ Object
75 |
# File 'lib/klout_stable.rb', line 75 def put(*args); handle_response super end |