Module: Vm::Authenticable
Overview
Provides methods to authenticate as an account (either Vimeo or Vimeo).
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#credentials ⇒ Hash
Return the authorization credentials of an account for this app.
-
#initialize(attrs = {}) ⇒ Object
Initialize an object with either an authorization code or a refresh token.
Methods included from Requestable
Methods included from ClientTokens
#client_id, client_id=, #client_secret, client_secret=
Instance Method Details
#credentials ⇒ Hash
Return the authorization credentials of an account for this app.
34 35 36 37 38 39 40 |
# File 'lib/vm/authenticable.rb', line 34 def credentials @credentials ||= request! method: :post, host: 'https://accounts.google.com', path: '/o/oauth2/token', body: credentials_params, valid_if: -> response, body {response.code == '200'} end |
#initialize(attrs = {}) ⇒ Object
Initialize an object with either an authorization code or a refresh token
20 21 22 23 24 |
# File 'lib/vm/authenticable.rb', line 20 def initialize(attrs = {}) @code = attrs[:code] @refresh_token = attrs[:refresh_token] @redirect_url = attrs.fetch :redirect_url, 'http://example.com/' end |