Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sling http client and add improved test assertions #10

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified _scripts/env.sh
100755 → 100644
Empty file.
Empty file modified _scripts/tests_coverage.sh
100755 → 100644
Empty file.
Empty file modified _scripts/tests_unit.sh
100755 → 100644
Empty file.
44 changes: 0 additions & 44 deletions address.go

This file was deleted.

106 changes: 0 additions & 106 deletions api.go

This file was deleted.

51 changes: 51 additions & 0 deletions canada.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package geocodio

type Riding struct {
Code string `json:"code"`
NameFrench string `json:"name_french"`
NameEnglish string `json:"name_english"`
}

type Statcan struct {
Division CanadaDivision `json:"division"`
ConsolidatedSubdivision CanadaConsolidatedSubdivision `json:"consolidated_subdivision"`
Subdivision CanadaSubdivision `json:"subdivision"`
EconomicRegion string `json:"economic_region"`
StatisticalArea CanadaStatisticalArea `json:"statistical_area"`
CensusMetroArea CanadaCensusMetroArea `json:"cma_ca"`
Tract string `json:"tract"`
CensusYear int `json:"census_year"`
}

type CanadaDivision struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
TypeDescription string `json:"type_description"`
}

type CanadaConsolidatedSubdivision struct {
ID string `json:"id"`
Name string `json:"name"`
}

type CanadaSubdivision struct {
ID string `json:"id"`
Name string `json:"name"`
TypeCode string `json:"type"`
TypeDescription string `json:"type_description"`
}

type CanadaStatisticalArea struct {
Code string `json:"code"`
CodeDescription string `json:"code_description"`
Type string `json:"type"`
TypeDescription string `json:"type_description"`
}

type CanadaCensusMetroArea struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
TypeDescription string `json:"type_description"`
}
55 changes: 3 additions & 52 deletions census.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,6 @@ type CensusResults struct {
}

