lib/rhapsody/client.rb in rhapsody-0.1.0 vs lib/rhapsody/client.rb in rhapsody-0.1.1

- old
+ new

@@ -2,10 +2,11 @@ attr_accessor :api_key, :api_secret, :redirect_uri, :username, :password, + :state, :auth_code, :authentication def initialize(options) # TODO: verify options @@ -18,10 +19,16 @@ @authentication = Rhapsody::Authentication.new({ client: self }) @authentication.password_grant end def authorization_url - Rhapsody::Request::HOST_URL + "/oauth/authorize?client_id=#{@api_key}&redirect_uri=#{@redirect_uri}&response_type=code" + 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 def connect @authentication = Rhapsody::Authentication.new({ client: self }) @authentication.connect