Class: Opera::MobileStore::DeviceModel
- Inherits:
-
Object
- Object
- Opera::MobileStore::DeviceModel
- Includes:
- ActiveModel::Model, ActiveModel::Serialization, InspectableAttributes, Opera::MobileStoreSDK::APIAccessible, Opera::MobileStoreSDK::IdentityMapable
- Defined in:
- lib/opera/mobile_store/device_model.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
All attributes are Read-Only…
-
#id ⇒ Object
All attributes are Read-Only…
-
#name ⇒ Object
All attributes are Read-Only…
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Opera::MobileStoreSDK::IdentityMapable
Methods included from InspectableAttributes
Instance Attribute Details
#code ⇒ Object
All attributes are Read-Only…
16 17 18 |
# File 'lib/opera/mobile_store/device_model.rb', line 16 def code @code end |
#id ⇒ Object
All attributes are Read-Only…
16 17 18 |
# File 'lib/opera/mobile_store/device_model.rb', line 16 def id @id end |
#name ⇒ Object
All attributes are Read-Only…
16 17 18 |
# File 'lib/opera/mobile_store/device_model.rb', line 16 def name @name end |
Class Method Details
.build_from_nokogiri_node(node) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/opera/mobile_store/device_model.rb', line 28 def self.build_from_nokogiri_node(node) data = { id: node.xpath("number(@id)").to_i, code: node.xpath("string(@code)").strip, name: node.text.strip }.select { |key, val| val.present? } self.new data end |
Instance Method Details
#attributes ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/opera/mobile_store/device_model.rb', line 18 def attributes [:id, :code, :name].inject({}) do |hash, field_name| field_value = self.public_send field_name hash[field_name.to_s] = field_value unless field_value.nil? hash end end |