Class: Kreepr::Client
- Inherits:
-
Object
- Object
- Kreepr::Client
- Defined in:
- lib/kreepr.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #feed(params, timeout = 10) ⇒ Object
-
#initialize(params) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(params) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/kreepr.rb', line 11 def initialize(params) @api_key = params[:api_key] validate_api_key!(@api_key) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/kreepr.rb', line 9 def api_key @api_key end |
Instance Method Details
#feed(params, timeout = 10) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/kreepr.rb', line 16 def feed(params, timeout = 10) validate_params!(params) response = Timeout::timeout(timeout) do ::Faraday.get(request_uri(params)) end JSON.parse(response.body) end |