Sha256: dd7e6fadde30e0e72a5b2e83749fd953517ddcd78da5cda85a52bada26b85733

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

module FedexLocationService
  class Message
    def self.build(configuration, address)
      { 'WebAuthenticationDetail' => [
          'ParentCredential' => [
            'Key' => configuration.key,
            'Password' => configuration.password
          ],
          'UserCredential' => [
            'Key' => configuration.key,
            'Password' => configuration.password
          ]
        ],
        'ClientDetail' => [
          'AccountNumber' => configuration.account_number,
          'MeterNumber' => configuration.meter_number
        ],
        'TransactionDetail' => [
          'CustomerTransactionId' => 'location_service gem'
        ],
        'Version' => [
          'ServiceId' => 'locs',
          'Major' => '7',
          'Intermediate' => '0',
          'Minor' => '0'
        ],
        'EffectiveDate' => Date.today.to_s,
        'LocationsSearchCriterion' => 'ADDRESS',
        'Address' => [
          'StreetLines' => [
            address.address_one,
            ## address_two cannot be nil
            address.address_two ? address.address_two : ''
          ],
          'City' => address.city,
          'StateOrProvinceCode' => address.state,
          'PostalCode' => address.postal_code,
          'CountryCode' => 'US'
        ],
        'MultipleMatchesAction' => 'RETURN_ALL',
        'SortDetail' => [
          'Criterion' => 'DISTANCE',
          'Order' => 'LOWEST_TO_HIGHEST'
        ],
        'Constraints' => [
          'RadiusDistance' => [
            'Value' => 15.0,
            'Units' => 'MI'
          ],
          'RequiredLocationAttributes' => [
            'WEEKDAY_EXPRESS_HOLD_AT_LOCATION'
          ],
          'ResultsRequested' => 5,
        ]
      }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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