citysdk 0.1.2.3 → 0.1.2.4
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 +4 -4
- data/lib/citysdk/api.rb +8 -2
- data/lib/citysdk/file_reader.rb +3 -10
- data/lib/citysdk.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58306c956c274844ad933ff23bd13e62d79159f3
|
4
|
+
data.tar.gz: c234c0246373f380e2a83049c8a75086bac4315d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57cd31732c470c46eb1693f07c7b5c53c1894faeb619509e07b64419b741cf832d09a54fcf92c95a6cc62e351c554aca9bc597285da0372ad604bd91edbaaba
|
7
|
+
data.tar.gz: 44e380a5950dcd4ab3c9f075fd5f5bc2019cd10f87c3ae975a19384299d0aadca3fdd14ac4435254d304f691668cf438c7c35ff53a8d64daea421b7d9017835d
|
data/lib/citysdk/api.rb
CHANGED
@@ -69,11 +69,17 @@ module CitySDK
|
|
69
69
|
@port = $2
|
70
70
|
@host = $1
|
71
71
|
else
|
72
|
-
@port = 80
|
72
|
+
@port = (host =~ /^https/)? 443 : 80
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
@
|
76
|
+
@host = $2 if @host =~ /^(http|https):\/\/(.*)$/
|
77
|
+
|
78
|
+
if host =~ /^https/
|
79
|
+
@connection = Faraday.new :url => "https://#{@host}:#{@port}", :ssl => {:verify => false}
|
80
|
+
else
|
81
|
+
@connection = Faraday.new :url => "http://#{@host}:#{@port}"
|
82
|
+
end
|
77
83
|
@connection.headers = {
|
78
84
|
:user_agent => 'CitySDK_API GEM ' + CitySDK::VERSION,
|
79
85
|
:content_type => 'application/json'
|
data/lib/citysdk/file_reader.rb
CHANGED
@@ -320,7 +320,6 @@ module CitySDK
|
|
320
320
|
end
|
321
321
|
|
322
322
|
def readShape(path)
|
323
|
-
|
324
323
|
@content = []
|
325
324
|
@file = path
|
326
325
|
|
@@ -338,9 +337,7 @@ module CitySDK
|
|
338
337
|
h[:properties] = {}
|
339
338
|
att_data = shape.data #a Hash
|
340
339
|
shp.fields.each do |field|
|
341
|
-
|
342
|
-
s = s.force_encoding('ISO8859-1') if s.class == String
|
343
|
-
h[:properties][field.name.to_sym] = s
|
340
|
+
h[:properties][field.name.to_sym] = att_data[field.name]
|
344
341
|
end
|
345
342
|
@content << h
|
346
343
|
end
|
@@ -356,10 +353,7 @@ module CitySDK
|
|
356
353
|
def readZip(path)
|
357
354
|
begin
|
358
355
|
Dir.mktmpdir("cdkfi_#{File.basename(path).gsub(/\A/,'')}") do |dir|
|
359
|
-
raise
|
360
|
-
if File.directory?(dir + '/' + File.basename(path).chomp(File.extname(path)))
|
361
|
-
dir = dir + '/' + File.basename(path).chomp(File.extname(path) )
|
362
|
-
end
|
356
|
+
raise "Error unzipping #{path}." if not system "unzip '#{path}' -d '#{dir}' > /dev/null 2>&1"
|
363
357
|
Dir.foreach(dir) do |f|
|
364
358
|
next if f =~ /^\./
|
365
359
|
case File.extname(f)
|
@@ -376,9 +370,8 @@ module CitySDK
|
|
376
370
|
end
|
377
371
|
end
|
378
372
|
rescue Exception => e
|
379
|
-
raise CitySDK::Exception
|
373
|
+
raise CitySDK::Exception(e.message, {:originalfile => path}, __FILE__,__LINE__)
|
380
374
|
end
|
381
|
-
raise CitySDK::Exception.new("Could not proecess file #{path}", {:originalfile => path}, __FILE__,__LINE__)
|
382
375
|
end
|
383
376
|
|
384
377
|
def write(path=nil)
|
data/lib/citysdk.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citysdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.2.
|
4
|
+
version: 0.1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Demeyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dbf
|