Class: EchoCraft::ServiceObjects::Create

Inherits:
EchoCraft::ServiceObject show all
Defined in:
lib/echo_craft/service_objects/create.rb

Overview

Basic Response to Create a Record on ServiceObject

Instance Attribute Summary collapse

Attributes inherited from EchoCraft::ServiceObject

#record, #successful

Attributes inherited from Response

#data, #message, #status

Instance Method Summary collapse

Methods inherited from EchoCraft::ServiceObject

#set_service_successful

Methods inherited from Response

#change_status

Constructor Details

#initialize(params) ⇒ Create

Returns a new instance of Create.



10
11
12
13
14
# File 'lib/echo_craft/service_objects/create.rb', line 10

def initialize(params)
  super()
  @record = nil
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



8
9
10
# File 'lib/echo_craft/service_objects/create.rb', line 8

def params
  @params
end

Instance Method Details

#created(record) ⇒ Object



16
17
18
19
20
# File 'lib/echo_craft/service_objects/create.rb', line 16

def created(record)
  @record = record
  change_status(:created)
  set_service_successful
end

#unprocessabled(record) ⇒ Object



22
23
24
25
# File 'lib/echo_craft/service_objects/create.rb', line 22

def unprocessabled(record)
  @record = record
  super()
end