Class: MyExperimentREST::MyExperimentUser
- Inherits:
-
Object
- Object
- MyExperimentREST::MyExperimentUser
- Defined in:
- lib/myexperiment-rest/user.rb
Overview
Contains information about a user. All basic information is available but not some of the more advanced like all user’s friends or workflow’s.
Instance Attribute Summary collapse
-
#avatar_uri ⇒ Object
readonly
Returns the value of attribute avatar_uri.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Class Method Summary collapse
-
.parse(xml) ⇒ Object
Acquire data from XML response and instantiate a MyExperimentWorkflow object.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ MyExperimentUser
constructor
A new instance of MyExperimentUser.
Constructor Details
#initialize(attributes) ⇒ MyExperimentUser
Returns a new instance of MyExperimentUser.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/myexperiment-rest/user.rb', line 50 def initialize(attributes) @id = attributes[:id] @created_at = attributes[:created_at] @name = attributes[:name] @description = attributes[:description] @email = attributes[:email] @avatar_uri = attributes[:avatar_uri] @city = attributes[:city] @country = attributes[:country] @website = attributes[:website] end |
Instance Attribute Details
#avatar_uri ⇒ Object (readonly)
Returns the value of attribute avatar_uri.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def avatar_uri @avatar_uri end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def country @country end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def description @description end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def name @name end |
#website ⇒ Object (readonly)
Returns the value of attribute website.
48 49 50 |
# File 'lib/myexperiment-rest/user.rb', line 48 def website @website end |
Class Method Details
.parse(xml) ⇒ Object
Acquire data from XML response and instantiate a MyExperimentWorkflow object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/myexperiment-rest/user.rb', line 64 def self.parse(xml) doc = LibXML::XML::Document.string(xml) new(:id => doc.find_first("/user/id").content, :created_at => doc.find_first("/user/created-at").content, :name => doc.find_first("/user/name").content, :description => doc.find_first("/user/description").content, :email => doc.find_first("/user/email").content, :avatar_uri => doc.find_first("/user/avatar").attributes[:uri], :city => doc.find_first("/user/city").content, :country => doc.find_first("/user/country").content, :website => doc.find_first("/user/website").content) end |