Sha256: 6d6657454d759b474b8d31dff43e9f62037c20c00996ce84e253d8b9652bcbb2
Contents?: true
Size: 979 Bytes
Versions: 2
Compression:
Stored size: 979 Bytes
Contents
require 'thanos/response_holder' require 'thanos/string_actions' require 'thanos/api/client' require 'thanos/factories/creator' require 'thanos/finders/finder_validator' module Thanos class CreatorFinder ATTRIBUTES = [:firstName, :middleName, :lastName, :suffix, :nameStartsWith, :firstNameStartsWith, :middleNameStartsWith, :lastNameStartsWith, :modifiedSince, :comics, :series, :events, :stories] 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(:creators, attribute) results = Thanos::ResponseHolder.new(response).results Thanos::Factory::Creator.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/creator_finder.rb |
thanos-0.5.0 | lib/thanos/finders/creator_finder.rb |