data_science_theater_3000 0.0.6.1 → 0.0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rvmrc
@@ -22,21 +22,25 @@ module DataScienceTheater3000
22
22
 
23
23
  # Converts a street address into a location hash
24
24
  #
25
- # @param [String] address the address to be located
25
+ # @param [String, Array] address as either a single string or array of strings
26
26
  # @return [Hash] hash of location information. Can be passed as input to coordinates2politics
27
27
  def self.street2coordinates address
28
28
  url = "http://www.datasciencetoolkit.org"
29
- address.gsub!( "," , "%2c" )
30
- address.gsub!( " " , "+" )
31
- response = Curl::Easy.perform( url + "/street2coordinates/" + address ).body_str
32
-
29
+ if address.class == String
30
+ address.gsub!(",", "%2c").gsub!(" ", "+")
31
+ response = Curl::Easy.perform( url + "/street2coordinates/" + address ).body_str
32
+ elsif address.class == Array
33
+ address.each {|a| a.gsub!(",", "%2c").gsub!(" ", "+") }
34
+ address = ActiveSupport::JSON.encode(address)
35
+ response = Curl::Easy.perform( url + "/street2coordinates/" + address ).body_str
36
+ end
33
37
  coordinates = make_hashy(response)
34
38
  end
35
39
 
36
40
  # Uses latitude,longitude pair to find detailed political information about a location.
37
41
  # Currently supporting a single pair.
38
42
  #
39
- # @param [Hash] hash returned from ip2coordinates/street2coordinates or just a string like "33,-86"
43
+ # @param [Hash,String] hash returned from ip2coordinates/street2coordinates or just a string like "33,-86"
40
44
  # @return [Array] contains hashes with detailed political information for a location
41
45
  def self.coordinates2politics coords
42
46
  if coords.class == Hash
@@ -51,8 +55,6 @@ module DataScienceTheater3000
51
55
  end
52
56
 
53
57
  def self.text2people name
54
- #TODO should take array of names as well
55
- #FIXME curl wants different arguments
56
58
  #url = "http://www.datasciencetoolkit.org"
57
59
  #response = Curl::Easy.perform( url + "/text2people/" + name ).body_str
58
60
 
@@ -61,8 +63,6 @@ module DataScienceTheater3000
61
63
 
62
64
  def self.text2times text
63
65
  #url = "http://www.datasciencetoolkit.org"
64
- #text.gsub!( "," , "%2c" )
65
- #FIXME curl wants different arguments
66
66
  #response = Curl::Easy.perform( url + "/text2times/" + text ).body_str
67
67
 
68
68
  #times = make_hashy(response)
@@ -1,3 +1,3 @@
1
1
  module DataScienceTheater3000
2
- VERSION = "0.0.6.1"
2
+ VERSION = "0.0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_science_theater_3000
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.1
4
+ version: 0.0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_support
16
- requirement: &16112460 !ruby/object:Gem::Requirement
16
+ requirement: &21456080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16112460
24
+ version_requirements: *21456080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: curb
27
- requirement: &16111880 !ruby/object:Gem::Requirement
27
+ requirement: &21455500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16111880
35
+ version_requirements: *21455500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &16111040 !ruby/object:Gem::Requirement
38
+ requirement: &21454620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *16111040
46
+ version_requirements: *21454620
47
47
  description: Ruby interface to issue Data Science Toolkit API calls.
48
48
  email:
49
49
  - tad@isotope11.com
@@ -55,7 +55,6 @@ files:
55
55
  - Gemfile
56
56
  - README.md
57
57
  - Rakefile
58
- - Screenshot-1.png
59
58
  - data_science_theater_3000.gemspec
60
59
  - doc/sample.png
61
60
  - lib/data_science_theater_3000.rb
Binary file