class Opera::MobileStore::Compatibility
Attributes
build_id[RW]
All attributes are Read-Only…
max_sdk_version[RW]
All attributes are Read-Only…
min_sdk_version[RW]
All attributes are Read-Only…
model_ids[RW]
All attributes are Read-Only…
platform_family_ids[RW]
All attributes are Read-Only…
platform_ids[RW]
All attributes are Read-Only…
product_id[RW]
All attributes are Read-Only…
target_sdk_version[RW]
All attributes are Read-Only…
Public Class Methods
build_from_nokogiri_node(node)
click to toggle source
TODO: Move this implementation to the SDK namespace
# File lib/opera/mobile_store/compatibility.rb, line 54 def self.build_from_nokogiri_node(node) t_node = node.xpath("build").first || node.xpath("product").first ref_key = case t_node.node_name when 'build' then :build_id when 'product' then :product_id else raise "No recognizable compatibility parent" end # parse the rest of the data: data = { ref_key => t_node.xpath("number(@id)").to_i, model_ids: t_node.xpath("models/model").map do |model_node| device_model_id = model_node.xpath("number(@id)").to_i DeviceModel.new( id: device_model_id, code: model_node.xpath("string(@code)").strip, name: model_node.text.strip ) unless DeviceModel.identity_mapped? device_model_id device_model_id end, platform_ids: t_node.xpath("platforms/platform").map do |platform_node| device_platform_id = platform_node.xpath("number(@id)").to_i DevicePlatform.new( id: device_platform_id, code: platform_node.xpath("string(@code)").strip, name: platform_node.text.strip ) unless DevicePlatform.identity_mapped? device_platform_id device_platform_id end, platform_family_ids: t_node.xpath("platform_families/platform_family").map do |platform_family_node| platform_family_id = platform_family_node.xpath("number(@id)").to_i DevicePlatformFamily.new( id: platform_family_id, code: platform_family_node.xpath("string(@code)").strip, name: platform_family_node.text.strip ) unless DevicePlatformFamily.identity_mapped? platform_family_id platform_family_id end } self.new data end
Public Instance Methods
attributes()
click to toggle source
# File lib/opera/mobile_store/compatibility.rb, line 18 def attributes [ :model_ids, :platform_ids, :platform_family_ids, :product_id, :build_id, :min_sdk_version, :target_sdk_version, :max_sdk_version ].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
build()
click to toggle source
# File lib/opera/mobile_store/compatibility.rb, line 47 def build Build.find build_id if build_id.present? end
models()
click to toggle source
# File lib/opera/mobile_store/compatibility.rb, line 33 def models model_ids.map { |model_id| DeviceModel.find model_id } end
platform_families()
click to toggle source
# File lib/opera/mobile_store/compatibility.rb, line 41 def platform_families platform_family_ids.map do |platform_family_id| DevicePlatform.find platform_family_id end end
platforms()
click to toggle source
# File lib/opera/mobile_store/compatibility.rb, line 37 def platforms platform_ids.map { |platform_id| DevicePlatform.find platform_id } end