Class: Licensario::LicensedResource
- Defined in:
- lib/licensario/licensed_resource.rb
Instance Attribute Summary collapse
-
#amount_used ⇒ Object
Returns the value of attribute amount_used.
-
#id ⇒ Object
Returns the value of attribute id.
-
#total_amount ⇒ Object
Returns the value of attribute total_amount.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ LicensedResource
constructor
A new instance of LicensedResource.
Methods inherited from Base
api, date_format, establish_connection
Constructor Details
#initialize(attributes = {}) ⇒ LicensedResource
Returns a new instance of LicensedResource.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/licensario/licensed_resource.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("//resource")[0] xml_attrs = xml_node.attributes { id: 'resourceId', total_amount: 'totalAmount', amount_used: 'amountUsed', type: 'type' }.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_used ⇒ Object
Returns the value of attribute amount_used.
6 7 8 |
# File 'lib/licensario/licensed_resource.rb', line 6 def amount_used @amount_used end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/licensario/licensed_resource.rb', line 6 def id @id end |
#total_amount ⇒ Object
Returns the value of attribute total_amount.
6 7 8 |
# File 'lib/licensario/licensed_resource.rb', line 6 def total_amount @total_amount end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/licensario/licensed_resource.rb', line 6 def type @type end |