Class: Hcp::Filter
- Inherits:
-
Object
- Object
- Hcp::Filter
- Defined in:
- lib/hcp/filter.rb
Overview
One condition a list is narrowed by, as the parameters Housecall Pro takes it as.
Instance Method Summary collapse
-
#initialize(bounds:, value:) ⇒ Filter
constructor
A new instance of Filter.
-
#params ⇒ Hash
The parameters to send, without the end the caller left open.
Constructor Details
#initialize(bounds:, value:) ⇒ Filter
Returns a new instance of Filter.
6 7 8 9 |
# File 'lib/hcp/filter.rb', line 6 def initialize(bounds:, value:) @bounds = bounds @value = value end |
Instance Method Details
#params ⇒ Hash
Returns the parameters to send, without the end the caller left open.
12 13 14 15 16 17 18 |
# File 'lib/hcp/filter.rb', line 12 def params return { @bounds.first => @value } unless @value.is_a? Range refuse low, high = @bounds { low => stamp(@value.begin), high => stamp(@value.end) }.compact end |