locations_ng 0.0.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29ca87c7a70ec31a13d0024be5d1c210de48df71
4
- data.tar.gz: cea58a52c29e713fa545173db6f42e80e24b8214
3
+ metadata.gz: 93aac4c83695e75a4cb21172cb5f5ae8d59e9397
4
+ data.tar.gz: 1818a9e75bf2a78d0c58da85d0b127d2b0e28486
5
5
  SHA512:
6
- metadata.gz: eded290a0a975f1067917669f37dfbf86d2f8498f63796be0307bc4476f696fe3e7837ddbac63663e13857b00c10f52b5c81f7dd67cbf305482eb5a2df2e9a71
7
- data.tar.gz: ba015c27084a9113210db900b12c23bfb408c5e562193a80e70a321a2d8e4717bf255296e3c79db8baaf39928695fd4dcc3f056548c6556e6a6b6ae6d3d07c7f
6
+ metadata.gz: a80cd8305107e43b24513fd9ecf34b812676050891f18cee0a21d9442e1e7687390db404ed3643a22417487e67380dea6462df52b3c7950e8925d6010467357c
7
+ data.tar.gz: 2e071f238c8f31d74231188669cadf893202069ca9997fa6daedd785ec7d15530c4506a61338cd8ef4c4da7b3bc936f03ae32f7ec9f938253efca6998542e40e
@@ -1,10 +1,10 @@
1
1
  module LocationsNg
2
2
  class City
3
- def all
3
+ def self.all
4
4
  load_cities
5
5
  end
6
6
 
7
- def cities(state)
7
+ def self.cities(state)
8
8
  state = state.downcase.gsub(' ', '_')
9
9
  all_cities = load_cities
10
10
 
@@ -19,11 +19,11 @@ module LocationsNg
19
19
 
20
20
  private
21
21
 
22
- def load_cities
22
+ def self.load_cities
23
23
  YAML.load(File.read(files_location 'cities'))
24
24
  end
25
25
 
26
- def files_location(file)
26
+ def self.files_location(file)
27
27
  File.expand_path("../locations/#{file}.yml", __FILE__)
28
28
  end
29
29
  end
@@ -1,10 +1,10 @@
1
1
  module LocationsNg
2
2
  class Lga
3
- def all
3
+ def self.all
4
4
  load_lgas
5
5
  end
6
6
 
7
- def lgas(state)
7
+ def self.lgas(state)
8
8
  state = state.downcase.gsub(' ', '_')
9
9
  all_lgas = load_lgas
10
10
 
@@ -19,11 +19,11 @@ module LocationsNg
19
19
 
20
20
  private
21
21
 
22
- def load_lgas
22
+ def self.load_lgas
23
23
  YAML.load(File.read(files_location 'lgas'))
24
24
  end
25
25
 
26
- def files_location(file)
26
+ def self.files_location(file)
27
27
  File.expand_path("../locations/#{file}.yml", __FILE__)
28
28
  end
29
29
  end
@@ -1,10 +1,10 @@
1
1
  module LocationsNg
2
2
  class State
3
- def all
3
+ def self.all
4
4
  load_states.map{ |s| {name: s['name'], capital: s['capital']} }
5
5
  end
6
6
 
7
- def details(state)
7
+ def self.details(state)
8
8
  state = state.downcase.gsub(' ', '_')
9
9
  all_states = load_states
10
10
 
@@ -14,13 +14,13 @@ module LocationsNg
14
14
  {message: "No state found for '#{state}'", status: 404}
15
15
  else
16
16
  res = all_states[state_index].with_indifferent_access
17
- res['cities'] = LocationsNg::City.new.cities(state)
18
- res['lgas'] = LocationsNg::Lga.new.lgas(state)
17
+ res['cities'] = LocationsNg::City.cities(state)
18
+ res['lgas'] = LocationsNg::Lga.lgas(state)
19
19
  res
20
20
  end
21
21
  end
22
22
 
23
- def capital(state)
23
+ def self.capital(state)
24
24
  state = state.downcase.gsub(' ', '_')
25
25
  all_states = load_states
26
26
 
@@ -35,11 +35,11 @@ module LocationsNg
35
35
 
36
36
  private
37
37
 
38
- def load_states
38
+ def self.load_states
39
39
  YAML.load(File.read(files_location 'states'))
40
40
  end
41
41
 
42
- def files_location(file)
42
+ def self.files_location(file)
43
43
  File.expand_path("../locations/#{file}.yml", __FILE__)
44
44
  end
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module LocationsNg
2
- VERSION = '0.0.5'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module LocationsNg
4
4
  describe City do
5
- let(:city) { LocationsNg::City.new }
5
+ let(:city) { LocationsNg::City }
6
6
 
7
7
  describe '.all' do
8
8
  let(:cities_response) { File.read('spec/responses/cities.json') }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module LocationsNg
4
4
  describe Lga do
5
- let(:lga) { LocationsNg::Lga.new }
5
+ let(:lga) { LocationsNg::Lga }
6
6
 
7
7
  describe '.all' do
8
8
  let(:lga_response) { File.read('spec/responses/lgas.json') }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module LocationsNg
4
4
  describe State do
5
- let(:state) { LocationsNg::State.new }
5
+ let(:state) { LocationsNg::State }
6
6
 
7
7
  describe '.all' do
8
8
  let(:state_response) { File.read('spec/responses/canonical_states.json') }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locations_ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fiyin Adebayo