Class: SmartyStreets::USEnrichment::Client
- Inherits:
-
Object
- Object
- SmartyStreets::USEnrichment::Client
- Defined in:
- lib/smartystreets_ruby_sdk/us_enrichment/client.rb
Instance Method Summary collapse
- #__send(lookup) ⇒ Object
-
#initialize(sender, serializer) ⇒ Client
constructor
A new instance of Client.
- #send_property_financial_lookup(smarty_key) ⇒ Object
- #send_property_principal_lookup(smarty_key) ⇒ Object
Constructor Details
#initialize(sender, serializer) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/smartystreets_ruby_sdk/us_enrichment/client.rb', line 10 def initialize(sender, serializer) @sender = sender @serializer = serializer end |
Instance Method Details
#__send(lookup) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/smartystreets_ruby_sdk/us_enrichment/client.rb', line 23 def __send(lookup) smarty_request = Request.new return if lookup.nil? smarty_request.url_components = '/' + lookup.smarty_key + '/' + lookup.data_set + '/' + lookup.data_sub_set response = @sender.send(smarty_request) results = @serializer.deserialize(response.payload) results = [] if results.nil? raise response.error if response.error output = [] results.each do |raw_result| result = nil if lookup.data_sub_set == "financial" result = USEnrichment::Property::Financial::Response.new(raw_result) end if lookup.data_sub_set == "principal" result = USEnrichment::Property::Principal::Response.new(raw_result) end output << result end output end |
#send_property_financial_lookup(smarty_key) ⇒ Object
15 16 17 |
# File 'lib/smartystreets_ruby_sdk/us_enrichment/client.rb', line 15 def send_property_financial_lookup(smarty_key) __send(USEnrichment::Property::Financial::Lookup.new(smarty_key)) end |
#send_property_principal_lookup(smarty_key) ⇒ Object
19 20 21 |
# File 'lib/smartystreets_ruby_sdk/us_enrichment/client.rb', line 19 def send_property_principal_lookup(smarty_key) __send(USEnrichment::Property::Principal::Lookup.new(smarty_key)) end |