Class: AlexaRuby::User

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa_ruby/request/base_request/user.rb

Overview

Amazon Alexa user

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ User

Initialize new user

Parameters:

  • user (Hash)

    user parameters

Raises:

  • (ArgumentError)

    if user ID is nil



10
11
12
13
14
15
16
# File 'lib/alexa_ruby/request/base_request/user.rb', line 10

def initialize(user)
  raise ArgumentError, 'Missing user ID' if user[:userId].nil?
  @id = user[:userId]
  @access_token = user[:accessToken] unless user[:accessToken].nil?
  return if user[:permissions].nil?
  @permissions_token = permissions(user[:permissions])
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



4
5
6
# File 'lib/alexa_ruby/request/base_request/user.rb', line 4

def access_token
  @access_token
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/alexa_ruby/request/base_request/user.rb', line 4

def id
  @id
end

#permissions_tokenObject (readonly)

Returns the value of attribute permissions_token.



4
5
6
# File 'lib/alexa_ruby/request/base_request/user.rb', line 4

def permissions_token
  @permissions_token
end