lib/ketra/client.rb
# Sets the access token, must supply either the access token, the authorization code,
# or the Design Studio Username and Password 
#
# @param [Hash] credentials
# @option credentials [String] :token previously gained access token value
# @option credentials [String] :authorization_code code value from the Ketra OAuth2 provider
# @option credentials [String] :username Ketra Desiadgn Studio username
# @option credentials [String] :password Design Studio password
# @return [OAuth2::AccessToken] Access Token object
Sets the access token, must supply either the access token, the authorization code,
or the Design Studio Username and Password
Sets the access token must supply either the access token the authorization code or the Design Studio Username and Password
def authorize(credentials)
      if credentials.key?(:token)
        @access_token = OAuth2::AccessToken.new(auth_client, credentials[:token])
      elsif credentials.key?(:authorization_code)
        @access_token = auth_client.auth_code.get_token(credentials[:authorization_code],
                                                        :redirect_uri => options[:redirect_uri])
      elsif credentials.key?(:username)
        @access_token = auth_client.password.get_token(credentials[:username],
                                                       credentials[:password])
      end
    end
def authorize ( credentials ) if credentials . key? ( :token ) @access_token = OAuth2 :: AccessToken . new ( auth_client , credentials [ :token ] ) elsif credentials . key? ( :authorization_code ) @access_token = auth_client . auth_code . get_token ( credentials [ :authorization_code ] , :redirect_uri => options [ :redirect_uri ] ) elsif credentials . key? ( :username ) @access_token = auth_client . password . get_token ( credentials [ :username ] , credentials [ :password ] ) end end
Sets the access token, must supply either the access token, the authorization code,
or the Design Studio Username and Password
Sets the access token must supply either the access token the authorization code or the Design Studio Username and Password
Access Token object
Access Token object
OAuth2::AccessToken
credentials
:password Design Studio password
: password Design Studio password
None