Class: DataGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/contentar/data_getter.rb

Constant Summary collapse

API =
'https://api.engine.priceonomics.com/v1/apps/'

Instance Attribute Summary collapse

Instance Method Summary collapse

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_callObject

Returns the value of attribute api_call.



4
5
6
# File 'lib/contentar/data_getter.rb', line 4

def api_call
  @api_call
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/contentar/data_getter.rb', line 6

def headers
  @headers
end

#processorObject

Returns the value of attribute processor.



4
5
6
# File 'lib/contentar/data_getter.rb', line 4

def processor
  @processor
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/contentar/data_getter.rb', line 4

def url
  @url
end

#valuesObject

Returns the value of attribute values.



4
5
6
# File 'lib/contentar/data_getter.rb', line 4

def values
  @values
end

Instance Method Details

#dataObject



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