class Opera::MobileStore::Developer
Attributes
address1[RW]
All attributes are Read-Only…
address2[RW]
All attributes are Read-Only…
city[RW]
All attributes are Read-Only…
contact_email[RW]
All attributes are Read-Only…
country_code[RW]
All attributes are Read-Only…
email[RW]
All attributes are Read-Only…
id[RW]
All attributes are Read-Only…
login[RW]
All attributes are Read-Only…
name[RW]
All attributes are Read-Only…
orders_email[RW]
All attributes are Read-Only…
payment_info[RW]
All attributes are Read-Only…
phones[RW]
All attributes are Read-Only…
state[RW]
All attributes are Read-Only…
website_url[RW]
All attributes are Read-Only…
zip[RW]
All attributes are Read-Only…
Public Class Methods
build_from_nokogiri_node(node)
click to toggle source
# File lib/opera/mobile_store/developer.rb, line 47 def self.build_from_nokogiri_node(node) data = { id: node.xpath("string(@id)").to_i, login: node.xpath("string(@login)").strip, email: node.xpath("string(email)").strip, name: node.xpath("string(name)").strip, address1: node.xpath("string(address1)").strip, address2: node.xpath("string(address2)").strip, city: node.xpath("string(city)").strip, state: node.xpath("string(state)").strip, zip: node.xpath("string(zip)").strip, country_code: node.xpath("string(country_code)").strip, website_url: node.xpath("string(website_url)").strip, orders_email: node.xpath("string(orders_email)").strip, contact_email: node.xpath("string(contact_email)").strip, phones: node.xpath("phones").text }.select { |key, value| value.present? } payment_info = PaymentInfo.build_from_nokogiri_node node.xpath("payment").first data[:payment_info] = payment_info if payment_info.present? self.new data end
deserialize(serializable_hash)
click to toggle source
# File lib/opera/mobile_store/developer.rb, line 71 def self.deserialize(serializable_hash) attributes_hash = serializable_hash.inject({}) do |hsh, keyval| field_name, field_value = keyval case field_name when 'payment_info' field_value = PaymentInfo.deserialize field_value end hsh[field_name] = field_value hsh end self.new attributes_hash end
Public Instance Methods
attributes()
click to toggle source
# File lib/opera/mobile_store/developer.rb, line 20 def attributes [ :id, :login, :email, :name, :address1, :address2, :city, :state, :zip, :country_code, :website_url, :orders_email, :contact_email, :payment_info ].inject({}) do |attributes_hash, field_name| field_value = public_send field_name attributes_hash[field_name.to_s] = field_value if field_value.present? attributes_hash end end
serializable_hash(options = nil)
click to toggle source
Override of serializable_hash
:
This override will prevent dumping special objects to the hash:
# File lib/opera/mobile_store/developer.rb, line 34 def serializable_hash(options = nil) attributes.inject({}) do |shsh, keyval| field_name, field_value = keyval # Get the payment_info serializable hash: field_value = field_value.serializable_hash \ if field_name == 'payment_info' shsh[field_name] = field_value shsh end end