module Abstraction::ClassMethods

Public Instance Methods

call_with_q(methods) click to toggle source
# File lib/uwapi/service/abstraction.rb, line 3
def call_with_q(methods)
  return unless methods.is_a?(Array)
  methods.each do |m|
    define_method(m) do |args|
      opt = {:service => __method__}
      if args.include?(:q)
        opt[:q] = args[:q]
      else
        raise ArgumentError, ':q is required'
      end

      opt[:term] = args[:term] if args.include?(:term)
      get(opt)
    end
  end
end
call_without_q(methods) click to toggle source
# File lib/uwapi/service/abstraction.rb, line 20
def call_without_q(methods)
  return unless methods.is_a?(Array)
  methods.each do |m|
    define_method(m) do
      opt = {:service => __method__}
      get(opt)
    end
  end
end