Class: Belpost::Models::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/belpost/models/batch.rb

Overview

Model class for batch mailing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Batch

Returns a new instance of Batch.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/belpost/models/batch.rb', line 11

def initialize(data)
  @postal_delivery_type = data[:postal_delivery_type]
  @direction = data[:direction]
  @payment_type = data[:payment_type]
  @negotiated_rate = data[:negotiated_rate]
  @name = data[:name]
  @card_number = data[:card_number]
  @postal_items_in_ops = data[:postal_items_in_ops]
  @category = data[:category]
  @is_document = data[:is_document]
  @is_declared_value = data[:is_declared_value]
  @is_partial_receipt = data[:is_partial_receipt]
end

Instance Attribute Details

#card_numberObject (readonly)

Returns the value of attribute card_number.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def card_number
  @card_number
end

#categoryObject (readonly)

Returns the value of attribute category.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def category
  @category
end

#directionObject (readonly)

Returns the value of attribute direction.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def direction
  @direction
end

#is_declared_valueObject (readonly)

Returns the value of attribute is_declared_value.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def is_declared_value
  @is_declared_value
end

#is_documentObject (readonly)

Returns the value of attribute is_document.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def is_document
  @is_document
end

#is_partial_receiptObject (readonly)

Returns the value of attribute is_partial_receipt.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def is_partial_receipt
  @is_partial_receipt
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def name
  @name
end

#negotiated_rateObject (readonly)

Returns the value of attribute negotiated_rate.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def negotiated_rate
  @negotiated_rate
end

#payment_typeObject (readonly)

Returns the value of attribute payment_type.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def payment_type
  @payment_type
end

#postal_delivery_typeObject (readonly)

Returns the value of attribute postal_delivery_type.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def postal_delivery_type
  @postal_delivery_type
end

#postal_items_in_opsObject (readonly)

Returns the value of attribute postal_items_in_ops.



7
8
9
# File 'lib/belpost/models/batch.rb', line 7

def postal_items_in_ops
  @postal_items_in_ops
end

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/belpost/models/batch.rb', line 25

def to_h
  {
    postal_delivery_type: @postal_delivery_type,
    direction: @direction,
    payment_type: @payment_type,
    negotiated_rate: @negotiated_rate,
    name: @name,
    card_number: @card_number,
    postal_items_in_ops: @postal_items_in_ops,
    category: @category,
    is_document: @is_document,
    is_declared_value: @is_declared_value,
    is_partial_receipt: @is_partial_receipt
  }.compact
end