Class: Wonderfl::User

Inherits:
Object
  • Object
show all
Defined in:
lib/wonderfl/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ User

Returns a new instance of User.

Raises:

  • (TypeError)


4
5
6
7
8
9
10
# File 'lib/wonderfl/user.rb', line 4

def initialize(payload)
  raise TypeError, 'Hash argument expected' unless payload.is_a? Hash
  @icon = payload['icon']
  @external_url = payload['external_url']
  @name = payload['name']
  @description = payload['description']
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



2
3
4
# File 'lib/wonderfl/user.rb', line 2

def description
  @description
end

#external_urlObject (readonly)

Returns the value of attribute external_url.



2
3
4
# File 'lib/wonderfl/user.rb', line 2

def external_url
  @external_url
end

#iconObject (readonly)

Returns the value of attribute icon.



2
3
4
# File 'lib/wonderfl/user.rb', line 2

def icon
  @icon
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/wonderfl/user.rb', line 2

def name
  @name
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/wonderfl/user.rb', line 12

def to_s
   "Wonderfl::User {\nicon => \#{@icon}\nexternal_url => \#{@external_url}\nname => \#{@name}\ndescription => \#{@description}\n}\n  EOS\nend\n"