Class: Imgurz::Token
- Inherits:
-
Struct
- Object
- Struct
- Imgurz::Token
- Defined in:
- lib/imgurz/token.rb
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
Instance Method Summary collapse
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id
8 9 10 |
# File 'lib/imgurz/token.rb', line 8 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret
8 9 10 |
# File 'lib/imgurz/token.rb', line 8 def client_secret @client_secret end |
Instance Method Details
#refresh(refresh_token) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/imgurz/token.rb', line 10 def refresh(refresh_token) uri = URI.parse Imgurz::TOKEN_ENDPOINT http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new uri.path request.set_form_data({ refresh_token: refresh_token, client_id: client_id, client_secret: client_secret, grant_type: 'refresh_token' }) response = http.request(request) JSON.parse response.body end |