Sha256: 57fe22e3c132be2af6eb9f47e345c14a2dbb6c841e3f62b14f35ff41b19390c3

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require_relative 'root_address_entry'
require_relative 'aliases_entry'
require_relative 'secondaries_entry'

module SmartyStreets
  module USEnrichment
    module Secondary
      class Response
        attr_reader :smarty_key, :root_address, :aliases, :secondaries, :etag

        def initialize(obj, etag=nil)
          @smarty_key = obj['smarty_key']
          @root_address = Secondary::RootAddressEntry.new(obj['root_address'])
          if !obj['aliases'].nil?
            @aliases = createAliasesArray(obj['aliases'])
          end
          @secondaries = createSecondariesArray(obj['secondaries'])
          @etag=etag
        end

        def createAliasesArray(obj)
          aliasesArray = []
          for item in obj do
            aliasesArray << Secondary::AliasesEntry.new(item)
          end
          return aliasesArray
        end

        def createSecondariesArray(obj)
          secondariesArray = []
          for item in obj do
            secondariesArray << Secondary::SecondariesEntry.new(item)
          end
          return secondariesArray
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smartystreets_ruby_sdk-5.20.6 lib/smartystreets_ruby_sdk/us_enrichment/secondary/response.rb
smartystreets_ruby_sdk-5.20.4 lib/smartystreets_ruby_sdk/us_enrichment/secondary/response.rb