Class: Rhapsody::Client
- Inherits:
-
Object
- Object
- Rhapsody::Client
- Defined in:
- lib/rhapsody/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#auth_code ⇒ Object
Returns the value of attribute auth_code.
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#password ⇒ Object
Returns the value of attribute password.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#state ⇒ Object
Returns the value of attribute state.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #authorization_url ⇒ Object
- #connect ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #password_grant ⇒ Object
- #renew ⇒ Object
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/rhapsody/client.rb', line 11 def initialize() # TODO: verify options .each do |name, value| instance_variable_set("@#{name}", value) end end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def api_secret @api_secret end |
#auth_code ⇒ Object
Returns the value of attribute auth_code.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def auth_code @auth_code end |
#authentication ⇒ Object
Returns the value of attribute authentication.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def authentication @authentication end |
#password ⇒ Object
Returns the value of attribute password.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def password @password end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def redirect_uri @redirect_uri end |
#state ⇒ Object
Returns the value of attribute state.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def state @state end |
#username ⇒ Object
Returns the value of attribute username.
2 3 4 |
# File 'lib/rhapsody/client.rb', line 2 def username @username end |
Instance Method Details
#authorization_url ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rhapsody/client.rb', line 23 def default = Rhapsody::Request::HOST_URL + "/oauth/authorize?client_id=#{@api_key}&redirect_uri=#{@redirect_uri}&response_type=code" if @state default + "&state=#{@state}" else default end end |
#connect ⇒ Object
33 34 35 36 |
# File 'lib/rhapsody/client.rb', line 33 def connect @authentication = Rhapsody::Authentication.new({ client: self }) @authentication.connect end |
#password_grant ⇒ Object
18 19 20 21 |
# File 'lib/rhapsody/client.rb', line 18 def password_grant @authentication = Rhapsody::Authentication.new({ client: self }) @authentication.password_grant end |
#renew ⇒ Object
38 39 40 41 42 43 |
# File 'lib/rhapsody/client.rb', line 38 def renew if @authentication @authentication.renew end # TODO Need to handle, authentication end |