Class: HealthGraph::User

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/health_graph/models/user.rb

Instance Attribute Summary

Attributes included from Model

#body

Attributes included from API

#access_token

Instance Method Summary collapse

Methods included from Model

included, #populate_from_hash!

Methods included from API

#delete, #get, #post, #put

Constructor Details

#initialize(access_token) ⇒ User

Returns a new instance of User.



7
8
9
10
11
12
# File 'lib/health_graph/models/user.rb', line 7

def initialize(access_token)            
  self.access_token = access_token
  response = get "user", HealthGraph.accept_headers[:user]
  self.body = response.body
  populate_from_hash! self.body      
end

Instance Method Details

#fitness_activities(params = {}) ⇒ Object



30
31
32
# File 'lib/health_graph/models/user.rb', line 30

def fitness_activities params = {}
  HealthGraph::FitnessActivitiesFeed.new self.access_token, self.body["fitness_activities"], params
end

#fitness_activity_delete(params) ⇒ Object



42
43
44
# File 'lib/health_graph/models/user.rb', line 42

def fitness_activity_delete params
  HealthGraph::FitnessActivityDelete.new self.access_token, params
end

#fitness_activity_update(params) ⇒ Object



38
39
40
# File 'lib/health_graph/models/user.rb', line 38

def fitness_activity_update params
  HealthGraph::FitnessActivityUpdate.new self.access_token, params
end

#new_fitness_activity(params) ⇒ Object



34
35
36
# File 'lib/health_graph/models/user.rb', line 34

def new_fitness_activity params
  HealthGraph::NewFitnessActivity.new self.access_token, params
end

#profileObject



14
15
16
# File 'lib/health_graph/models/user.rb', line 14

def profile      
  HealthGraph::Profile.new self.access_token, self.body["profile"]      
end

#settingsObject



18
19
20
# File 'lib/health_graph/models/user.rb', line 18

def settings
  HealthGraph::Settings.new self.access_token, self.body["settings"]
end

#sleepObject



26
27
28
# File 'lib/health_graph/models/user.rb', line 26

def sleep
  HealthGraph::SleepFeed.new self.access_token, self.body["sleep"]
end

#strength_training_activities(params = {}) ⇒ Object



46
47
48
# File 'lib/health_graph/models/user.rb', line 46

def strength_training_activities params = {}
  HealthGraph::StrengthTrainingActivitiesFeed.new self.access_token, self.body["strength_training_activities"], params
end

#weightObject



22
23
24
# File 'lib/health_graph/models/user.rb', line 22

def weight
  HealthGraph::WeightFeed.new self.access_token, self.body["weight"]
end