lib/todoable_api/sessionable.rb
# Handle the auth response, extracting the information we require and store
# in the instance variable
# Otherwise, store a blank token hash
Handle the auth response, extracting the information we require and store
in the instance variable
Otherwise, store a blank token hash
Handle the auth response extracting the information we require and store in the instance variable Otherwise store a blank token hash
def handle_auth_response(response)
      @auth_token = {}
      begin
        response = JSON.parse(response.body)
        @auth_token[:token] = response["token"]
        @auth_token[:expires_at] = DateTime.parse(response["expires_at"])
      rescue JSON::ParserError, TypeError
        @auth_token = {}
      end
    end
def handle_auth_response ( response ) @auth_token = { } begin response = JSON . parse ( response . body ) @auth_token [ :token ] = response [ "token" ] @auth_token [ :expires_at ] = DateTime . parse ( response [ "expires_at" ] ) rescue JSON :: ParserError , TypeError @auth_token = { } end end
Handle the auth response, extracting the information we require and store
in the instance variable
Otherwise, store a blank token hash
Handle the auth response extracting the information we require and store in the instance variable Otherwise store a blank token hash
# TODO: Fix this to handle error cases
response