class Hypofriend::Client
Constants
- BASE_URI
Public Instance Methods
new_offer(loan_amount:, property_value:, repayment:, years_fixed:)
click to toggle source
# File lib/hypofriend/client.rb, line 12 def new_offer(loan_amount:, property_value:, repayment:, years_fixed:) response = self.class.get( '/api/v5/new-offers', { query: { loan_amount: loan_amount, property_value: property_value, repayment: repayment, years_fixed: years_fixed } } ) raise FetchError.new(response.body) unless response.success? JSON.parse(response.body).dig('data', 'offers')&.map do |offer| Offer.new( institution_name: offer['institution_name'], borrowing_rate: offer['borrowing_rate'] ) end end