class RubyPushNotifications::WNS::WNSAccess::Response
This class is responsible for structurize response from login WNS
service
Attributes
response[R]
@return [OpenStruct]. Return structurized response
Public Class Methods
new(response)
click to toggle source
# File lib/ruby-push-notifications/wns/wns_access.rb, line 18 def initialize(response) @response = structurize(response) end
Private Instance Methods
structurize(response)
click to toggle source
# File lib/ruby-push-notifications/wns/wns_access.rb, line 24 def structurize(response) body = response.body.to_s.empty? ? {} : JSON.parse(response.body) OpenStruct.new( status_code: response.code.to_i, status: response.message, error: body['error'], error_description: body['error_description'], access_token: body['access_token'], token_ttl: body['expires_in'] ) end