Class: Wes::Data::API::Model::Base
- Inherits:
-
Object
- Object
- Wes::Data::API::Model::Base
- Defined in:
- lib/wes/data/api/model/base.rb
Direct Known Subclasses
Billing, Brand, BrandUser, Challenge, ChallengeReward, Collective, CreatorUser, Submission, Video
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #exist? ⇒ Boolean
- #id ⇒ Object
-
#initialize(attributes) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attributes) ⇒ Base
Returns a new instance of Base.
8 9 10 11 |
# File 'lib/wes/data/api/model/base.rb', line 8 def initialize(attributes) @attributes = attributes id_set? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *_args, &_block) ⇒ Object (protected)
40 41 42 |
# File 'lib/wes/data/api/model/base.rb', line 40 def method_missing(sym, *_args, &_block) attributes.to_h.fetch(sym, nil) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/wes/data/api/model/base.rb', line 6 def attributes @attributes end |
Instance Method Details
#exist? ⇒ Boolean
13 14 15 |
# File 'lib/wes/data/api/model/base.rb', line 13 def exist? !attributes.nil? end |
#id ⇒ Object
17 18 19 |
# File 'lib/wes/data/api/model/base.rb', line 17 def id attributes.id end |