Sha256: dc29cf219d8b0e136fb33a502735e6fd40b2e992700804e55116b2fd3390098b

Contents?: true

Size: 494 Bytes

Versions: 3

Compression:

Stored size: 494 Bytes

Contents

require 'httparty'
require 'active_support/core_ext/hash/indifferent_access'

module Conquiro
  module SearchAPI
    class Client
      include HTTParty
      base_uri 'https://itunes.apple.com'

      def query(params)
        params = strip_empty(params)
        response = self.class.get('/search', query: params)
        JSON.parse(response).with_indifferent_access
      end

      def strip_empty(params)
        params.select { |name, value| value.present? }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conquiro-0.0.3 lib/conquiro/search_api/client.rb
conquiro-0.0.2 lib/conquiro/search_api/client.rb
conquiro-0.0.1 lib/conquiro/search_api/client.rb