Class: ChicagoBusinessLicenses::License

Inherits:
Object
  • Object
show all
Defined in:
lib/chicago_business_licenses.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(license_api_info) ⇒ License

Returns a new instance of License.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/chicago_business_licenses.rb', line 8

def initialize(license_api_info)
  @account_number = license_api_info["account_number"] ,
  @address = license_api_info["address"] ,
  @application_created_date = license_api_info["application_created_date"] ,
  @application_requirements_complete = license_api_info["application_requirements_complete"] ,
  @application_type = license_api_info["application_type"] ,
  @city = license_api_info["city"] ,
  @conditional_approval = license_api_info["conditional_approval"] ,
  @date_issued = license_api_info["date_issued"] ,
  @doing_business_as_name = license_api_info["doing_business_as_name"] ,
  @expiration_date = license_api_info["expiration_date"] ,
  @id = license_api_info["id"] ,
  @latitude = license_api_info["latitude"] ,
  @legal_name = license_api_info["legal_name"] ,
  @license_approved_for_issuance = license_api_info["license_approved_for_issuance"] ,
  @license_code = license_api_info["license_code"] ,
  @license_description = license_api_info["license_description"] ,
  @license_id = license_api_info["license_id"] ,
  @license_number = license_api_info["license_number"] ,
  @license_start_date = license_api_info["license_start_date"] ,
  @license_status = license_api_info["license_status"] ,
  @license_status_change_date = license_api_info["license_status_change_date"] ,
  @location = license_api_info["location"],
  @longitude = license_api_info["longitude"] ,
  @payment_date = license_api_info["payment_date"] ,
  @police_district = license_api_info["police_district"] ,
  @precinct = license_api_info["precinct"] ,
  @site_number = license_api_info["site_number"] ,
  @state = license_api_info["state"] ,
  @ward = license_api_info["ward"] ,
  @zip_code = license_api_info["zip_code"] 
end

Instance Attribute Details

#account_numberObject (readonly)

Returns the value of attribute account_number.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def 
  @account_number
end

#addressObject (readonly)

Returns the value of attribute address.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def address
  @address
end

#application_created_dateObject (readonly)

Returns the value of attribute application_created_date.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def application_created_date
  @application_created_date
end

#application_requirements_completeObject (readonly)

Returns the value of attribute application_requirements_complete.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def application_requirements_complete
  @application_requirements_complete
end

#application_typeObject (readonly)

Returns the value of attribute application_type.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def application_type
  @application_type
end

#cityObject (readonly)

Returns the value of attribute city.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def city
  @city
end

#conditional_approvalObject (readonly)

Returns the value of attribute conditional_approval.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def conditional_approval
  @conditional_approval
end

#date_issuedObject (readonly)

Returns the value of attribute date_issued.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def date_issued
  @date_issued
end

#doing_business_as_nameObject (readonly)

Returns the value of attribute doing_business_as_name.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def doing_business_as_name
  @doing_business_as_name
end

#expiration_dateObject (readonly)

Returns the value of attribute expiration_date.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def expiration_date
  @expiration_date
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def id
  @id
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def latitude
  @latitude
end

Returns the value of attribute legal_name.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def legal_name
  @legal_name
end

#license_approved_for_issuanceObject (readonly)

Returns the value of attribute license_approved_for_issuance.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_approved_for_issuance
  @license_approved_for_issuance
end

#license_codeObject (readonly)

Returns the value of attribute license_code.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_code
  @license_code
end

#license_descriptionObject (readonly)

Returns the value of attribute license_description.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_description
  @license_description
end

#license_idObject (readonly)

Returns the value of attribute license_id.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_id
  @license_id
end

#license_numberObject (readonly)

Returns the value of attribute license_number.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_number
  @license_number
end

#license_start_dateObject (readonly)

Returns the value of attribute license_start_date.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_start_date
  @license_start_date
end

#license_statusObject (readonly)

Returns the value of attribute license_status.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_status
  @license_status
end

#license_status_change_dateObject (readonly)

Returns the value of attribute license_status_change_date.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def license_status_change_date
  @license_status_change_date
end

#locationObject (readonly)

Returns the value of attribute location.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def location
  @location
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def longitude
  @longitude
end

#payment_dateObject (readonly)

Returns the value of attribute payment_date.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def payment_date
  @payment_date
end

#police_districtObject (readonly)

Returns the value of attribute police_district.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def police_district
  @police_district
end

#precinctObject (readonly)

Returns the value of attribute precinct.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def precinct
  @precinct
end

#site_numberObject (readonly)

Returns the value of attribute site_number.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def site_number
  @site_number
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def state
  @state
end

#wardObject (readonly)

Returns the value of attribute ward.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def ward
  @ward
end

#zip_codeObject (readonly)

Returns the value of attribute zip_code.



6
7
8
# File 'lib/chicago_business_licenses.rb', line 6

def zip_code
  @zip_code
end

Class Method Details

.allObject



41
42
43
44
45
# File 'lib/chicago_business_licenses.rb', line 41

def self.all
  api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json").body

  create_licenses(api_array)      
end

.search(search_keyword) ⇒ Object



47
48
49
50
51
# File 'lib/chicago_business_licenses.rb', line 47

def self.search(search_keyword)
  api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json?$q=#{search_keyword}").body

  create_licenses(api_array)
end