Class: Withings::Api::TypeBase
- Inherits:
-
Object
- Object
- Withings::Api::TypeBase
- Defined in:
- lib/withings-api/types.rb
Direct Known Subclasses
Constant Summary collapse
- @@lookup_by_id =
Lookup helpers for static types
{}
- @@lookup_by_name =
{}
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, name, description) ⇒ TypeBase
constructor
A new instance of TypeBase.
- #inspect ⇒ Object
Constructor Details
#initialize(id, name, description) ⇒ TypeBase
Returns a new instance of TypeBase.
7 8 9 10 11 |
# File 'lib/withings-api/types.rb', line 7 def initialize(id, name, description) self.id = id self.name = name self.description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/withings-api/types.rb', line 5 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/withings-api/types.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/withings-api/types.rb', line 5 def name @name end |
Class Method Details
.lookup(key) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/withings-api/types.rb', line 32 def self.lookup(key) lookup_by_id = @@lookup_by_id[self] ||= {} lookup_by_name = @@lookup_by_name[self] ||= {} lookup_by_id[key] || lookup_by_name[key] end |
.register(instance) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/withings-api/types.rb', line 24 def self.register(instance) lookup_by_id = @@lookup_by_id[self] ||= {} lookup_by_name = @@lookup_by_name[self] ||= {} lookup_by_id[instance.id] = instance lookup_by_name[instance.name] = instance end |
Instance Method Details
#inspect ⇒ Object
13 14 15 |
# File 'lib/withings-api/types.rb', line 13 def inspect self.description end |