Class: CorreiosApi::Tracking
- Inherits:
-
Object
- Object
- CorreiosApi::Tracking
- Defined in:
- lib/correios_api/tracking.rb
Instance Attribute Summary collapse
-
#categoria ⇒ Object
readonly
Returns the value of attribute categoria.
-
#data_prevista ⇒ Object
readonly
Returns the value of attribute data_prevista.
-
#descricao ⇒ Object
readonly
Returns the value of attribute descricao.
-
#eventos ⇒ Object
readonly
Returns the value of attribute eventos.
-
#formato ⇒ Object
readonly
Returns the value of attribute formato.
-
#height_cm ⇒ Object
readonly
Returns the value of attribute height_cm.
-
#length_cm ⇒ Object
readonly
Returns the value of attribute length_cm.
-
#modalidade ⇒ Object
readonly
Returns the value of attribute modalidade.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#sigla ⇒ Object
readonly
Returns the value of attribute sigla.
-
#tracking_code ⇒ Object
readonly
Returns the value of attribute tracking_code.
-
#weight_g ⇒ Object
readonly
Returns the value of attribute weight_g.
-
#width_cm ⇒ Object
readonly
Returns the value of attribute width_cm.
Instance Method Summary collapse
-
#initialize(response) ⇒ Tracking
constructor
A new instance of Tracking.
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
#categoria ⇒ Object (readonly)
Returns the value of attribute categoria.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def categoria @categoria end |
#data_prevista ⇒ Object (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 |
#descricao ⇒ Object (readonly)
Returns the value of attribute descricao.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def descricao @descricao end |
#eventos ⇒ Object (readonly)
Returns the value of attribute eventos.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def eventos @eventos end |
#formato ⇒ Object (readonly)
Returns the value of attribute formato.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def formato @formato end |
#height_cm ⇒ Object (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_cm ⇒ Object (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 |
#modalidade ⇒ Object (readonly)
Returns the value of attribute modalidade.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def modalidade @modalidade end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def response @response end |
#sigla ⇒ Object (readonly)
Returns the value of attribute sigla.
3 4 5 |
# File 'lib/correios_api/tracking.rb', line 3 def sigla @sigla end |
#tracking_code ⇒ Object (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_g ⇒ Object (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_cm ⇒ Object (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 |