Class: JSONAPI::OperationResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, options = {}) ⇒ OperationResult

Returns a new instance of OperationResult.


9
10
11
12
13
14
15
# File 'lib/jsonapi/operation_result.rb', line 9

def initialize(code, options = {})
  @code = Rack::Utils.status_code(code)
  @options = options
  @meta = options.fetch(:meta, {})
  @links = options.fetch(:links, {})
  @warnings = options.fetch(:warnings, {})
end

Instance Attribute Details

#codeObject

Returns the value of attribute code


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

def code
  @code
end

Returns the value of attribute links


5
6
7
# File 'lib/jsonapi/operation_result.rb', line 5

def links
  @links
end

#metaObject

Returns the value of attribute meta


4
5
6
# File 'lib/jsonapi/operation_result.rb', line 4

def meta
  @meta
end

#optionsObject

Returns the value of attribute options


6
7
8
# File 'lib/jsonapi/operation_result.rb', line 6

def options
  @options
end

#warningsObject

Returns the value of attribute warnings


7
8
9
# File 'lib/jsonapi/operation_result.rb', line 7

def warnings
  @warnings
end

Instance Method Details

#to_hash(serializer = nil) ⇒ Object


17
18
19
# File 'lib/jsonapi/operation_result.rb', line 17

def to_hash(serializer = nil)
  {}
end