grape-client-generator 1.0.2 → 1.0.3

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: 8eebd19c68f48eeb55b4a94220dd453d85bb29a2
4
- data.tar.gz: 508f6dd7c141b89d6be3ca72a41b4330766716e8
3
+ metadata.gz: 566aaf7d205d984fe45cca034afaec1220d3f258
4
+ data.tar.gz: f69e07116315a31d7e380e0ee7cb79d9818fae34
5
5
  SHA512:
6
- metadata.gz: 68b63ee89e46660e06b1bbf8c7be7faf8fe4691c12f705051460dd263541c895c16e972c550e8009ab8c6a5e4307e37f31a9c2d8b3876268dcb2b3a0fc29351b
7
- data.tar.gz: 83261005096cf5b3a542aa6f057be6fd8150714909adaf6ab9a690c916f562d024b2aa31740776fd238539083b713f69e7959bf81f3b05c955f4944452635c8d
6
+ metadata.gz: 1388c6e637e3360b19f8fccf8eb58d3aed13c730ca39388959e03e0e6d01f5bb0e5ec1fe8ef54696e4165d5c6add0de4149126754f38a24411c3ec30630799d9
7
+ data.tar.gz: f0687cc8ee2e3fd557092359b6668b83bdee4a0801a2b5aacaff253fd4ad5668651ccf68a576bf8271374770ad2be5c8fb55bc52c710c2f800a2dfe5e2393e95
@@ -1,3 +1,7 @@
1
+ == 1.0.3
2
+
3
+ * Fix URI.parse issue that causes errors when a subdomain contains underscores.
4
+
1
5
  == 1.0.2
2
6
 
3
7
  * Agnostically replace path params (i.e. try both string/symbol as hash key).
@@ -80,7 +80,7 @@ module {{namespace}}
80
80
  end
81
81
 
82
82
  def post(url, params)
83
- uri = URI.parse(url)
83
+ uri = parse_uri(url)
84
84
  http = Net::HTTP.new(uri.host, uri.port)
85
85
  request = Net::HTTP::Post.new(uri.path)
86
86
  request.body = make_param_string(params)
@@ -89,9 +89,19 @@ module {{namespace}}
89
89
  end
90
90
 
91
91
  def get(url)
92
- resp = Net::HTTP.get_response(URI.parse(url))
92
+ resp = Net::HTTP.get_response(parse_uri(url))
93
93
  resp.body
94
94
  end
95
95
 
96
+ # hack to handle bug in URI.parse, which doesn't allow subdomains to contain underscores
97
+ def parse_uri(url = nil)
98
+ URI.parse(url)
99
+ rescue URI::InvalidURIError
100
+ host = url.match(".+\:\/\/([^\/]+)")[1]
101
+ uri = URI.parse(url.sub(host, 'dummy-host'))
102
+ uri.instance_variable_set('@host', host)
103
+ uri
104
+ end
105
+
96
106
  end
97
107
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Grape
4
4
  module ClientGenerator
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-client-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-18 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.0.3
73
+ rubygems_version: 2.1.5
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Automatically generate clients for your Grape APIs.