ethon 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +34 -19
- data/lib/ethon/curl.rb +10 -6
- data/lib/ethon/curls/classes.rb +0 -5
- data/lib/ethon/curls/functions.rb +1 -0
- data/lib/ethon/easy/http.rb +16 -5
- data/lib/ethon/easy/http/custom.rb +28 -0
- data/lib/ethon/version.rb +1 -1
- metadata +6 -5
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,26 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
-
[Full Changelog](
|
5
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.10...master)
|
6
|
+
|
7
|
+
## 0.5.10
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.9...v0.5.10)
|
10
|
+
|
11
|
+
Enhancements:
|
12
|
+
|
13
|
+
* Allow custom requests.
|
14
|
+
([nate](https://github.com/nate), [\#36](https://github.com/typhoeus/ethon/pull/36))
|
15
|
+
* Use updated version of FFI.
|
16
|
+
|
17
|
+
Bugfixes:
|
18
|
+
|
19
|
+
* Fix windows install issue.
|
20
|
+
([brainsucker](https://github.com/brainsucker), [\#38](https://github.com/typhoeus/ethon/pull/38))
|
6
21
|
|
7
22
|
## 0.5.9
|
8
23
|
|
9
|
-
[Full Changelog](
|
24
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.8...v0.5.9)
|
10
25
|
|
11
26
|
Enhancements:
|
12
27
|
|
@@ -14,7 +29,7 @@ Enhancements:
|
|
14
29
|
|
15
30
|
## 0.5.8
|
16
31
|
|
17
|
-
[Full Changelog](
|
32
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.7...v0.5.8)
|
18
33
|
|
19
34
|
Enhancements:
|
20
35
|
|
@@ -24,7 +39,7 @@ Enhancements:
|
|
24
39
|
|
25
40
|
## 0.5.7
|
26
41
|
|
27
|
-
[Full Changelog](
|
42
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.6...v0.5.7)
|
28
43
|
|
29
44
|
Enhancements:
|
30
45
|
|
@@ -32,7 +47,7 @@ Enhancements:
|
|
32
47
|
|
33
48
|
## 0.5.6
|
34
49
|
|
35
|
-
[Full Changelog](
|
50
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.4...v0.5.6)
|
36
51
|
|
37
52
|
Bugfixes:
|
38
53
|
|
@@ -40,7 +55,7 @@ Bugfixes:
|
|
40
55
|
|
41
56
|
## 0.5.4
|
42
57
|
|
43
|
-
[Full Changelog](
|
58
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.3...v0.5.4)
|
44
59
|
|
45
60
|
Enhancements:
|
46
61
|
|
@@ -50,7 +65,7 @@ Enhancements:
|
|
50
65
|
|
51
66
|
## 0.5.3
|
52
67
|
|
53
|
-
[Full Changelog](
|
68
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.2...v0.5.3)
|
54
69
|
|
55
70
|
Enhancements:
|
56
71
|
|
@@ -65,7 +80,7 @@ Bugfixes:
|
|
65
80
|
|
66
81
|
## 0.5.2
|
67
82
|
|
68
|
-
[Full Changelog](
|
83
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.1...v0.5.2)
|
69
84
|
|
70
85
|
Enhancements:
|
71
86
|
|
@@ -78,7 +93,7 @@ Bugfixes:
|
|
78
93
|
|
79
94
|
## 0.5.1
|
80
95
|
|
81
|
-
[Full Changelog](
|
96
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.5.0...v0.5.1)
|
82
97
|
|
83
98
|
Bugfixes:
|
84
99
|
|
@@ -87,7 +102,7 @@ Bugfixes:
|
|
87
102
|
|
88
103
|
## 0.5.0
|
89
104
|
|
90
|
-
[Full Changelog](
|
105
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.4.4...v0.5.0)
|
91
106
|
|
92
107
|
Enhancements:
|
93
108
|
|
@@ -101,7 +116,7 @@ Bugfixes:
|
|
101
116
|
|
102
117
|
## 0.4.4
|
103
118
|
|
104
|
-
[Full Changelog](
|
119
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.4.3...v0.4.4)
|
105
120
|
|
106
121
|
Enhancements:
|
107
122
|
|
@@ -109,7 +124,7 @@ Enhancements:
|
|
109
124
|
|
110
125
|
## 0.4.3
|
111
126
|
|
112
|
-
[Full Changelog](
|
127
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.4.2...v0.4.3)
|
113
128
|
|
114
129
|
Enhancements:
|
115
130
|
|
@@ -124,7 +139,7 @@ Bugfixes:
|
|
124
139
|
|
125
140
|
## 0.4.2
|
126
141
|
|
127
|
-
[Full Changelog](
|
142
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.4.1...v0.4.2)
|
128
143
|
|
129
144
|
Enhancements:
|
130
145
|
|
@@ -133,7 +148,7 @@ Enhancements:
|
|
133
148
|
|
134
149
|
## 0.4.1
|
135
150
|
|
136
|
-
[Full Changelog](
|
151
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.4.0...v0.4.1)
|
137
152
|
|
138
153
|
Bugfixes:
|
139
154
|
|
@@ -142,7 +157,7 @@ Bugfixes:
|
|
142
157
|
|
143
158
|
## 0.4.0
|
144
159
|
|
145
|
-
[Full Changelog](
|
160
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.3.0...v0.4.0)
|
146
161
|
|
147
162
|
Enhancements:
|
148
163
|
|
@@ -157,7 +172,7 @@ Bugfixes:
|
|
157
172
|
|
158
173
|
## 0.3.0
|
159
174
|
|
160
|
-
[Full Changelog](
|
175
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.2.0...v0.3.0)
|
161
176
|
|
162
177
|
Enhancements:
|
163
178
|
|
@@ -170,7 +185,7 @@ Bugfixes:
|
|
170
185
|
|
171
186
|
## 0.2.0
|
172
187
|
|
173
|
-
[Full Changelog](
|
188
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.1.0...v0.2.0)
|
174
189
|
|
175
190
|
Enhancements:
|
176
191
|
|
@@ -182,7 +197,7 @@ Enhancements:
|
|
182
197
|
|
183
198
|
## 0.1.0
|
184
199
|
|
185
|
-
[Full Changelog](
|
200
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.0.2...v0.1.0)
|
186
201
|
|
187
202
|
Enhancements:
|
188
203
|
|
@@ -198,7 +213,7 @@ Bugfixes:
|
|
198
213
|
|
199
214
|
## 0.0.2
|
200
215
|
|
201
|
-
[Full Changelog](
|
216
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.0.1...v0.0.2)
|
202
217
|
|
203
218
|
Bugfixes:
|
204
219
|
|
data/lib/ethon/curl.rb
CHANGED
@@ -28,18 +28,22 @@ module Ethon
|
|
28
28
|
extend Ethon::Curls::Messages
|
29
29
|
extend Ethon::Curls::Protocols
|
30
30
|
|
31
|
+
# :nodoc:
|
32
|
+
def self.windows?
|
33
|
+
!(RbConfig::CONFIG['host_os'] !~ /mingw|mswin|bccwin/)
|
34
|
+
end
|
31
35
|
|
32
|
-
|
33
|
-
require 'ethon/curls/settings'
|
34
|
-
require 'ethon/curls/classes'
|
35
|
-
extend Ethon::Curls::Functions
|
36
|
-
|
37
|
-
if windows?
|
36
|
+
if Curl.windows?
|
38
37
|
ffi_lib 'ws2_32'
|
39
38
|
else
|
40
39
|
ffi_lib ::FFI::Library::LIBC
|
41
40
|
end
|
42
41
|
|
42
|
+
require 'ethon/curls/constants'
|
43
|
+
require 'ethon/curls/settings'
|
44
|
+
require 'ethon/curls/classes'
|
45
|
+
extend Ethon::Curls::Functions
|
46
|
+
|
43
47
|
@blocking = true
|
44
48
|
|
45
49
|
@@initialized = false
|
data/lib/ethon/curls/classes.rb
CHANGED
@@ -10,11 +10,6 @@ module Ethon
|
|
10
10
|
layout :code, :msg_code, :easy_handle, :pointer, :data, MsgData
|
11
11
|
end
|
12
12
|
|
13
|
-
# :nodoc:
|
14
|
-
def Curl.windows?
|
15
|
-
!(RbConfig::CONFIG['host_os'] !~ /mingw|mswin|bccwin/)
|
16
|
-
end
|
17
|
-
|
18
13
|
# :nodoc:
|
19
14
|
class FDSet < ::FFI::Struct
|
20
15
|
if Curl.windows?
|
@@ -49,6 +49,7 @@ module Ethon
|
|
49
49
|
base.attach_function :slist_append, :curl_slist_append, [:pointer, :string], :pointer
|
50
50
|
base.attach_function :slist_free_all, :curl_slist_free_all, [:pointer], :void
|
51
51
|
base.instance_variable_set(:@blocking, true)
|
52
|
+
|
52
53
|
base.attach_function :select, [:int, Curl::FDSet.ptr, Curl::FDSet.ptr, Curl::FDSet.ptr, Curl::Timeval.ptr], :int
|
53
54
|
end
|
54
55
|
end
|
data/lib/ethon/easy/http.rb
CHANGED
@@ -6,6 +6,7 @@ require 'ethon/easy/http/put'
|
|
6
6
|
require 'ethon/easy/http/delete'
|
7
7
|
require 'ethon/easy/http/patch'
|
8
8
|
require 'ethon/easy/http/options'
|
9
|
+
require 'ethon/easy/http/custom'
|
9
10
|
|
10
11
|
module Ethon
|
11
12
|
class Easy
|
@@ -35,7 +36,7 @@ module Ethon
|
|
35
36
|
#
|
36
37
|
# @see Ethon::Easy::Options
|
37
38
|
def http_request(url, action_name, options = {})
|
38
|
-
fabricate(
|
39
|
+
fabricate(url, action_name, options).setup(self)
|
39
40
|
end
|
40
41
|
|
41
42
|
private
|
@@ -44,13 +45,23 @@ module Ethon
|
|
44
45
|
#
|
45
46
|
# @example Return the action.
|
46
47
|
# Action.fabricate(:get)
|
48
|
+
# Action.fabricate(:smash)
|
47
49
|
#
|
48
|
-
# @param [ String ]
|
50
|
+
# @param [ String ] url The url.
|
51
|
+
# @param [ String ] action_name The http action name.
|
52
|
+
# @param [ Hash ] options The option hash.
|
49
53
|
#
|
50
|
-
# @return [
|
51
|
-
def fabricate(action_name)
|
52
|
-
|
54
|
+
# @return [ Easy::Ethon::Actionable ] The request instance.
|
55
|
+
def fabricate(url, action_name, options)
|
56
|
+
constant_name = action_name.to_s.capitalize
|
57
|
+
|
58
|
+
if Ethon::Easy::Http.const_defined?(constant_name)
|
59
|
+
Ethon::Easy::Http.const_get(constant_name).new(url, options)
|
60
|
+
else
|
61
|
+
Ethon::Easy::Http::Custom.new(constant_name.upcase, url, options)
|
62
|
+
end
|
53
63
|
end
|
64
|
+
|
54
65
|
end
|
55
66
|
end
|
56
67
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Ethon
|
2
|
+
class Easy
|
3
|
+
module Http
|
4
|
+
|
5
|
+
# This class knows everything about making requests for custom HTTP verbs.
|
6
|
+
class Custom
|
7
|
+
include Ethon::Easy::Http::Actionable
|
8
|
+
include Ethon::Easy::Http::Postable
|
9
|
+
|
10
|
+
def initialize(verb, url, options)
|
11
|
+
@verb = verb
|
12
|
+
super(url, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Setup easy to make a request.
|
16
|
+
#
|
17
|
+
# @example Setup.
|
18
|
+
# custom.set_params(easy)
|
19
|
+
#
|
20
|
+
# @param [ Easy ] easy The easy to setup.
|
21
|
+
def setup(easy)
|
22
|
+
super
|
23
|
+
easy.customrequest = @verb
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/ethon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
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-
|
12
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.3.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: mime-types
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- lib/ethon/easy/form.rb
|
70
70
|
- lib/ethon/easy/header.rb
|
71
71
|
- lib/ethon/easy/http/actionable.rb
|
72
|
+
- lib/ethon/easy/http/custom.rb
|
72
73
|
- lib/ethon/easy/http/delete.rb
|
73
74
|
- lib/ethon/easy/http/get.rb
|
74
75
|
- lib/ethon/easy/http/head.rb
|
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
125
|
version: '0'
|
125
126
|
segments:
|
126
127
|
- 0
|
127
|
-
hash:
|
128
|
+
hash: -82910396977477483
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
none: false
|
130
131
|
requirements:
|