Class: Ecoportal::API::GraphQL::Input::SearchConf::DateRange
- Inherits:
-
Object
- Object
- Ecoportal::API::GraphQL::Input::SearchConf::DateRange
- Includes:
- Composable
- Defined in:
- lib/ecoportal/api/graphql/input/search_conf.rb
Overview
Filter: date_filter
Constant Summary collapse
- OPERATION =
'date_filter'.freeze
Instance Method Summary collapse
-
#initialize(key, gte: nil, lte: nil, time_zone: 'UTC') ⇒ DateRange
constructor
A new instance of DateRange.
- #substitute(subs) ⇒ Object
- #to_h ⇒ Object
Methods included from Composable
Constructor Details
#initialize(key, gte: nil, lte: nil, time_zone: 'UTC') ⇒ DateRange
Returns a new instance of DateRange.
103 104 105 106 107 108 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 103 def initialize(key, gte: nil, lte: nil, time_zone: 'UTC') @key = key.to_s @gte = gte @lte = lte @time_zone = time_zone end |
Instance Method Details
#substitute(subs) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 117 def substitute(subs) self.class.new( @key, gte: subs.fetch(:gte, @gte), lte: subs.fetch(:lte, @lte), time_zone: subs.fetch(:time_zone, @time_zone) ) end |
#to_h ⇒ Object
110 111 112 113 114 115 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 110 def to_h params = { key: @key, time_zone: @time_zone } params[:gte] = @gte if @gte params[:lte] = @lte if @lte { operation: OPERATION, params: params } end |