Class: OrangeData::PayloadContent

Inherits:
Object
  • Object
show all
Defined in:
lib/orange_data/generated_attributes.rb

Overview

base class for semi-generated classes

Instance Method Summary collapse

Constructor Details

#initialize(payload = {}) ⇒ PayloadContent

Returns a new instance of PayloadContent.



100
101
102
# File 'lib/orange_data/generated_attributes.rb', line 100

def initialize(payload={})
  @payload = payload
end

Instance Method Details

#==(other) ⇒ Object



113
114
115
116
# File 'lib/orange_data/generated_attributes.rb', line 113

def ==(other)
  self.class == other.class && to_hash == other.to_hash
  # @payload == other.instance_variable_get(:@payload)
end

#assign_attributes(options) ⇒ Object



104
105
106
107
108
109
110
111
# File 'lib/orange_data/generated_attributes.rb', line 104

def assign_attributes(options)
  options.each_pair{|k, v|
    setter = :"#{k}="
    send(setter, v)
  }
  # for chaining:
  self
end

#to_hashObject



118
119
120
# File 'lib/orange_data/generated_attributes.rb', line 118

def to_hash
  @payload
end

#to_json(*args) ⇒ Object



122
123
124
# File 'lib/orange_data/generated_attributes.rb', line 122

def to_json(*args)
  to_hash.to_json(*args)
end