Class: ApraService::Response
- Inherits:
-
Object
- Object
- ApraService::Response
- Defined in:
- lib/apralib/response.rb
Instance Attribute Summary collapse
-
#failed_notifications ⇒ Object
Returns the value of attribute failed_notifications.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/apralib/response.rb', line 7 def initialize @failed_notifications = [] end |
Instance Attribute Details
#failed_notifications ⇒ Object
Returns the value of attribute failed_notifications.
5 6 7 |
# File 'lib/apralib/response.rb', line 5 def failed_notifications @failed_notifications end |
Class Method Details
.from_hash(hash) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/apralib/response.rb', line 12 def self.from_hash(hash) puts hash.inspect response = Response.new raw_response = hash[:lisaa_apurahat_response] failures = raw_response[:epaonnistuneet_ilmoitukset] if failures failures = [failures] unless failures.is_a? Array response.failed_notifications = failures.map {|notification| NotificationResponse.from_hash(notification) } end response end |