Module: BabyTooth
- Defined in:
- lib/baby_tooth.rb,
lib/baby_tooth/user.rb,
lib/baby_tooth/client.rb,
lib/baby_tooth/profile.rb,
lib/baby_tooth/team_feed.rb,
lib/baby_tooth/fitness_activity.rb,
lib/baby_tooth/fitness_activity_feed.rb
Defined Under Namespace
Classes: Client, Configuration, FitnessActivity, FitnessActivityFeed, Profile, TeamFeed, User
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
13
14
15
|
# File 'lib/baby_tooth.rb', line 13
def configuration
@configuration
end
|
Class Method Details
.authorize_url(state = nil) ⇒ Object
15
16
17
|
# File 'lib/baby_tooth.rb', line 15
def authorize_url(state = nil)
oauth_client.auth_code.authorize_url :redirect_uri => configuration.redirect_uri, :state => state
end
|
19
20
21
22
|
# File 'lib/baby_tooth.rb', line 19
def configure
self.configuration ||= Configuration.new
yield self.configuration
end
|
.get_token(authorization_code) ⇒ Object
24
25
26
27
|
# File 'lib/baby_tooth.rb', line 24
def get_token(authorization_code)
oauth_client.auth_code.get_token(authorization_code,
:redirect_uri => configuration.redirect_uri).token
end
|
.oauth_client ⇒ Object
29
30
31
32
33
|
# File 'lib/baby_tooth.rb', line 29
def oauth_client
::OAuth2::Client.new configuration.client_id, configuration.client_secret,
:authorize_url => configuration.authorization_url,
:token_url => configuration.access_token_url
end
|