Sha256: cef369608400f5ce8a3e96cb162ed597d0d3fd10b36e586b20ac00b8b4c9ee9c

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

module CorreiosApi
  class PreShipping
    attr_reader :response, :external_id, :tracking_code, :service_code, :payment_method_id, :price, :items, :post_prevision, :posting_deadline, :status, :status_detail, :label_type, :package_type
    def initialize response
      @response = response
      @external_id = response.dig("id")
      @tracking_code = response.dig("codigoObjeto")
      @service_code = response.dig("codigoServico")
      @payment_method_id = response.dig("modalidadePagamento")
      @price = response.dig("precoPrePostagem")
      @items = response.dig("itensDeclaracaoConteudo")
      @post_prevision = response.dig("dataPrevistaPostagem")
      @posting_deadline = response.dig("prazoPostagem")
      @status = response.dig("statusAtual")
      @status_detail = response.dig("descStatusAtual")
      @label_type = response.dig("tipoRotulo")
      @package_type = response.dig("tipoObjeto")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
correios_api-1.0.3 lib/correios_api/pre_shipping.rb
correios_api-1.0.2 lib/correios_api/pre_shipping.rb
correios_api-1.0.1 lib/correios_api/pre_shipping.rb
correios_api-1.0.0 lib/correios_api/pre_shipping.rb