Class: TinyErpApi::Shipment

Inherits:
Object
  • Object
show all
Defined in:
lib/tiny_erp_api/shipment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id_transportador: nil, frete_por_conta: nil, id_forma_envio: nil, id_forma_frete: nil, codigo_rastreamento: nil, url_rastreamento: nil) ⇒ Shipment

Returns a new instance of Shipment.



5
6
7
8
9
10
11
12
# File 'lib/tiny_erp_api/shipment.rb', line 5

def initialize(id_transportador: nil, frete_por_conta: nil, id_forma_envio: nil, id_forma_frete: nil, codigo_rastreamento: nil, url_rastreamento: nil)
  @id_transportador = id_transportador
  @frete_por_conta = frete_por_conta
  @id_forma_envio = id_forma_envio
  @id_forma_frete = id_forma_frete
  @codigo_rastreamento = codigo_rastreamento
  @url_rastreamento = url_rastreamento
end

Instance Attribute Details

#codigo_rastreamentoObject (readonly)

Returns the value of attribute codigo_rastreamento.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def codigo_rastreamento
  @codigo_rastreamento
end

#frete_por_contaObject (readonly)

Returns the value of attribute frete_por_conta.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def frete_por_conta
  @frete_por_conta
end

#id_forma_envioObject (readonly)

Returns the value of attribute id_forma_envio.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def id_forma_envio
  @id_forma_envio
end

#id_forma_freteObject (readonly)

Returns the value of attribute id_forma_frete.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def id_forma_frete
  @id_forma_frete
end

#id_transportadorObject (readonly)

Returns the value of attribute id_transportador.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def id_transportador
  @id_transportador
end

#url_rastreamentoObject (readonly)

Returns the value of attribute url_rastreamento.



4
5
6
# File 'lib/tiny_erp_api/shipment.rb', line 4

def url_rastreamento
  @url_rastreamento
end

Instance Method Details

#to_api_hashObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tiny_erp_api/shipment.rb', line 14

def to_api_hash
  {
    id: id_transportador,
    fretePorConta: frete_por_conta,
    formaEnvio: {
      id: id_forma_envio
    },
    formaFrete: {
      id: id_forma_frete
    },
    codigoRastreamento: codigo_rastreamento,
    urlRastreamento: url_rastreamento
  }
end