Module: Abstraction::ClassMethods
- Included in:
- Abstraction
- Defined in:
- lib/uwapi/service/abstraction.rb
Instance Method Summary collapse
Instance Method Details
#call_with_q(methods) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# 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) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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 |