configurable fastexact radius
parent
adebff5c40
commit
34f16f3259
|
|
@ -123,7 +123,7 @@ func (fe FastExact) newRequest(state config.State) (*http.Request, error) {
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
http.MethodGet,
|
http.MethodGet,
|
||||||
"https://www.fastexact.com/secure/index.php?page=ajaxListJobs&action=ajax&zipcode="+zip+"&records_per_page=50&distance=300&st_loc_zip=8",
|
"https://www.fastexact.com/secure/index.php?page=ajaxListJobs&action=ajax&zipcode="+zip+"&records_per_page=50&distance="+strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles)+"&st_loc_zip=8",
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -236,8 +236,8 @@ func (mock mockFastExactDoer) doRequest(req *http.Request) (*http.Response, erro
|
||||||
if req.URL.Query().Get("records_per_page") != "50" {
|
if req.URL.Query().Get("records_per_page") != "50" {
|
||||||
return nil, errors.New("bad query: records_per_page should be 50")
|
return nil, errors.New("bad query: records_per_page should be 50")
|
||||||
}
|
}
|
||||||
if req.URL.Query().Get("distance") != "300" {
|
if req.URL.Query().Get("distance") != strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles) {
|
||||||
return nil, errors.New("bad query: distance should be 300")
|
return nil, errors.New("bad query: distance should be as configured")
|
||||||
}
|
}
|
||||||
if req.URL.Query().Get("zipcode") == "" {
|
if req.URL.Query().Get("zipcode") == "" {
|
||||||
return nil, errors.New("bad query: zip code empty")
|
return nil, errors.New("bad query: zip code empty")
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@
|
||||||
"Once": true,
|
"Once": true,
|
||||||
"Brokers": {
|
"Brokers": {
|
||||||
"FastExact": {
|
"FastExact": {
|
||||||
|
"RadiusMiles": 100,
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"Mock": true,
|
"Mock": true,
|
||||||
"Username": "u",
|
"Username": "u",
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@
|
||||||
"Once": true,
|
"Once": true,
|
||||||
"Brokers": {
|
"Brokers": {
|
||||||
"FastExact": {
|
"FastExact": {
|
||||||
|
"RadiusMiles": 100,
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"Mock": true,
|
"Mock": true,
|
||||||
"Username": "u",
|
"Username": "u",
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ type Config struct {
|
||||||
}
|
}
|
||||||
FastExact struct {
|
FastExact struct {
|
||||||
Enabled bool
|
Enabled bool
|
||||||
|
RadiusMiles int
|
||||||
Mock bool
|
Mock bool
|
||||||
Username string
|
Username string
|
||||||
Password string
|
Password string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue