Module: Tictail::Api::Authenticate
- Included in:
- Client
- Defined in:
- lib/tictail/api/authenticate.rb
Instance Method Summary collapse
Instance Method Details
#authenticate(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tictail/api/authenticate.rb', line 4 def authenticate(params) params[:grant_type] = 'authorization_code' response = Faraday.post do |req| req.url 'https://tictail.com/oauth/token' req.headers['Content-Type'] = 'application/x-www-form-urlencoded' req.body = params.to_param end if response.status == 200 && response.body response_hash = Oj.load(response.body, mode: :compat) response_hash end end |