Sha256: bea2b893940f902a9f3d15076598eaafe50923310133836ee7166f22433cf2fb
Contents?: true
Size: 660 Bytes
Versions: 2
Compression:
Stored size: 660 Bytes
Contents
module BookingSync class Base < ActiveResource::Base self.site = 'https://www.bookingsync.com' protected # Dynamic finder for attributes def self.method_missing(method, *args) if method.to_s =~ /^find_(all_)?by_([_a-zA-Z]\w*)$/ raise ArgumentError, "Dynamic finder method must take an argument." if args.empty? options = args.extract_options! resources = respond_to?(:find_all_across_pages) ? send(:find_all_across_pages, options) : send(:find, :all) resources.send($1 == 'all_' ? 'select' : 'detect') { |container| container.send($2) == args.first } else super end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bookingsync-0.3.0 | lib/bookingsync/base.rb |
bookingsync-0.2.0 | lib/bookingsync/base.rb |