Class: Dino::Apis::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dino/apis/base.rb

Direct Known Subclasses

Item, News

Constant Summary collapse

BASE_URL =
ENV['DINO_API_BASE_URL'] || 'https://api.dino.com.br/v2/'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: Dino::Clients::Cache.new, options: {}) ⇒ Base

Returns a new instance of Base.



7
8
9
10
# File 'lib/dino/apis/base.rb', line 7

def initialize(client: Dino::Clients::Cache.new, options: {})
  @client = client
  @options = options
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/dino/apis/base.rb', line 6

def client
  @client
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/dino/apis/base.rb', line 6

def options
  @options
end

Instance Method Details

#fetch_data(path) ⇒ Object



12
13
14
# File 'lib/dino/apis/base.rb', line 12

def fetch_data(path)
  client.fetch_data(BASE_URL + path, options)
end