simple-mappr 0.1.4 → 0.1.5

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: 240e070b736fb1b10a5edc3ddc376686509876be
4
- data.tar.gz: 521907f01de62174a16938be0e5448a70f8e3c9b
3
+ metadata.gz: d93f123b34119994c306a3fa2ca297090d2a39d0
4
+ data.tar.gz: 21df503f135df9b43bd01f555b0e9d76894260de
5
5
  SHA512:
6
- metadata.gz: bd59cbd4bdbdaa598cb02972166badf875627e1b62428cbd56ba71c11af1995272079c2dc1d10400a4ed46399ba209c1e92e4ec8add2ae64bd7d5ea9479c083b
7
- data.tar.gz: ee1311deadf391be39c791d67b67a92c4ade0fdfcd4caf3c31b0e97e91a69796172c77a71e9807c99c2de780b50fe5688c6077c999edb0545fa01ddb9d363c82
6
+ metadata.gz: ae8e34b0206fdea1da7f51c115b50b6bd614125456e2b0161976cd1cf99c0007e9e82b474c95fbd14a1d6e12faca7accffb938e18fcfedae32d9eece1e8e9433
7
+ data.tar.gz: 399e60f6686051b5e3d25d268bf112cce68e05892b81298102c2c95cedac457a7ea75c6f4a4ad40b5dd12796373e1199df1d5bcff3774c7bc9aa0b9bc6480f1c
@@ -58,11 +58,9 @@ class SimpleMappr
58
58
  if !file_title
59
59
  raise InvalidParameterValue, "File path is required"
60
60
  end
61
- file = [file_title,output].join(".")
62
- File.open(file, 'wb') do |fo|
63
- fo.write(Transporter.send_data(@parameters, true))
64
- end
65
- file
61
+ file_name = [file_title,output].join(".")
62
+ IO.copy_stream(open(create[:imageURL]), file_name)
63
+ file_name
66
64
  end
67
65
 
68
66
  ##
@@ -6,15 +6,13 @@ require "simple-mappr/validator"
6
6
  class SimpleMappr
7
7
  class Transporter
8
8
 
9
- def self.send_data params, download = false
9
+ def self.send_data params
10
10
  Validator.validate_type(params, 'Hash')
11
11
  params.delete_if{ |k,v| v.nil? }
12
- RestClient.post(API_URL, params) do |response, request, result, &block|
13
- if response.code == 303 && download
14
- response.follow_redirection
15
- else
16
- JSON.parse(response.body, :symbolize_names => true)
17
- end
12
+ begin
13
+ RestClient::Request.execute(method: :post, url: API_URL, payload: params, max_redirects: 0)
14
+ rescue RestClient::ExceptionWithResponse => err
15
+ JSON.parse(err.response.body, :symbolize_names => true)
18
16
  end
19
17
  end
20
18
 
@@ -1,5 +1,5 @@
1
1
  class SimpleMappr
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-mappr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse