Class: CorreiosApi::Tracking

Inherits:
Object
  • Object
show all
Defined in:
lib/correios_api/tracking.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Tracking

Returns a new instance of Tracking.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/correios_api/tracking.rb', line 4

def initialize response
  @tracking_code = response.objetos[0].codObjeto
  @sigla = response.objetos[0].tipoPostal.sigla
  @descricao = response.objetos[0].tipoPostal.descricao
  @categoria = response.objetos[0].tipoPostal.categoria
  @data_prevista = response.objetos[0].dtPrevista
  @weight_g = response.objetos[0].peso * 1000
  @height_cm = response.objetos[0].altura
  @width_cm = response.objetos[0].largura
  @length_cm = response.objetos[0].comprimento
  @formato = response.objetos[0].formato
  @modalidade = response.objetos[0].modalidade
  @eventos = response.objetos[0].eventos
end

Instance Attribute Details

#categoriaObject (readonly)

Returns the value of attribute categoria.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def categoria
  @categoria
end

#data_previstaObject (readonly)

Returns the value of attribute data_prevista.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def data_prevista
  @data_prevista
end

#descricaoObject (readonly)

Returns the value of attribute descricao.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def descricao
  @descricao
end

#eventosObject (readonly)

Returns the value of attribute eventos.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def eventos
  @eventos
end

#formatoObject (readonly)

Returns the value of attribute formato.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def formato
  @formato
end

#height_cmObject (readonly)

Returns the value of attribute height_cm.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def height_cm
  @height_cm
end

#length_cmObject (readonly)

Returns the value of attribute length_cm.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def length_cm
  @length_cm
end

#modalidadeObject (readonly)

Returns the value of attribute modalidade.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def modalidade
  @modalidade
end

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def response
  @response
end

#siglaObject (readonly)

Returns the value of attribute sigla.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def sigla
  @sigla
end

#tracking_codeObject (readonly)

Returns the value of attribute tracking_code.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def tracking_code
  @tracking_code
end

#weight_gObject (readonly)

Returns the value of attribute weight_g.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def weight_g
  @weight_g
end

#width_cmObject (readonly)

Returns the value of attribute width_cm.



3
4
5
# File 'lib/correios_api/tracking.rb', line 3

def width_cm
  @width_cm
end