Class: Statcounter::Client
- Inherits:
-
Object
- Object
- Statcounter::Client
- Defined in:
- lib/statcounter/client.rb
Constant Summary collapse
- STATUS_FAIL =
'fail'.freeze
Instance Method Summary collapse
Instance Method Details
#get(path, params: {}, credentials: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/statcounter/client.rb', line 8 def get(path, params: {}, credentials: nil) response = connection(credentials).get(path, params) body = JSON.parse(response.body, symbolize_names: true) if body[:@attributes][:status] == STATUS_FAIL raise Error, body[:error][0][:description] end body rescue Faraday::ClientError => e raise Error, 'Server could not process your request' end |