Class: EverSdk::Net::FieldAggregation
- Inherits:
-
Object
- Object
- EverSdk::Net::FieldAggregation
- Defined in:
- lib/ever_sdk_client/net.rb
Constant Summary collapse
- AGGREGATION_FN_VALUES =
[ :count, :min, :max, :sum, :average ]
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#fn ⇒ Object
readonly
Returns the value of attribute fn.
Instance Method Summary collapse
-
#initialize(field:, fn:) ⇒ FieldAggregation
constructor
A new instance of FieldAggregation.
- #to_h ⇒ Object
Constructor Details
#initialize(field:, fn:) ⇒ FieldAggregation
Returns a new instance of FieldAggregation.
157 158 159 160 161 162 163 |
# File 'lib/ever_sdk_client/net.rb', line 157 def initialize(field:, fn:) unless AGGREGATION_FN_VALUES.include?(fn) raise ArgumentError.new("aggregate function #{fn} doesn't exist; existing values: #{AGGREGATION_FN_VALUES}") end @field = field @fn = fn end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
155 156 157 |
# File 'lib/ever_sdk_client/net.rb', line 155 def field @field end |
#fn ⇒ Object (readonly)
Returns the value of attribute fn.
155 156 157 |
# File 'lib/ever_sdk_client/net.rb', line 155 def fn @fn end |
Instance Method Details
#to_h ⇒ Object
165 166 167 168 169 170 |
# File 'lib/ever_sdk_client/net.rb', line 165 def to_h { field: @field, fn: @fn.to_s.upcase } end |