Class: FoldingAtHomeClient::Manager
- Inherits:
-
Object
- Object
- FoldingAtHomeClient::Manager
- Includes:
- Request
- Defined in:
- lib/folding_at_home_client/manager.rb
Constant Summary
Constants included from Request
Request::API_URL, Request::HEADERS
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#institution ⇒ Object
readonly
Returns the value of attribute institution.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#thumb ⇒ Object
readonly
Returns the value of attribute thumb.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(id: nil, name: nil, description: nil, thumb: nil, url: nil, institution: nil) ⇒ Manager
constructor
A new instance of Manager.
- #lookup ⇒ Object
Methods included from Request
#connection, #format_response, #request, #request_and_instantiate_objects, #request_unencoded
Constructor Details
#initialize(id: nil, name: nil, description: nil, thumb: nil, url: nil, institution: nil) ⇒ Manager
Returns a new instance of Manager.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/folding_at_home_client/manager.rb', line 15 def initialize( id: nil, name: nil, description: nil, thumb: nil, url: nil, institution: nil ) @id = id if id @name = name if name @description = description if description @thumb = thumb if thumb && !thumb.empty? @url = url if url && !url.empty? @institution = institution if institution && !institution.empty? end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def description @description end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def error @error end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def id @id end |
#institution ⇒ Object (readonly)
Returns the value of attribute institution.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def institution @institution end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def name @name end |
#thumb ⇒ Object (readonly)
Returns the value of attribute thumb.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def thumb @thumb end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/folding_at_home_client/manager.rb', line 7 def url @url end |
Instance Method Details
#lookup ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/folding_at_home_client/manager.rb', line 32 def lookup endpoint = "/project/manager/#{id}" manager_hash = request(endpoint:).first error = manager_hash[:error] if error @error = error return self end @name = manager_hash[:name] @description = manager_hash[:description] thumb = manager_hash[:thumb] @thumb = thumb if thumb && !thumb.empty? url = manager_hash[:url] @url = url if url && !url.empty? institution = manager_hash[:institution] @institution = institution if institution && !institution.empty? self end |