lib/vng/location.rb in vng-0.1.20 vs lib/vng/location.rb in vng-1.0.0
- old
+ new
@@ -3,11 +3,11 @@
module Vng
# Provides methods to interact with Vonigo locations.
class Location < Resource
PATH = '/api/v1/data/Locations/'
- # TODO: fetch from /system/objects/ method: 1, objectID: 20
+ # These could be fetched from /system/objects/ method: 1, objectID: 20
STATES_OPTION_ID = {
AK: 9879, AL: 9878, AR: 9877, AZ: 9880, CA: 9883, CO: 9876, CT: 9875,
DC: 9874, DE: 9873, FL: 9872, GA: 9871, HI: 9870, IA: 9869, ID: 9868,
IL: 9867, IN: 9866, KS: 9865, KY: 9864, LA: 9863, MA: 9862, MD: 9861,
ME: 9860, MI: 9859, MN: 9858, MO: 9857, MS: 9856, MT: 9855, NC: 9854,
@@ -26,20 +26,19 @@
def self.create(address:, city:, zip:, state:, client_id:)
body = {
method: '3',
clientID: client_id,
Fields: [
- {fieldID: 779, optionID: 9906}, # 'USA'
- {fieldID: 778, optionID: STATES_OPTION_ID[state.to_sym]},
- {fieldID: 776, fieldValue: city},
- {fieldID: 773, fieldValue: address},
- {fieldID: 775, fieldValue: zip},
+ { fieldID: 779, optionID: 9906 }, # 'USA'
+ { fieldID: 778, optionID: STATES_OPTION_ID[state.to_sym] },
+ { fieldID: 776, fieldValue: city },
+ { fieldID: 773, fieldValue: address },
+ { fieldID: 775, fieldValue: zip },
]
}
data = request path: PATH, body: body
new id: data['Location']['objectID']
end
end
end
-