// Census field
/*
{
"census_year": 2010,
"state_fips": "51",
"county_fips": "51013",
"tract_code": "101801",
"block_code": "1004",
"block_group": "1",
"full_fips": "510131018011004",
"place": {
"name": "Arlington",
"fips": "5103000"
},
"metro_micro_statistical_area": {
"name": "Washington-Arlington-Alexandria, DC-VA-MD-WV",
"area_code": "47900",
"type": "metropolitan"
},
"combined_statistical_area": {
"name": "Washington-Baltimore-Northern Virginia, DC-MD-VA-WV",
"area_code": "51548"
},
"metropolitan_division": {
"name": "Washington-Arlington-Alexandria, DC-VA-MD-WV",
"area_code": "47894"
},
"source": "US Census Bureau"
}
*/
type Census struct {
Year int `json:"census_year"`
StateFIPS string `json:"state_fips"`
Expand Down Expand Up @@ -80,9 +51,9 @@ type CensusACS struct {
}

type Economics struct {
NumberOfHouseholds NumberOfHouseholds `json:"Number of households"`
MedianHouseholdIncome MedianHouseholdIncome `json:"Median household income"`
HouseholdIncome HouseholdIncome `json:"Household income"`
NumberOfHouseholds NumberOfHouseholds `json:"Number of households"`
MedianHouseholdIncome MedianHouseholdIncome `json:"Median household income"`
HouseholdIncome map[string]CensusDataPoint `json:"Household income"` // use map since Go tags cannot have "," in them
}

type NumberOfHouseholds struct {
Expand All @@ -95,26 +66,6 @@ type MedianHouseholdIncome struct {
Total CensusDataPoint `json:"Total"`
}

type HouseholdIncome struct {
Meta CensusMeta `json:"meta"`
LessThan10000 CensusDataPoint `json:"Less than $10,000"`
Income10000to14999 CensusDataPoint `json:"$10,000 to $14,999"`
Income15000to19999 CensusDataPoint `json:"$15,000 to $19,999"`
Income20000to24999 CensusDataPoint `json:"$20,000 to $24,999"`
Income25000to29999 CensusDataPoint `json:"$25,000 to $29,999"`
Income30000to34999 CensusDataPoint `json:"$30,000 to $34,999"`
Income35000to39999 CensusDataPoint `json:"$35,000 to $39,999"`
Income40000to44999 CensusDataPoint `json:"$40,000 to $44,999"`
Income45000to49999 CensusDataPoint `json:"$45,000 to $49,999"`
Income50000to59000 CensusDataPoint `json:"$50,000 to $59,999"`
Income60000to74999 CensusDataPoint `json:"$60,000 to $74,999"`
Income75000to99999 CensusDataPoint `json:"$75,000 to $99,999"`
Income100000to124999 CensusDataPoint `json:"$100,000 to $124,999"`
Income125000to149000 CensusDataPoint `json:"$125,000 to $149,999"`
Income150000to199999 CensusDataPoint `json:"$150,000 to $199,999"`
Income200000orMore CensusDataPoint `json:"$200,000 or more"`
}

type Demographic struct {
MedianAge map[string]CensusDataPoint `json:"Median age"`
PopulationByAgeRange map[string]CensusDataPoint `json:"Population by age range"`
Expand Down
61 changes: 1 addition & 60 deletions congressional.go
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
package geocodio

// Congressional District field
/*
"name": "Congressional District 8",
"district_number": 8,
"congress_number": "116th",
"congress_years": "2019-2021",
"proportion": 1,
"current_legislators": [...]
*/
type CongressionalDistrict struct {
Name string `json:"name"`
DistrictNumber int `json:"district_number"`
CongressNumber string `json:"congress_number"`
CongressYears string `json:"congress_years"`
Proportion int `json:"congress_years"`
Proportion int `json:"proportion"`
CurrentLegislators []Legislator `json:"current_legislators"` // v1.2+
}

// Legislator field
/*
{
"type": "representative",
"bio": {...},
"contact": {...},
"social": {...},
"references": {...},
"source": "Legislator data is originally collected and aggregated by https://github.com/unitedstates/"
}
*/
type Legislator struct {
Type string `json:"type"`
Bio Bio `json:"bio"`
Expand All @@ -39,15 +21,6 @@ type Legislator struct {
}

// Bio field
/*
"bio": {
"last_name": "Beyer",
"first_name": "Donald",
"birthday": "1950-06-20",
"gender": "M",
"party": "Democrat"
}
*/
type Bio struct {
LastName string `json:"last_name"`
FirstName string `json:"first_name"`
Expand All @@ -57,14 +30,6 @@ type Bio struct {
}

// Contact field
/*
"contact": {
"url": "https://beyer.house.gov",
"address": "1119 Longworth House Office Building Washington DC 20515-4608",
"phone": "(202) 225-4376",
"contact_form": null
}
*/
type Contact struct {
URL string `json:"url"`
Address string `json:"address"`
Expand All @@ -73,15 +38,6 @@ type Contact struct {
}

// Social field
/*
"social": {
"rss_url": null,
"twitter": "RepDonBeyer",
"facebook": "RepDonBeyer",
"youtube": null,
"youtube_id": "UCPJGVbOVcAVGiBwq8qr_T9w"
}
*/
type CongressionalSocial struct {
RSSURL string `json:"rss_url"`
Twitter string `json:"twitter"`
Expand All @@ -91,21 +47,6 @@ type CongressionalSocial struct {
}

// References field
/*
"references": {
"bioguide_id": "B001292",
"thomas_id": "02272",
"opensecrets_id": "N00036018",
"lis_id": null,
"cspan_id": "21141",
"govtrack_id": "412657",
"votesmart_id": "1707",
"ballotpedia_id": null,
"washington_post_id": null,
"icpsr_id": "21554",
"wikipedia_id": "Don Beyer"
}
*/
type References struct {
BioguideID string `json:"bioguide_id"`
ThomasID string `json:"thomas_id"`
Expand Down
6 changes: 0 additions & 6 deletions env.go

This file was deleted.

Loading