lib/loopiator/models/domain.rb in loopiator-0.3.3 vs lib/loopiator/models/domain.rb in loopiator-0.3.4

- old
+ new

@@ -1,20 +1,21 @@ module Loopiator module Models + #https://www.loopia.se/api/domain_obj/ class Domain - attr_accessor :paid, :unpaid_amount, :registered, :domain, :renewal_status, :expiration_date, :reference_number + attr_accessor :domain, :paid, :registered, :renewal_status, :expiration_date, :reference_number, :unpaid_amount def initialize(hash) hash.symbolize_keys! + self.domain = hash.fetch(:domain, "") self.paid = hash.fetch(:paid, 0).eql?(1) - self.unpaid_amount = hash.fetch(:unpaid_amount, 0) self.registered = hash.fetch(:registered, 0).eql?(1) - self.domain = hash.fetch(:domain, "") self.renewal_status = hash.fetch(:renewal_status, "") self.expiration_date = hash.fetch(:expiration_date, "") self.reference_number = hash.fetch(:reference_no, "").to_s + self.unpaid_amount = hash.fetch(:unpaid_amount, 0) end def paid? paid end \ No newline at end of file