Class: Powershop::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/powershop/property.rb

Constant Summary collapse

ATTRIBUTES =
%w(icp_number address start_date end_date unit_balance daily_consumption 
last_account_review_at registers)

Instance Method Summary collapse

Constructor Details

#initialize(client, hash) ⇒ Property

Returns a new instance of Property.



9
10
11
12
13
14
15
# File 'lib/powershop/property.rb', line 9

def initialize(client, hash)
  @client = client
  
  ATTRIBUTES.each do |r|
    send("#{r}=", hash[r])
  end
end

Instance Method Details

#registers=(register_array) ⇒ Object

Could override this in case a Hash doesn’t suit for an address ;) def address=(address_hash) end



21
22
23
# File 'lib/powershop/property.rb', line 21

def registers=(register_array)
  @registers = register_array.map { |r| Register.new(r) }
end