meeting_finder 0.0.4 → 0.0.7

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: 960ccc9b9ddcfb81249ca80a9e73546f021d7f33
4
- data.tar.gz: c3abd23cf4f5e94ea65a725e816f2d1524fe51ab
3
+ metadata.gz: 55dedd2f98726647b6a2e3c6b2d59623fdee4e05
4
+ data.tar.gz: 78b1177316746ea09a973c24f804eedf8fe10f6c
5
5
  SHA512:
6
- metadata.gz: 5f194c326d030c4e80fd1b5c54db320e054b2f6472aec115e8a69cdb69357a4c92a0312e8942b46fa0d6109274d68dd0eed7c9302b8f349b6d2f8218f4123a61
7
- data.tar.gz: d61aaad6b161564b055cafc1e68774ab44f47b259a627fd1cbf8a4c2855483a25846bb3d8afae089f7b3d2954a0781e530695e4c0d4dd0938a6f92f5e3bd6520
6
+ metadata.gz: 98fbb23ac2875812aab1343c68cff11f264928924c496a3e6178f589c6ef3edc851834005cd0b3a56a0ddf84eae9a2601480b370c7534c758f8b5e2546842542
7
+ data.tar.gz: b6d88d6fa6194eb6dff06c5fd35c80f9242f55eec0ff7f0ac8ab245d7ac73696ab218e927a558fddce77afd810bb43d06669e1944763e1fbb358db921420233c
@@ -1,6 +1,6 @@
1
1
  require 'nokogiri'
2
2
  require 'open-uri'
3
- require 'geocoder'
3
+ require 'faraday'
4
4
 
5
5
  module MeetingFinder
6
6
  class Search
@@ -10,6 +10,7 @@ module MeetingFinder
10
10
  search_string = values.map do |parameter, value|
11
11
  "&#{parameter}=#{value}"
12
12
  end.join
13
+
13
14
  response = Nokogiri::HTML(open(search_url + search_string))
14
15
  meetings = []
15
16
  response.css('.all-meetings tr').each_with_object({}) do |meeting, attributes|
@@ -19,7 +20,7 @@ module MeetingFinder
19
20
  attributes['day'] = meeting.children[6].text
20
21
  attributes['time'] = meeting.children[8].text
21
22
  attributes['fellowship'] = meeting.children[10].text
22
- attributes['lat'], attributes['lng'] = find_lat_long_from(attributes['address'])
23
+ attributes['lat'], attributes['lng'] = values['latitude'], values['longitude'] || find_lat_long_from(attributes['address'])
23
24
  meetings << MeetingFinder::Meeting.new(attributes)
24
25
  end
25
26
  meetings.shift
@@ -29,8 +30,12 @@ module MeetingFinder
29
30
  def find_lat_long_from(address)
30
31
  result = Faraday.get("https://maps.googleapis.com/maps/api/geocode/json?address=#{address}&sensor=false")
31
32
  coords = JSON.parse(result.body)
32
- lat = coords["results"].first["geometry"]["location"]["lat"]
33
- lng = coords["results"].first["geometry"]["location"]["lng"]
33
+ if result
34
+ lat = coords["results"].first["geometry"]["location"]["lat"]
35
+ lng = coords["results"].first["geometry"]["location"]["lng"]
36
+ else
37
+ lat, lng = "39.7316982", "-104.9213643"
38
+ end
34
39
  [lat, lng]
35
40
  end
36
41
 
@@ -1,3 +1,3 @@
1
1
  module MeetingFinder
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meeting_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Lewis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-19 00:00:00.000000000 Z
13
+ date: 2014-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler