Class: OrangeData::PayloadContent
- Inherits:
-
Object
- Object
- OrangeData::PayloadContent
show all
- Defined in:
- lib/orange_data/generated_attributes.rb
Overview
base class for semi-generated classes
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PayloadContent.
111
112
113
|
# File 'lib/orange_data/generated_attributes.rb', line 111
def initialize(payload={})
@payload = payload
end
|
Instance Method Details
#==(other) ⇒ Object
128
129
130
131
|
# File 'lib/orange_data/generated_attributes.rb', line 128
def ==(other)
self.class == other.class && to_hash == other.to_hash
end
|
#as_json ⇒ Object
137
138
139
|
# File 'lib/orange_data/generated_attributes.rb', line 137
def as_json
to_hash
end
|
#assign_attributes(options) ⇒ Object
115
116
117
118
119
120
121
122
|
# File 'lib/orange_data/generated_attributes.rb', line 115
def assign_attributes(options)
options.each_pair{|k, v|
setter = :"#{k}="
send(setter, v)
}
self
end
|
#attributes ⇒ Object
124
125
126
|
# File 'lib/orange_data/generated_attributes.rb', line 124
def attributes
to_hash.map{|(k, v)| [k.underscore, v] }.to_h
end
|
#to_hash ⇒ Object
133
134
135
|
# File 'lib/orange_data/generated_attributes.rb', line 133
def to_hash
@payload
end
|
#to_json(*args) ⇒ Object
141
142
143
|
# File 'lib/orange_data/generated_attributes.rb', line 141
def to_json(*args)
as_json.to_json(*args)
end
|