Class: Iframely::Model
- Inherits:
-
Hashie::Trash
- Object
- Hashie::Trash
- Iframely::Model
- Defined in:
- lib/iframely/model.rb
Class Method Summary collapse
Class Method Details
.build(json) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/iframely/model.rb', line 20 def self.build json if json.is_a? Hash if json.include?('error') Iframely::ErrorModel.new error: json['error'], json: json else new json end else Iframely::ErrorModel.new error: 'no data' end rescue StandardError => e Iframely::ErrorModel.new error: e., source: e end |