Class: JSONAPI::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation_type, resource_klass, options) ⇒ Operation

Returns a new instance of Operation.


5
6
7
8
9
# File 'lib/jsonapi/operation.rb', line 5

def initialize(operation_type, resource_klass, options)
  @operation_type = operation_type
  @resource_klass = resource_klass
  @options = options
end

Instance Attribute Details

#operation_typeObject (readonly)

Returns the value of attribute operation_type


3
4
5
# File 'lib/jsonapi/operation.rb', line 3

def operation_type
  @operation_type
end

#optionsObject (readonly)

Returns the value of attribute options


3
4
5
# File 'lib/jsonapi/operation.rb', line 3

def options
  @options
end

#resource_klassObject (readonly)

Returns the value of attribute resource_klass


3
4
5
# File 'lib/jsonapi/operation.rb', line 3

def resource_klass
  @resource_klass
end

Instance Method Details

#processObject


15
16
17
# File 'lib/jsonapi/operation.rb', line 15

def process
  processor.process
end

#transactional?Boolean

Returns:

  • (Boolean)

11
12
13
# File 'lib/jsonapi/operation.rb', line 11

def transactional?
  JSONAPI::Processor._processor_from_resource_type(resource_klass).transactional_operation_type?(operation_type)
end