Class: FoldingAtHomeClient::GPU
- Inherits:
-
Object
- Object
- FoldingAtHomeClient::GPU
- Extended by:
- Request
- Defined in:
- lib/folding_at_home_client/gpu.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.
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#species ⇒ Object
readonly
Returns the value of attribute species.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(vendor: nil, device: nil, type: nil, species: nil, description: nil, error: nil) ⇒ GPU
constructor
A new instance of GPU.
Methods included from Request
connection, format_response, request, request_and_instantiate_objects, request_unencoded
Constructor Details
#initialize(vendor: nil, device: nil, type: nil, species: nil, description: nil, error: nil) ⇒ GPU
Returns a new instance of GPU.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/folding_at_home_client/gpu.rb', line 14 def initialize( vendor: nil, device: nil, type: nil, species: nil, description: nil, error: nil ) @vendor = vendor @device = device @type = type if type @species = species if species @description = description if description @error = error if error end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def description @description end |
#device ⇒ Object (readonly)
Returns the value of attribute device.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def device @device end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def error @error end |
#species ⇒ Object (readonly)
Returns the value of attribute species.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def species @species end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def type @type end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
7 8 9 |
# File 'lib/folding_at_home_client/gpu.rb', line 7 def vendor @vendor end |
Class Method Details
.find_by(vendor:, device:) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/folding_at_home_client/gpu.rb', line 31 def self.find_by(vendor:, device:) endpoint = "/gpus/#{vendor}/#{device}" gpu_hash = request(endpoint:).first gpu_hash[:vendor] = vendor gpu_hash[:device] = device error = gpu_hash[:error] gpu_hash.delete(:status) if error new_gpu = allocate new_gpu.send(:initialize, **gpu_hash) new_gpu end |