Sha256: c70df8888fa63cadec9230ec5fe1cf3f05a40fda18e1b76546702bba2264bfd7
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
require 'active_resource' 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.1.1 | lib/bookingsync/base.rb |
bookingsync-0.1.0 | lib/bookingsync/base.rb |