Class: Licensario::LicensedFeature

Inherits:
Base
  • Object
show all
Defined in:
lib/licensario/licensed_feature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

api, date_format, establish_connection

Constructor Details

#initialize(attributes = {}) ⇒ LicensedFeature

Returns a new instance of LicensedFeature.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/licensario/licensed_feature.rb', line 8

def initialize(attributes = {})
  if attributes[:xml_node] or attributes[:xml]
    xml_node = attributes[:xml_node] ? attributes[:xml_node] : Nokogiri::XML(attributes[:xml]).xpath("//feature")[0]
    xml_attrs = xml_node.attributes
    {
      id: 'id',
      total_amount: 'totalAmount',
      amount_used: 'amountUsed'
    }.each do |k,v|
      attributes[k] = xml_attrs[v] ? xml_attrs[v].value : nil
    end  
    attributes.delete(:xml_node)
    attributes.delete(:xml)    
  end
  super(attributes)
end

Instance Attribute Details

#amount_usedObject

Returns the value of attribute amount_used.



6
7
8
# File 'lib/licensario/licensed_feature.rb', line 6

def amount_used
  @amount_used
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/licensario/licensed_feature.rb', line 6

def id
  @id
end

#total_amountObject

Returns the value of attribute total_amount.



6
7
8
# File 'lib/licensario/licensed_feature.rb', line 6

def total_amount
  @total_amount
end