Sha256: 6adb9c998b2c45d675f590a5064dedffe2cf38f7f7c23c69ffd6d9e5f44343ec
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
require 'thanos/api/client' require 'thanos/response_holder' require 'thanos/factories/event' module Thanos class EventFinder ATTRIBUTES = [:name, :nameStartsWith, :modifiedSince, :creators, :series, :comics, :stories, :characters, :orderBy, :limit, :offset] ATTRIBUTES.each do |attribute| parameter = StringActions.parameterize(attribute.to_s) define_method("find_by_#{parameter}") do |attr| find("#{attribute}".to_sym => attr) end end private def find(attribute) FinderValidator.validate(attribute, ATTRIBUTES) response = Thanos::API::Client.new.get(:events, attribute) results = Thanos::ResponseHolder.new(response).results Thanos::Factory::Event.new(results).build end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thanos-0.6.0 | lib/thanos/finders/event_finder.rb |
thanos-0.5.0 | lib/thanos/finders/event_finder.rb |