Class: Hitch::Client::Credentials

Inherits:
Object
  • Object
show all
Defined in:
app/models/hitch/client/credentials.rb

Defined Under Namespace

Classes: SerializationForbidden

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, client_secret:) ⇒ Credentials

Returns a new instance of Credentials.



10
11
12
13
14
# File 'app/models/hitch/client/credentials.rb', line 10

def initialize(client:, client_secret:)
  @client = client
  @client_secret = client_secret.to_s.dup.freeze
  freeze
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'app/models/hitch/client/credentials.rb', line 8

def client
  @client
end

#client_secretObject (readonly)

Returns the value of attribute client_secret.



8
9
10
# File 'app/models/hitch/client/credentials.rb', line 8

def client_secret
  @client_secret
end

Instance Method Details

#as_jsonObject



26
# File 'app/models/hitch/client/credentials.rb', line 26

def as_json(*) = to_h

#inspectObject Also known as: to_s



16
17
18
# File 'app/models/hitch/client/credentials.rb', line 16

def inspect
  %(#<#{self.class.name} client_id=#{client.client_id.inspect} client_secret="[FILTERED]">)
end

#to_hObject



22
23
24
# File 'app/models/hitch/client/credentials.rb', line 22

def to_h(*)
  raise SerializationForbidden, "one-time client credentials cannot be serialized"
end

#to_jsonObject



27
# File 'app/models/hitch/client/credentials.rb', line 27

def to_json(*) = to_h