Sha256: 56587f28d4b3afa75e4ec7930d23745816e57abbb2aa9bdb69cb18cae42de0d4

Contents?: true

Size: 458 Bytes

Versions: 1

Compression:

Stored size: 458 Bytes

Contents

module WhenIWork
  class Authentication < Resource

    class << self

      def login(username, password, api_key)
        response = client.post 'login' do |request|
          request.body = { username: username, password: password, key: api_key }
        end    

        if response.success? && response.body['token']
          response.body['token']
        else
          raise Error::AuthenticationFailedError
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
when-i-work-0.2.0 lib/when-i-work/authentication.rb