rimac 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rimac.rb +8 -2
- data/lib/rimac/version.rb +1 -1
- data/rimac.gemspec +2 -0
- metadata +4 -3
data/lib/rimac.rb
CHANGED
@@ -22,12 +22,18 @@ module Rimac
|
|
22
22
|
|
23
23
|
options[:limit] += 1
|
24
24
|
|
25
|
+
headers = options.delete(:headers)
|
26
|
+
|
25
27
|
url = url_for('invoke', resource, options)
|
26
28
|
|
27
29
|
response = JSON.parse(Net::HTTP.get_response(URI.parse(url)).body)
|
28
30
|
|
29
31
|
original_result = response["result"].to_a
|
30
|
-
headers
|
32
|
+
if headers
|
33
|
+
headers = headers.to_a
|
34
|
+
else
|
35
|
+
headers = original_result.shift.to_a
|
36
|
+
end
|
31
37
|
|
32
38
|
results = []
|
33
39
|
|
@@ -35,7 +41,7 @@ module Rimac
|
|
35
41
|
result = {}
|
36
42
|
|
37
43
|
headers.each_index do |i|
|
38
|
-
result[headers[i].to_s.downcase.gsub(" ", "_")] = row[i]
|
44
|
+
result[headers[i].to_s.downcase.gsub(" ", "_")] = row[i] unless headers[i].nil?
|
39
45
|
end
|
40
46
|
|
41
47
|
results << result
|
data/lib/rimac/version.rb
CHANGED
data/rimac.gemspec
CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.platform = Gem::Platform::RUBY
|
17
17
|
gem.version = Rimac::VERSION
|
18
18
|
|
19
|
+
gem.license = "MIT"
|
20
|
+
|
19
21
|
gem.files = `git ls-files`.split("\n").sort
|
20
22
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
23
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rimac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Ruby client for Municipalidad Metropolitana de Lima API (http://lima.datosabiertos.pe/)
|
15
15
|
email:
|
@@ -24,7 +24,8 @@ files:
|
|
24
24
|
- lib/rimac/version.rb
|
25
25
|
- rimac.gemspec
|
26
26
|
homepage: https://github.com/hpneo/rimac
|
27
|
-
licenses:
|
27
|
+
licenses:
|
28
|
+
- MIT
|
28
29
|
post_install_message:
|
29
30
|
rdoc_options: []
|
30
31
|
require_paths:
|