Class: HOALife::Violation

Inherits:
Resource show all
Includes:
Resources::HasNestedObject, Resources::Persistable
Defined in:
lib/hoalife/violation.rb

Overview

:nodoc

Constant Summary

Constants included from Arrayable

Arrayable::BLANK_RE

Instance Attribute Summary

Attributes inherited from Resource

#attrs

Instance Method Summary collapse

Methods inherited from Resource

#==, #initialize, #method_missing, new, resource_collection, #respond_to?, #to_json

Methods included from Arrayable

#as_array

Constructor Details

This class inherits a constructor from HOALife::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HOALife::Resource

Instance Method Details

#as_jsonObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hoalife/violation.rb', line 13

def as_json
  h = super

  h.dig('data', 'relationships').merge!(
    'property' => { 'data' => { 'id' => property_id } },
    'ccr_violation_type' => { 'data' => { 'id' => ccr_violation_type_id } },
    'inspector' => { 'data' => { 'email' => inspector_email } }
  )

  h
end