class Rhapsody::Client

Attributes

api_key[RW]
api_secret[RW]
auth_code[RW]
authentication[RW]
password[RW]
redirect_uri[RW]
state[RW]
username[RW]

Public Class Methods

new(options) click to toggle source
# File lib/rhapsody/client.rb, line 11
def initialize(options)
  # TODO: verify options
  options.each do |name, value|
    instance_variable_set("@#{name}", value)
  end
end

Public Instance Methods

authorization_url() click to toggle source
# File lib/rhapsody/client.rb, line 23
def authorization_url
  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() click to toggle source
# File lib/rhapsody/client.rb, line 33
def connect
  @authentication = Rhapsody::Authentication.new({ client: self })
  @authentication.connect
end
password_grant() click to toggle source
# File lib/rhapsody/client.rb, line 18
def password_grant
  @authentication = Rhapsody::Authentication.new({ client: self })
  @authentication.password_grant
end
renew() click to toggle source
# File lib/rhapsody/client.rb, line 38
def renew
  if @authentication
    @authentication.renew
  end
  # TODO Need to handle, authentication
end