Class: Verizon::ThingspaceOauth1Credentials
- Inherits:
-
Object
- Object
- Verizon::ThingspaceOauth1Credentials
- Defined in:
- lib/verizon/http/auth/thingspace_oauth_1.rb
Overview
Data class for ThingspaceOauth1Credentials.
Instance Attribute Summary collapse
-
#oauth_client_id ⇒ Object
readonly
Returns the value of attribute oauth_client_id.
-
#oauth_client_secret ⇒ Object
readonly
Returns the value of attribute oauth_client_secret.
-
#oauth_clock_skew ⇒ Object
readonly
Returns the value of attribute oauth_clock_skew.
-
#oauth_on_token_update ⇒ Object
readonly
Returns the value of attribute oauth_on_token_update.
-
#oauth_token ⇒ Object
readonly
Returns the value of attribute oauth_token.
-
#oauth_token_provider ⇒ Object
readonly
Returns the value of attribute oauth_token_provider.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(oauth_client_id: nil, oauth_client_secret: nil, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: nil) ⇒ Object
-
#initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: 0) ⇒ ThingspaceOauth1Credentials
constructor
A new instance of ThingspaceOauth1Credentials.
Constructor Details
#initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: 0) ⇒ ThingspaceOauth1Credentials
Returns a new instance of ThingspaceOauth1Credentials.
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 100 def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: 0) raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil? raise ArgumentError, 'oauth_client_secret cannot be nil' if oauth_client_secret.nil? @oauth_client_id = oauth_client_id @oauth_client_secret = oauth_client_secret @oauth_token = oauth_token @oauth_token_provider = oauth_token_provider @oauth_on_token_update = oauth_on_token_update @oauth_clock_skew = oauth_clock_skew end |
Instance Attribute Details
#oauth_client_id ⇒ Object (readonly)
Returns the value of attribute oauth_client_id.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_client_id @oauth_client_id end |
#oauth_client_secret ⇒ Object (readonly)
Returns the value of attribute oauth_client_secret.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_client_secret @oauth_client_secret end |
#oauth_clock_skew ⇒ Object (readonly)
Returns the value of attribute oauth_clock_skew.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_clock_skew @oauth_clock_skew end |
#oauth_on_token_update ⇒ Object (readonly)
Returns the value of attribute oauth_on_token_update.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_on_token_update @oauth_on_token_update end |
#oauth_token ⇒ Object (readonly)
Returns the value of attribute oauth_token.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_token @oauth_token end |
#oauth_token_provider ⇒ Object (readonly)
Returns the value of attribute oauth_token_provider.
97 98 99 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 97 def oauth_token_provider @oauth_token_provider end |
Class Method Details
.from_env ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 114 def self.from_env oauth_client_id = ENV['THINGSPACE_OAUTH_1_OAUTH_CLIENT_ID'] oauth_client_secret = ENV['THINGSPACE_OAUTH_1_OAUTH_CLIENT_SECRET'] oauth_clock_skew = ENV['THINGSPACE_OAUTH_1_OAUTH_CLOCK_SKEW'] all_nil = [ oauth_client_id, oauth_client_secret ].all?(&:nil?) return nil if all_nil new(oauth_client_id: oauth_client_id, oauth_client_secret: oauth_client_secret, oauth_clock_skew: oauth_clock_skew) end |
Instance Method Details
#clone_with(oauth_client_id: nil, oauth_client_secret: nil, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: nil) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/verizon/http/auth/thingspace_oauth_1.rb', line 129 def clone_with(oauth_client_id: nil, oauth_client_secret: nil, oauth_token: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: nil) oauth_client_id ||= self.oauth_client_id oauth_client_secret ||= self.oauth_client_secret oauth_token ||= self.oauth_token oauth_token_provider ||= self.oauth_token_provider oauth_on_token_update ||= self.oauth_on_token_update oauth_clock_skew ||= self.oauth_clock_skew ThingspaceOauth1Credentials.new( oauth_client_id: oauth_client_id, oauth_client_secret: oauth_client_secret, oauth_token: oauth_token, oauth_token_provider: oauth_token_provider, oauth_on_token_update: oauth_on_token_update, oauth_clock_skew: oauth_clock_skew ) end |