Class: Opera::MobileStore::Developer
- Inherits:
-
Object
- Object
- Opera::MobileStore::Developer
- Includes:
- ActiveModel::Model, ActiveModel::Serialization, InspectableAttributes, Opera::MobileStoreSDK::APIAccessible, Opera::MobileStoreSDK::IdentityMapable
- Defined in:
- lib/opera/mobile_store/developer.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
All attributes are Read-Only…
-
#address2 ⇒ Object
All attributes are Read-Only…
-
#city ⇒ Object
All attributes are Read-Only…
-
#contact_email ⇒ Object
All attributes are Read-Only…
-
#country_code ⇒ Object
All attributes are Read-Only…
-
#email ⇒ Object
All attributes are Read-Only…
-
#id ⇒ Object
All attributes are Read-Only…
-
#login ⇒ Object
All attributes are Read-Only…
-
#name ⇒ Object
All attributes are Read-Only…
-
#orders_email ⇒ Object
All attributes are Read-Only…
-
#payment_info ⇒ Object
All attributes are Read-Only…
-
#phones ⇒ Object
All attributes are Read-Only…
-
#state ⇒ Object
All attributes are Read-Only…
-
#website_url ⇒ Object
All attributes are Read-Only…
-
#zip ⇒ Object
All attributes are Read-Only…
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#serializable_hash(options = nil) ⇒ Object
Override of serializable_hash:.
Methods included from Opera::MobileStoreSDK::IdentityMapable
Methods included from InspectableAttributes
Instance Attribute Details
#address1 ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def address1 @address1 end |
#address2 ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def address2 @address2 end |
#city ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def city @city end |
#contact_email ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def contact_email @contact_email end |
#country_code ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def country_code @country_code end |
#email ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def email @email end |
#id ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def id @id end |
#login ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def login @login end |
#name ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def name @name end |
#orders_email ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def orders_email @orders_email end |
#payment_info ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def payment_info @payment_info end |
#phones ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def phones @phones end |
#state ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def state @state end |
#website_url ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def website_url @website_url end |
#zip ⇒ Object
All attributes are Read-Only…
15 16 17 |
# File 'lib/opera/mobile_store/developer.rb', line 15 def zip @zip end |
Class Method Details
.build_from_nokogiri_node(node) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# 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) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# 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 |
Instance Method Details
#attributes ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# 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) ⇒ Object
Override of serializable_hash:
This override will prevent dumping special objects to the hash:
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/opera/mobile_store/developer.rb', line 34 def serializable_hash( = 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 |