Sha256: 989fad424d316fc312da175713b08cb34cf74c1ca6b8ec8eba8f5050b11e2091
Contents?: true
Size: 993 Bytes
Versions: 4
Compression:
Stored size: 993 Bytes
Contents
module CorreiosApi class Tracking attr_reader :response, :tracking_code, :sigla, :descricao, :categoria, :data_prevista, :weight_g, :height_cm, :width_cm, :length_cm, :formato, :modalidade, :eventos def initialize response @tracking_code = response.dig("objetos", 0, "codObjeto") @sigla = response.dig("objetos", 0, "tipoPostal", "sigla") @descricao = response.dig("objetos", 0, "tipoPostal", "descricao") @categoria = response.dig("objetos", 0, "tipoPostal", "categoria") @data_prevista = response.dig("objetos", 0, "dtPrevista") @weight_g = response.dig("objetos", 0, "peso") * 1000 @height_cm = response.dig("objetos", 0, "altura") @width_cm = response.dig("objetos", 0, "largura") @length_cm = response.dig("objetos", 0, "comprimento") @formato = response.dig("objetos", 0, "formato") @modalidade = response.dig("objetos", 0, "modalidade") @eventos = response.dig("objetos", 0, "eventos") end end end
Version data entries
4 entries across 4 versions & 1 rubygems