Module: Hcp::Chainable
- Included in:
- Relation
- Defined in:
- lib/hcp/concerns/chainable.rb
Overview
Extends a list with the chaining that narrows, orders and cuts it.
Instance Method Summary collapse
-
#includes(*names) ⇒ Relation
The same list, asking Housecall Pro for these beside each record.
-
#limit(count) ⇒ Relation
The same list, stopping after this many records.
-
#order(**sorts) ⇒ Relation
The same list, in this order.
-
#where(**conditions) ⇒ Relation
A condition Housecall Pro does not take is one it ignores, answering the whole account rather than a page of it, so an unknown one is refused here where it can still be named.
Instance Method Details
#includes(*names) ⇒ Relation
Returns the same list, asking Housecall Pro for these beside each record.
22 23 24 25 |
# File 'lib/hcp/concerns/chainable.rb', line 22 def includes(*names) only names, @type. narrowed expands: @expands | names end |
#limit(count) ⇒ Relation
Returns the same list, stopping after this many records.
19 |
# File 'lib/hcp/concerns/chainable.rb', line 19 def limit(count) = narrowed limit: count |
#order(**sorts) ⇒ Relation
Returns the same list, in this order.
13 14 15 16 |
# File 'lib/hcp/concerns/chainable.rb', line 13 def order(**sorts) only sorts.keys, @type.sorts narrowed sorts: sorts end |
#where(**conditions) ⇒ Relation
A condition Housecall Pro does not take is one it ignores, answering the whole account rather than a page of it, so an unknown one is refused here where it can still be named.
7 8 9 10 |
# File 'lib/hcp/concerns/chainable.rb', line 7 def where(**conditions) only conditions.keys, @type.filters.keys narrowed conditions: @conditions.merge(conditions) end |