Class: InstantQuote::ConnectionTranslator
- Inherits:
-
Object
- Object
- InstantQuote::ConnectionTranslator
- Defined in:
- lib/instant_quote/connection_translator.rb
Overview
Inherit from this class to create the translation from Finpoint’s app to the JSON that needs to be sent to the service you’re integrating. You’ll have access to ‘application` and `extra_info` from the application’s record.
Direct Known Subclasses
InstantQuote::ConnectionTranslators::CapitalOnTap, InstantQuote::ConnectionTranslators::Fake, InstantQuote::ConnectionTranslators::Iwoca, InstantQuote::ConnectionTranslators::Optimum, InstantQuote::ConnectionTranslators::Youlend, InstantQuote::ConnectionTranslators::YoulendPersons
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#extra_info ⇒ Object
Returns the value of attribute extra_info.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(connection) ⇒ ConnectionTranslator
constructor
A new instance of ConnectionTranslator.
- #translate ⇒ Object
Constructor Details
#initialize(connection) ⇒ ConnectionTranslator
Returns a new instance of ConnectionTranslator.
16 17 18 19 20 |
# File 'lib/instant_quote/connection_translator.rb', line 16 def initialize(connection) @connection = connection @application = connection.finance_application @extra_info = ActiveSupport::HashWithIndifferentAccess.new(connection.extra_info) end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
10 11 12 |
# File 'lib/instant_quote/connection_translator.rb', line 10 def application @application end |
#connection ⇒ Object
Returns the value of attribute connection.
10 11 12 |
# File 'lib/instant_quote/connection_translator.rb', line 10 def connection @connection end |
#extra_info ⇒ Object
Returns the value of attribute extra_info.
10 11 12 |
# File 'lib/instant_quote/connection_translator.rb', line 10 def extra_info @extra_info end |
Class Method Details
.translate(connection) ⇒ Object
12 13 14 |
# File 'lib/instant_quote/connection_translator.rb', line 12 def self.translate(connection) new(connection).translate end |
Instance Method Details
#translate ⇒ Object
22 23 24 |
# File 'lib/instant_quote/connection_translator.rb', line 22 def translate raise NotImplementedError, "You must implement '#{self.class.name}#translate'" end |