Class: Justa::Client
Overview
Class to hold client authetication data
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#default ⇒ Object
Returns the value of attribute default.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#expire_at ⇒ Object
readonly
Returns the value of attribute expire_at.
-
#integrator_id ⇒ Object
readonly
Returns the value of attribute integrator_id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Client
constructor
Initialize Client instance.
-
#to_h ⇒ Hash
Convert Client instance to hash.
Constructor Details
#initialize(**options) ⇒ Client
Initialize Client instance
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/justa/authenticator.rb', line 24 def initialize(**) @username = .fetch(:username, Justa.username) @password = .fetch(:password, Justa.password) @client_id = .fetch(:client_id, Justa.client_id) @client_secret = .fetch(:client_secret, Justa.client_secret) @integrator_id = .fetch(:integrator_id, Justa.integrator_id) @key = Justa::Util.to_sym(.fetch(:key, .fetch(:document, nil) || Justa.default_client_key)) @default = .fetch(:default, true) @document = .fetch(:document, Justa.document) @token = .fetch(:token) rescue KeyError => e end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def client_secret @client_secret end |
#default ⇒ Object
Returns the value of attribute default.
10 11 12 |
# File 'lib/justa/authenticator.rb', line 10 def default @default end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def document @document end |
#expire_at ⇒ Object (readonly)
Returns the value of attribute expire_at.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def expire_at @expire_at end |
#integrator_id ⇒ Object (readonly)
Returns the value of attribute integrator_id.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def integrator_id @integrator_id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def key @key end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def token @token end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
9 10 11 |
# File 'lib/justa/authenticator.rb', line 9 def username @username end |
Instance Method Details
#to_h ⇒ Hash
Convert Client instance to hash
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/justa/authenticator.rb', line 43 def to_h { username: @username, password: @password, client_id: @client_id, token: @token, document: @document, key: @key } end |