Class: Zara4::API::Communication::Grant::PasswordGrant

Inherits:
GrantRequest
  • Object
show all
Defined in:
lib/zara4/api/communication/grant/password_grant.rb

Instance Attribute Summary collapse

Attributes inherited from GrantRequest

#client_id, #client_secret, #scopes

Instance Method Summary collapse

Methods inherited from GrantRequest

#get_tokens, #with_image_processing, #with_usage

Constructor Details

#initialize(client_id, client_secret, username, password, scopes) ⇒ PasswordGrant

Returns a new instance of PasswordGrant.



7
8
9
10
11
# File 'lib/zara4/api/communication/grant/password_grant.rb', line 7

def initialize(client_id, client_secret, username, password, scopes)
  super(client_id, client_secret, scopes)
  @username = username
  @password = password
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



4
5
6
# File 'lib/zara4/api/communication/grant/password_grant.rb', line 4

def password
  @password
end

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/zara4/api/communication/grant/password_grant.rb', line 4

def username
  @username
end

Instance Method Details

#dataObject

Data to be sent when fetching grant tokens.



25
26
27
28
29
30
# File 'lib/zara4/api/communication/grant/password_grant.rb', line 25

def data
  data = super.data
  data['username'] = @username
  data['password'] = @password
  return data
end

#grant_typeObject

The type of this grant.



17
18
19
# File 'lib/zara4/api/communication/grant/password_grant.rb', line 17

def grant_type
  return 'password'
end