Class: Copyleaks::CopyleaksAuthToken

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/auth_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#accessTokenObject (readonly)

Returns the value of attribute accessToken.



26
27
28
# File 'lib/copyleaks/models/auth_token.rb', line 26

def accessToken
  @accessToken
end

#expiresObject (readonly)

Returns the value of attribute expires.



26
27
28
# File 'lib/copyleaks/models/auth_token.rb', line 26

def expires
  @expires
end

#issuedObject (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(*options)
  as_json(*options).to_json(*options)
end