citysdk 0.1.2.3 → 0.1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50392a4353759cbdeadbc49b11ad29e4e9482a42
4
- data.tar.gz: ca0cc2ccf7195e1b3e34aef4f79d1c87c182695a
3
+ metadata.gz: 58306c956c274844ad933ff23bd13e62d79159f3
4
+ data.tar.gz: c234c0246373f380e2a83049c8a75086bac4315d
5
5
  SHA512:
6
- metadata.gz: 3be7a3a660bd3af033bf796f646623ef9c458175762daeb91a2f1045cb8a35d7b0f2d013b3246efa1ff739d73777778b5227f18b543f99c63d3e9079572477cd
7
- data.tar.gz: 10aafccd5dcb61cc1a2d0ce3f822f5e86b732360a88dc162e9f432e638bbc048f3879769ae291a68fe96f22f29a3d1743e70e511c9bacd17b181cc288ea2f1d3
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
- @connection = Faraday.new :url => "http://#{@host}:#{@port}"
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'
@@ -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
- s = att_data[field.name]
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 CitySDK::Exception.new("Error unzipping #{path}.", {:originalfile => path}, __FILE__,__LINE__) if not system "unzip '#{path}' -d '#{dir}' > /dev/null 2>&1"
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.new(e.message, {:originalfile => path}, __FILE__,__LINE__)
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
@@ -4,6 +4,6 @@ require 'citysdk/file_reader.rb'
4
4
  require 'citysdk/importer.rb'
5
5
 
6
6
  module CitySDK
7
- VERSION = "0.1.2.3"
7
+ VERSION = "0.1.2.4"
8
8
  end
9
9
 
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.3
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-28 00:00:00.000000000 Z
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dbf