Class: Onsi::ParamsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/onsi/params_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, attributes, relationships) ⇒ ParamsParser

Returns a new instance of ParamsParser.



10
11
12
13
14
15
# File 'lib/onsi/params_parser.rb', line 10

def initialize(params, attributes, relationships)
  @data = params.require(:data)
  @included = params.fetch(:included, [])
  @attributes = attributes
  @relationships = relationships
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/onsi/params_parser.rb', line 7

def attributes
  @attributes
end

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/onsi/params_parser.rb', line 5

def data
  @data
end

#includedObject (readonly)

Returns the value of attribute included.



6
7
8
# File 'lib/onsi/params_parser.rb', line 6

def included
  @included
end

#relationshipsObject (readonly)

Returns the value of attribute relationships.



8
9
10
# File 'lib/onsi/params_parser.rb', line 8

def relationships
  @relationships
end

Instance Method Details

#parse!Object



17
18
19
20
# File 'lib/onsi/params_parser.rb', line 17

def parse!
  operation = Onsi::ParamsParseOperation.new(data, attributes, relationships, included)
  operation.perform
end