Sha256: 469ea3c7765729444b2102f8e70c481f0c4d1ab9562f4b9c4a47494c93bf90ef

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module FedexLocationService
  class Locations
    def self.call(response)
      locations = response.body[:search_locations_reply][:address_to_location_relationships][:distance_and_location_details]

      location_details = []

      locations.each do |location|
        address = {
          company_name: location[:location_detail][:location_contact_and_address][:contact][:company_name],
          street:       location[:location_detail][:location_contact_and_address][:address][:street_lines],
          city:         location[:location_detail][:location_contact_and_address][:address][:city],
          state:        location[:location_detail][:location_contact_and_address][:address][:state_or_province_code],
          postal_code:  location[:location_detail][:location_contact_and_address][:address][:postal_code],
          distance:     location[:distance][:value],
          map_url:      location[:location_detail][:map_url]
        }

        location_details << address
      end

      return location_details
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fedex_location_service-0.4.0 lib/fedex_location_service/locations.rb
fedex_location_service-0.3.0 lib/fedex_location_service/locations.rb
fedex_location_service-0.2.0 lib/fedex_location_service/locations.rb
fedex_location_service-0.1.1 lib/fedex_location_service/locations.rb
fedex_location_service-0.1.0 lib/fedex_location_service/locations.rb