Sha256: 544be74c03c577b7e1c6f503b33c732e70d3b568ce45a56b4a2c94df321e832e
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
module GmanClient module Utility def get(resource, params) request .api .v1 .send(resource) .get(params: params) end def request Blanket.wrap( @url, extension: :json, headers: { 'Authorization' => "Bearer #{token}" } ) end 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 def convert_payload(response) response.map do |hash_request| Hashie.symbolize_keys!(hash_request.to_h) end end def attempt(retry_count) with_retries(max_tries: retry_count) { yield } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gman_client-0.3.1 | lib/gman_client/utility.rb |
gman_client-0.3.0 | lib/gman_client/utility.rb |