Skip to content

Commit

Permalink
General renaming and cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Amundson committed Mar 1, 2024
1 parent 9b8d2d7 commit dd3a7f4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
4 changes: 1 addition & 3 deletions examples/us-enrichment-api/geo-reference/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
ETag: "", // optional: check if the record has been updated
}

err, results := client.SendPropertyGeoReference(&lookup)
err, results := client.SendGeoReference(&lookup)

if err != nil {
// If ETag was supplied in the lookup, this status will be returned if the ETag value for the record is current
Expand All @@ -43,6 +43,4 @@ func main() {
for s, response := range results {
fmt.Printf("#%d: %+v\n", s, response)
}

log.Println("OK")
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ func main() {
for s, response := range results {
fmt.Printf("#%d: %+v\n", s, response)
}

log.Println("OK")
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ func main() {
for s, response := range results {
fmt.Printf("#%d: %+v\n", s, response)
}

log.Println("OK")
}
10 changes: 5 additions & 5 deletions us-enrichment-api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func (c *Client) SendPropertyPrincipal(lookup *Lookup) (error, []*PrincipalRespo
return err, propertyLookup.Response
}

func (c *Client) SendPropertyGeoReference(lookup *Lookup) (error, []*GeoReferenceResponse) {
geoReferenceLookup := &geoReferenceLookup{Lookup: lookup}
err := c.sendLookup(geoReferenceLookup)
return err, geoReferenceLookup.Response
func (c *Client) SendGeoReference(lookup *Lookup) (error, []*GeoReferenceResponse) {
geoRefLookup := &geoReferenceLookup{Lookup: lookup}
err := c.sendLookup(geoRefLookup)
return err, geoRefLookup.Response
}

func (c *Client) sendLookup(lookup enrichmentLookup) error {
Expand Down Expand Up @@ -89,7 +89,7 @@ func buildRequest(lookup enrichmentLookup) *http.Request {
func buildLookupURL(lookup enrichmentLookup) string {
newLookupURL := strings.Replace(lookupURL, lookupURLSmartyKey, lookup.getSmartyKey(), 1)
newLookupURL = strings.Replace(newLookupURL, lookupURLDataSet, lookup.getDataSet(), 1)
return strings.Replace(newLookupURL, lookupURLDataSubSet, lookup.getDataSubset(), 1)
return strings.TrimSuffix(strings.Replace(newLookupURL, lookupURLDataSubSet, lookup.getDataSubset(), 1), "/")
}

const (
Expand Down
13 changes: 6 additions & 7 deletions us-enrichment-api/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func (e *principalLookup) populate(query url.Values) {
e.Lookup.populateExclude(query)
}

////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////

type geoReferenceLookup struct {
Expand All @@ -128,7 +127,7 @@ type geoReferenceLookup struct {
}

func (g *geoReferenceLookup) getDataSubset() string {
return geoReferenceDataSubset
return emptyDataSubset
}

func (g *geoReferenceLookup) populate(query url.Values) {
Expand Down Expand Up @@ -171,11 +170,11 @@ func (g *geoReferenceLookup) unmarshalResponse(bytes []byte, headers http.Header
////////////////////////////////////////////////////////////////////////////////////////

const (
financialDataSubset = "financial"
principalDataSubset = "principal"
propertyDataSet = "property"
geoReferenceDataSet = "geo-reference"
geoReferenceDataSubset = ""
financialDataSubset = "financial"
principalDataSubset = "principal"
propertyDataSet = "property"
geoReferenceDataSet = "geo-reference"
emptyDataSubset = ""
)

func (l Lookup) populateInclude(query url.Values) {
Expand Down
1 change: 1 addition & 0 deletions us-enrichment-api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ type FinancialAttributes struct {
VeteranTaxExemption string `json:"veteran_tax_exemption"`
WidowTaxExemption string `json:"widow_tax_exemption"`
}

type GeoReferenceResponse struct {
SmartyKey string `json:"smarty_key"`
DataSetName string `json:"data_set_name"`
Expand Down

0 comments on commit dd3a7f4

Please sign in to comment.