Class: Myoack::OAuth2Config
- Defined in:
- lib/myoack/key_config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#access_token_url ⇒ Object
Optional Example: “github.com/login/oauth/access_token” Default: “#@site/oauth/access_token”.
-
#authorize_url ⇒ Object
Optional Example: “github.com/login/oauth/authorize” Default: “#@site/oauth/authorize”.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#site ⇒ Object
Required Example: “github.com/login”.
Attributes inherited from KeyConfig
Instance Method Summary collapse
Methods inherited from KeyConfig
config_defaults, default, id, #initialize, type
Constructor Details
This class inherits a constructor from Myoack::KeyConfig
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
161 162 163 |
# File 'lib/myoack/key_config.rb', line 161 def access_token @access_token end |
#access_token_url ⇒ Object
Optional Example: “github.com/login/oauth/access_token” Default: “#@site/oauth/access_token”
132 133 134 |
# File 'lib/myoack/key_config.rb', line 132 def access_token_url @access_token_url end |
#authorize_url ⇒ Object
Optional Example: “github.com/login/oauth/authorize” Default: “#@site/oauth/authorize”
124 125 126 |
# File 'lib/myoack/key_config.rb', line 124 def @authorize_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
159 160 161 |
# File 'lib/myoack/key_config.rb', line 159 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
160 161 162 |
# File 'lib/myoack/key_config.rb', line 160 def client_secret @client_secret end |
#site ⇒ Object
Required Example: “github.com/login”
119 120 121 |
# File 'lib/myoack/key_config.rb', line 119 def site @site end |
Instance Method Details
#authorize! ⇒ Object
137 138 139 140 |
# File 'lib/myoack/key_config.rb', line 137 def url = "http://%s:%s/oauth2/authorize?id=#{id}" % [LocalAuthorization::HOST, LocalAuthorization::PORT] `open "#{url}"` end |
#save ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/myoack/key_config.rb', line 142 def save cfg = config.load_keys_file cfg[id] = { 'site' => site, 'authorize_url' => , 'access_token_url' => access_token_url, 'client_id' => client_id, 'client_secret' => client_secret, 'access_token' => access_token } config.dump_config_file cfg end |
#save! ⇒ Object
155 156 157 |
# File 'lib/myoack/key_config.rb', line 155 def save! save end |