class LemonWay::ResponseAdapter

Public Class Methods

new(response) click to toggle source
Calls superclass method
# File lib/lemon_way/response_adapter.rb, line 8
def initialize(response)
  response = JSON.parse(response.body)['d'].deep_transform_keys { |key| key.underscore.to_sym }

  raise LemonWay::LemonWayError.new(response[:e]) if response[:e].present?

  super(values_for(response))
end

Private Instance Methods

response_keys() click to toggle source
# File lib/lemon_way/response_adapter.rb, line 22
def response_keys
  %i[wallet moneyinweb trans form iban_register trans_sendpayment]
end
values_for(response) click to toggle source
# File lib/lemon_way/response_adapter.rb, line 18
def values_for(response)
  response.detect { |k, _v| k.in?(response_keys) }.last
end