module GmanClient::Utility
Public Instance Methods
attempt(retry_count) { || ... }
click to toggle source
# File lib/gman_client/utility.rb, line 38 def attempt(retry_count) with_retries(max_tries: retry_count) { yield } end
convert_payload(response)
click to toggle source
# File lib/gman_client/utility.rb, line 32 def convert_payload(response) response.map do |hash_request| Hashie.symbolize_keys!(hash_request.to_h) end end
get(resource, params)
click to toggle source
# File lib/gman_client/utility.rb, line 5 def get(resource, params) request .api .v1 .send(resource) .get(params: params) end
request()
click to toggle source
# File lib/gman_client/utility.rb, line 13 def request Blanket.wrap( @url, extension: :json, headers: { 'Authorization' => "Bearer #{token}" } ) end
token()
click to toggle source
# File lib/gman_client/utility.rb, line 21 def token return @token if @token response = RestClient.post(@token_url, grant_type: 'client_credentials', client_id: @client_id, client_secret: @client_secret) @token = JSON.parse(response)['access_token'] end