Class: EwayRapid::InternalModels::Option
- Inherits:
-
Object
- Object
- EwayRapid::InternalModels::Option
- Defined in:
- lib/eway_rapid/models/internal_models.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
- .from_array(array) ⇒ Object
- .from_hash(hash) ⇒ Object
- .from_json(json) ⇒ Object
- .to_array(array) ⇒ Object
- .to_hash(option) ⇒ Object
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
147 148 149 |
# File 'lib/eway_rapid/models/internal_models.rb', line 147 def value @value end |
Class Method Details
.from_array(array) ⇒ Object
181 182 183 184 185 186 187 188 |
# File 'lib/eway_rapid/models/internal_models.rb', line 181 def self.from_array(array) = [] array.each {|option_hash| obj = Option.from_hash(option_hash) .push(obj) } end |
.from_hash(hash) ⇒ Object
175 176 177 178 179 |
# File 'lib/eway_rapid/models/internal_models.rb', line 175 def self.from_hash(hash) option = Option.new option.value = hash[Constants::VALUE] option end |
.from_json(json) ⇒ Object
170 171 172 173 |
# File 'lib/eway_rapid/models/internal_models.rb', line 170 def self.from_json(json) hash = JSON.parse(json) from_hash(hash) end |
.to_array(array) ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/eway_rapid/models/internal_models.rb', line 157 def self.to_array(array) = [] if array array.each {|option_hash| if option_hash obj = Option.to_hash(option_hash) .push(obj) end } end end |
.to_hash(option) ⇒ Object
149 150 151 152 153 154 155 |
# File 'lib/eway_rapid/models/internal_models.rb', line 149 def self.to_hash(option) hash = {} if option hash[Constants::VALUE] = option.value if option.value end hash end |