Sha256: c6b5dea957054e56e91dfdcbeaf5d94cb335407d484ebd0933c789214660e4df

Contents?: true

Size: 931 Bytes

Versions: 4

Compression:

Stored size: 931 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-0.5.0 lib/correios_api/pre_shipping.rb
correios_api-0.4.0 lib/correios_api/pre_shipping.rb
correios_api-0.3.0 lib/correios_api/pre_shipping.rb
correios_api-0.2.0 lib/correios_api/pre_shipping.rb