module GrouponApi
Constants
- API_BASE
- API_KEY_FORMAT
- VERSION
Public Class Methods
config()
click to toggle source
GrouponApi
global settings
# File lib/groupon_api/config.rb, line 14 def self.config @config ||= GrouponApi::Configuration.new end
configure() { |config ||= configuration| ... }
click to toggle source
configure GrouponApi
global settings
GrouponApi.configure do |config| config.ts_token = 'US_AFF_0_201236_212556_0' config.debug = true end
# File lib/groupon_api/config.rb, line 9 def self.configure &block yield @config ||= GrouponApi::Configuration.new end
deals(params)
click to toggle source
# File lib/groupon_api/deals.rb, line 2 def self.deals(params) raise ::ArgumentError, 'param :ts_token cannot be nil' if GrouponApi.config.ts_token.nil? raise ::ArgumentError, 'param :ts_token must match /US_AFF_0_\d+_212556_0/' unless GrouponApi.config.ts_token.match(API_KEY_FORMAT) params.merge!(tsToken: GrouponApi.config.ts_token) params.merge!(GrouponApi.config.deals) if GrouponApi.config.deals.kind_of?(Hash) puts "#{__FILE__}:#{__LINE__} params: #{params}" if GrouponApi.config.debug GrouponApi::Request.call('deals', params)['deals'].collect{|deal| HashWithIndifferentAccess.new(deal)} end