Class: BabyTooth::Client
- Inherits:
-
Object
- Object
- BabyTooth::Client
- Defined in:
- lib/baby_tooth/client.rb
Direct Known Subclasses
FitnessActivity, FitnessActivityFeed, Profile, TeamFeed, User
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #body ⇒ Object
-
#initialize(access_token, path) ⇒ Client
constructor
A new instance of Client.
- #resource_class_name ⇒ Object
Constructor Details
#initialize(access_token, path) ⇒ Client
Returns a new instance of Client.
13 14 15 16 |
# File 'lib/baby_tooth/client.rb', line 13 def initialize(access_token, path) self.access_token = access_token self.path = path end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
3 4 5 |
# File 'lib/baby_tooth/client.rb', line 3 def access_token @access_token end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/baby_tooth/client.rb', line 3 def path @path end |
Class Method Details
.exposes_keys(*keys) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/baby_tooth/client.rb', line 22 def self.exposes_keys(*keys) keys.each do |key| define_method key do body[key.to_s] end end end |
Instance Method Details
#[](key) ⇒ Object
5 6 7 |
# File 'lib/baby_tooth/client.rb', line 5 def [](key) body[key] end |
#body ⇒ Object
9 10 11 |
# File 'lib/baby_tooth/client.rb', line 9 def body @body ||= retrieve_body end |
#resource_class_name ⇒ Object
18 19 20 |
# File 'lib/baby_tooth/client.rb', line 18 def resource_class_name self.class.name.split('::').last end |