3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
49
50
51
52
53
54
55
56
|
# File 'lib/fedex_location_service/message.rb', line 3
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.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
|