move radius miles to broker level
parent
d38555a555
commit
a41ea7d501
|
|
@ -179,7 +179,7 @@ func (fe FastExact) newRequestWithState(state config.State) (*http.Request, erro
|
||||||
func (fe FastExact) newRequest(zip string) (*http.Request, error) {
|
func (fe FastExact) newRequest(zip string) (*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="+strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles)+"&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.RadiusMiles)+"&st_loc_zip=8",
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -292,7 +292,7 @@ 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") != strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles) {
|
if req.URL.Query().Get("distance") != strconv.Itoa(config.Get().Brokers.RadiusMiles) {
|
||||||
return nil, errors.New("bad query: distance should be as configured")
|
return nil, errors.New("bad query: distance should be as configured")
|
||||||
}
|
}
|
||||||
if req.URL.Query().Get("zipcode") == "" {
|
if req.URL.Query().Get("zipcode") == "" {
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@
|
||||||
"Once": false,
|
"Once": false,
|
||||||
"Brokers": {
|
"Brokers": {
|
||||||
"UseZips": true,
|
"UseZips": true,
|
||||||
|
"RadiusMiles": 100,
|
||||||
"FastExact": {
|
"FastExact": {
|
||||||
"RadiusMiles": 100,
|
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"Mock": true,
|
"Mock": true,
|
||||||
"Username": "birdman",
|
"Username": "birdman",
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@
|
||||||
"Once": true,
|
"Once": true,
|
||||||
"Brokers": {
|
"Brokers": {
|
||||||
"UseZips": true,
|
"UseZips": true,
|
||||||
|
"RadiusMiles": 100,
|
||||||
"FastExact": {
|
"FastExact": {
|
||||||
"RadiusMiles": 100,
|
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"Mock": true,
|
"Mock": true,
|
||||||
"Username": "u",
|
"Username": "u",
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,9 @@ type Config struct {
|
||||||
}
|
}
|
||||||
Once bool
|
Once bool
|
||||||
Brokers struct {
|
Brokers struct {
|
||||||
UseZips bool
|
UseZips bool
|
||||||
NTG struct {
|
RadiusMiles int
|
||||||
|
NTG struct {
|
||||||
Enabled bool
|
Enabled bool
|
||||||
JobInfo bool
|
JobInfo bool
|
||||||
Mock bool
|
Mock bool
|
||||||
|
|
@ -75,11 +76,10 @@ type Config struct {
|
||||||
Password string
|
Password string
|
||||||
}
|
}
|
||||||
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