Class: Copyleaks::CopyleaksAuthToken
- Inherits:
-
Object
- Object
- Copyleaks::CopyleaksAuthToken
- Defined in:
- lib/copyleaks/models/auth_token.rb
Instance Attribute Summary collapse
-
#accessToken ⇒ Object
readonly
Returns the value of attribute accessToken.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#issued ⇒ Object
readonly
Returns the value of attribute issued.
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(expires, accessToken, issued) ⇒ CopyleaksAuthToken
constructor
A new instance of CopyleaksAuthToken.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(expires, accessToken, issued) ⇒ CopyleaksAuthToken
Returns a new instance of CopyleaksAuthToken.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/copyleaks/models/auth_token.rb', line 28 def initialize(expires, accessToken, issued) unless expires.instance_of?(String) raise 'Copyleaks::CopyleaksAuthToken - expires - expires must be of type String' end unless accessToken.instance_of?(String) raise 'Copyleaks::CopyleaksAuthToken - accessToken - accessToken must be of type String' end raise 'Copyleaks::CopyleaksAuthToken - issued - issued must be of type String' unless issued.instance_of?(String) @expires = expires @accessToken = accessToken @issued = issued end |
Instance Attribute Details
#accessToken ⇒ Object (readonly)
Returns the value of attribute accessToken.
26 27 28 |
# File 'lib/copyleaks/models/auth_token.rb', line 26 def accessToken @accessToken end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
26 27 28 |
# File 'lib/copyleaks/models/auth_token.rb', line 26 def expires @expires end |
#issued ⇒ Object (readonly)
Returns the value of attribute issued.
26 27 28 |
# File 'lib/copyleaks/models/auth_token.rb', line 26 def issued @issued end |
Instance Method Details
#as_json(*_args) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/copyleaks/models/auth_token.rb', line 42 def as_json(*_args) { expires: @expires, issued: @issued, accessToken: @accessToken }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
50 51 52 |
# File 'lib/copyleaks/models/auth_token.rb', line 50 def to_json(*) as_json(*).to_json(*) end |