Module: Brickset::Api::Auth

Included in:
Client
Defined in:
lib/brickset/api/auth.rb

Instance Method Summary collapse

Instance Method Details

#login(username, password) ⇒ Object



5
6
7
8
# File 'lib/brickset/api/auth.rb', line 5

def (username, password)
  xml = call('/login', username: username, password: password)
  HappyMapper.parse(xml).content
end

#valid_api_key?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/brickset/api/auth.rb', line 10

def valid_api_key?
  xml = call('/checkKey')
  HappyMapper.parse(xml).content == 'OK'
end

#valid_token?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/brickset/api/auth.rb', line 15

def valid_token?
  xml = call('/checkUserHash')
  HappyMapper.parse(xml).content != 'INVALID'
end