Class: Gearhead::Actions::Create

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gear, request) ⇒ Create

Returns a new instance of Create.



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

def initialize(gear, request)
  @gear = gear
  @request = request
  @resource = new_resource
end

Instance Attribute Details

#gearObject (readonly)

Returns the value of attribute gear.



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

def gear
  @gear
end

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
end

#resourceObject (readonly)

Returns the value of attribute resource.



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

def resource
  @resource
end

Class Method Details

.build(gear, request) ⇒ Object



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

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

Instance Method Details

#buildObject



17
18
19
20
21
# File 'lib/gearhead/actions/create.rb', line 17

def build
  params = ParamsBuilder.new(self).for(:create)
  @resource.assign_attributes(params)
  @resource
end