class API::Author
Attributes
Public Class Methods
find(params)
click to toggle source
# File lib/quintype/api/author.rb, line 24 def find(params) if authors = API.authors({ids: params}).presence author = authors.first wrap(author) end end
new(author)
click to toggle source
# File lib/quintype/api/author.rb, line 32 def initialize(author) @author = author end
where(params)
click to toggle source
# File lib/quintype/api/author.rb, line 16 def where(params) if params['ids'].kind_of? Array params['ids'] = params['ids'].join "," end authors = API.authors(params) wrap_all(authors) end
wrap(author)
click to toggle source
# File lib/quintype/api/author.rb, line 12 def wrap(author) new(author) if author end
wrap_all(authors)
click to toggle source
# File lib/quintype/api/author.rb, line 5 def wrap_all(authors) authors ||= [] authors.is_a?(Array) ? authors.map { |a| wrap(a) } : wrap(authors) end
Public Instance Methods
to_h(config={})
click to toggle source
# File lib/quintype/api/author.rb, line 36 def to_h(config={}) author end