Class: DataGetter
- Inherits:
-
Object
- Object
- DataGetter
- Defined in:
- lib/contentar/data_getter.rb
Direct Known Subclasses
ArticleDataGetter, ContentDataGetter, ReadingLevelDataGetter, SocialDataGetter
Constant Summary collapse
- API =
'https://api.engine.priceonomics.com/v1/apps/'
Instance Attribute Summary collapse
-
#api_call ⇒ Object
Returns the value of attribute api_call.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#processor ⇒ Object
Returns the value of attribute processor.
-
#url ⇒ Object
Returns the value of attribute url.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(url) ⇒ DataGetter
constructor
A new instance of DataGetter.
Constructor Details
#initialize(url) ⇒ DataGetter
Returns a new instance of DataGetter.
7 8 9 |
# File 'lib/contentar/data_getter.rb', line 7 def initialize(url) @headers = { x_access_key: ENV['PRICE_ACCESS_KEY'] } end |
Instance Attribute Details
#api_call ⇒ Object
Returns the value of attribute api_call.
4 5 6 |
# File 'lib/contentar/data_getter.rb', line 4 def api_call @api_call end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/contentar/data_getter.rb', line 6 def headers @headers end |
#processor ⇒ Object
Returns the value of attribute processor.
4 5 6 |
# File 'lib/contentar/data_getter.rb', line 4 def processor @processor end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/contentar/data_getter.rb', line 4 def url @url end |
#values ⇒ Object
Returns the value of attribute values.
4 5 6 |
# File 'lib/contentar/data_getter.rb', line 4 def values @values end |
Instance Method Details
#data ⇒ Object
11 12 13 14 |
# File 'lib/contentar/data_getter.rb', line 11 def data return error_process(response_data) if is_error?(response_data) processor.data(response_data) end |