class Monstercat::Client
Constants
- API_PREFIX
Public Class Methods
new(endpoint=nil)
click to toggle source
# File lib/monstercat/client.rb, line 9 def initialize(endpoint=nil) @endpoint ||= endpoint end
Public Instance Methods
endpoint(endpoint=nil)
click to toggle source
# File lib/monstercat/client.rb, line 13 def endpoint(endpoint=nil) @endpoint ||= endpoint if endpoint unless endpoint then "/#{API_PREFIX}/#{@endpoint}" end end
process_options(options = {})
click to toggle source
# File lib/monstercat/client.rb, line 21 def process_options(options = {}) new_options = options if options.has_key? :fields then if options[:fields].class == Array then new_options[:fields] = options[:fields].join(",") end end if options.has_key? :ids then if options[:ids].class == Array then new_options[:ids] = options[:ids].join(",") end end if options.has_key? :fuzzy then if options[:fuzzy].class == Hash then new_options[:fuzzy] = options[:fuzzy].to_a.flatten.join(",") end end if options.has_key? :filter then if options[:filter].class == Hash then new_options[:filter] = options[:filter].to_a.flatten.join(",") end end return { query: new_options } end