class Cloverrb::Client
Constants
- AUTH_URL
- BASE_URL
Public Class Methods
generate_access_token(client_id, code, app_secret)
click to toggle source
# File lib/cloverrb/client.rb, line 26 def self.generate_access_token(client_id, code, app_secret) query = build_query(client_id, code, app_secret) HTTParty.get(AUTH_URL, query: query) end
Private Class Methods
build_query(client_id, code, app_secret)
click to toggle source
# File lib/cloverrb/client.rb, line 37 def self.build_query(client_id, code, app_secret) { "client_id" => client_id, "client_secret" => app_secret, "code" => code } end
Public Instance Methods
get(token, path)
click to toggle source
# File lib/cloverrb/client.rb, line 6 def get(token, path) HTTParty.get(BASE_URL + path, headers: build_headers(token)).parsed_response end
post(token, path, body)
click to toggle source
# File lib/cloverrb/client.rb, line 10 def post(token, path, body) HTTParty.post( BASE_URL + path, headers: build_headers(token), query: body ).parsed_response end
put(token, path, body)
click to toggle source
# File lib/cloverrb/client.rb, line 18 def put(token, path, body) HTTParty.put( BASE_URL + path, headers: build_headers(token), query: body ).parsed_response end
Private Instance Methods
build_headers(token)
click to toggle source
# File lib/cloverrb/client.rb, line 33 def build_headers(token) { "Authorization" => "Bearer #{token}"} end