Class: API::Author
- Inherits:
-
Object
- Object
- API::Author
- Defined in:
- lib/quintype/api/author.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(author) ⇒ Author
constructor
A new instance of Author.
- #to_h(config = {}) ⇒ Object
Constructor Details
#initialize(author) ⇒ Author
Returns a new instance of Author.
32 33 34 |
# File 'lib/quintype/api/author.rb', line 32 def initialize() @author = end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
3 4 5 |
# File 'lib/quintype/api/author.rb', line 3 def @author end |
Class Method Details
.find(params) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/quintype/api/author.rb', line 24 def find(params) if = API.({ids: params}).presence = .first wrap() end end |
.where(params) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/quintype/api/author.rb', line 16 def where(params) if params['ids'].kind_of? Array params['ids'] = params['ids'].join "," end = API.(params) wrap_all() end |
.wrap(author) ⇒ Object
12 13 14 |
# File 'lib/quintype/api/author.rb', line 12 def wrap() new() if end |
.wrap_all(authors) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/quintype/api/author.rb', line 5 def wrap_all() ||= [] .is_a?(Array) ? .map { |a| wrap(a) } : wrap() end |
Instance Method Details
#to_h(config = {}) ⇒ Object
36 37 38 |
# File 'lib/quintype/api/author.rb', line 36 def to_h(config={}) end |