Class: PaczkomatyInpost::InpostPack

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
lib/paczkomaty_inpost/inpost_pack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InpostPack

Returns a new instance of InpostPack.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 20

def initialize(attributes = {})
  attributes.each do |name, value|
    send("#{name}=", value)
  end

  missing_attributes = [:alternative_box_machine_name, :customer_delivering, :sender_box_machine_name, :customer_ref, :sender_address] - attributes.keys

  missing_attributes.each do |name|
    send("#{name}=", nil)
  end
end

Instance Attribute Details

#adresee_emailObject

Returns the value of attribute adresee_email.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def adresee_email
  @adresee_email
end

#alternative_box_machine_nameObject

Returns the value of attribute alternative_box_machine_name.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def alternative_box_machine_name
  @alternative_box_machine_name
end

#box_machine_nameObject

Returns the value of attribute box_machine_name.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def box_machine_name
  @box_machine_name
end

#customer_deliveringObject

Returns the value of attribute customer_delivering.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def customer_delivering
  @customer_delivering
end

#customer_refObject

Returns the value of attribute customer_ref.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def customer_ref
  @customer_ref
end

#insurance_amountObject

Returns the value of attribute insurance_amount.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def insurance_amount
  @insurance_amount
end

#on_delivery_amountObject

Returns the value of attribute on_delivery_amount.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def on_delivery_amount
  @on_delivery_amount
end

#pack_typeObject

Returns the value of attribute pack_type.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def pack_type
  @pack_type
end

#phone_numObject

Returns the value of attribute phone_num.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def phone_num
  @phone_num
end

#sender_addressObject

Returns the value of attribute sender_address.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def sender_address
  @sender_address
end

#sender_box_machine_nameObject

Returns the value of attribute sender_box_machine_name.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def sender_box_machine_name
  @sender_box_machine_name
end

#sender_emailObject

Returns the value of attribute sender_email.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def sender_email
  @sender_email
end

#temp_idObject

Returns the value of attribute temp_id.



11
12
13
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 11

def temp_id
  @temp_id
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 38

def persisted?
  false
end

#sender_address_typeObject



32
33
34
35
36
# File 'lib/paczkomaty_inpost/inpost_pack.rb', line 32

def sender_address_type
  unless sender_address.kind_of?(Hash)
    errors.add(:base, "Must be hash with sender address information")
  end
end