Class: Gearhead::Actions::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/gearhead/actions/index.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gear, request) ⇒ Index

Returns a new instance of Index.



11
12
13
14
15
16
# File 'lib/gearhead/actions/index.rb', line 11

def initialize(gear, request)
  @gear = gear
  @request = request
  @collection = find_collection
  @serializer_options = {}
end

Instance Attribute Details

#gearObject (readonly)

Returns the value of attribute gear.



10
11
12
# File 'lib/gearhead/actions/index.rb', line 10

def gear
  @gear
end

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/gearhead/actions/index.rb', line 10

def request
  @request
end

Class Method Details

.build(gear, request) ⇒ Object



6
7
8
# File 'lib/gearhead/actions/index.rb', line 6

def self.build(gear, request)
  new(gear, request).build
end

Instance Method Details

#buildObject



18
19
20
21
22
23
24
25
# File 'lib/gearhead/actions/index.rb', line 18

def build
  @collection = apply_includes
  @collection = apply_scope
  @collection = apply_query
  @collection = apply_pagination
  @collection = apply_serializer
  @collection.to_json
end