Class: FipeApi::FipeResult

Inherits:
Base
  • Object
show all
Defined in:
lib/fipe_api/resources/fipe_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, year, fuel, authentication, price, query_time) ⇒ FipeResult

Returns a new instance of FipeResult.



10
11
12
13
14
15
16
17
# File 'lib/fipe_api/resources/fipe_result.rb', line 10

def initialize(id, year, fuel, authentication, price, query_time)
  self.id = id
  self.authentication = authentication
  self.year = year
  self.fuel = fuel
  self.price = price
  self.query_time = query_time
end

Instance Attribute Details

#authenticationObject

Returns the value of attribute authentication.



4
5
6
# File 'lib/fipe_api/resources/fipe_result.rb', line 4

def authentication
  @authentication
end

#fuelObject

Returns the value of attribute fuel.



6
7
8
# File 'lib/fipe_api/resources/fipe_result.rb', line 6

def fuel
  @fuel
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/fipe_api/resources/fipe_result.rb', line 3

def id
  @id
end

#priceObject

Returns the value of attribute price.



7
8
9
# File 'lib/fipe_api/resources/fipe_result.rb', line 7

def price
  @price
end

#query_timeObject

Returns the value of attribute query_time.



8
9
10
# File 'lib/fipe_api/resources/fipe_result.rb', line 8

def query_time
  @query_time
end

#yearObject

Returns the value of attribute year.



5
6
7
# File 'lib/fipe_api/resources/fipe_result.rb', line 5

def year
  @year
end

Instance Method Details

#urlObject



20
21
22
23
24
# File 'lib/fipe_api/resources/fipe_result.rb', line 20

def url
  "http://www.fipe.org.br/pt-br/indices/veiculos/#{year.model.brand.vehicle.name_id}/" +
  "#{year.model.brand.name.downcase}/#{year.model.brand.table.month}-#{year.model.brand.table.year}/" +
  "#{self.id}/#{self.year.id}/g/#{self.authentication}"
end