Class: Hyperion::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, filters, sorts, limit, offset) ⇒ Query

Returns a new instance of Query.



5
6
7
8
9
10
11
# File 'lib/hyperion/query.rb', line 5

def initialize(kind, filters, sorts, limit, offset)
  @kind = kind
  @filters = filters || []
  @sorts = sorts || []
  @limit = limit
  @offset = offset
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters.



3
4
5
# File 'lib/hyperion/query.rb', line 3

def filters
  @filters
end

#kindObject (readonly)

Returns the value of attribute kind.



3
4
5
# File 'lib/hyperion/query.rb', line 3

def kind
  @kind
end

#limitObject (readonly)

Returns the value of attribute limit.



3
4
5
# File 'lib/hyperion/query.rb', line 3

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



3
4
5
# File 'lib/hyperion/query.rb', line 3

def offset
  @offset
end

#sortsObject (readonly)

Returns the value of attribute sorts.



3
4
5
# File 'lib/hyperion/query.rb', line 3

def sorts
  @sorts
end

Instance Method Details

#to_hObject



13
14
15
16
17
18
19
20
21
# File 'lib/hyperion/query.rb', line 13

def to_h
  {
    :kind    => kind,
    :filters => filters.map(&:to_h),
    :sorts   => sorts.map(&:to_h),
    :limit   => limit,
    :offset  => offset
  }
end