emmy-http 0.3.0 → 0.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: 245c9aadcae6350e5530b83c2b7c4ea26dff32e7
4
- data.tar.gz: 64e9aff22e55d02c30098299694b32105121b2e0
3
+ metadata.gz: c3db217642cc4a19a04b9171fdf5e592a5f67d1e
4
+ data.tar.gz: dd2065202e52783ca08c454984fcedef72ddecaa
5
5
  SHA512:
6
- metadata.gz: 5d7c309b72471cba3708b5c5a7e607d6844fdd0cc1d6a51cad68cbfeb359780e93467b11aa03d21967b8d147b953d1d9fecab32d3f84b874db66603b06b95ea2
7
- data.tar.gz: 9332f4ce846ef1270d87423850d22371cf66ea41d0951243d0e87383aa13fb9fe7ac439d6cf80cfb20694c73cb7321c5c9c105d4daffb95643601a2029cd46ce
6
+ metadata.gz: 9548c80f5424446956fa75bcac344e75821f2511c3d8eb9c0ec5c223afd12317ed98d475f35f143f689048627627dbfee1c640827fed49309bdd223d83dbe2cf
7
+ data.tar.gz: 1a96f6c314de4fd25bd99add9b188b459c1e1b4394db74298194234b441094f880f413d8c243ea553990b80bec2bb1d38a5bbae3ed54e357ed9ff889252f6312
@@ -12,10 +12,10 @@ end
12
12
  Gem::Specification.new do |spec|
13
13
  spec.name = "emmy-http"
14
14
  spec.version = EmmyHttp::VERSION
15
- spec.authors = ["inre"]
15
+ spec.authors = ["Maksim V."]
16
16
  spec.email = ["inre.storm@gmail.com"]
17
- spec.summary = %q{EmmyHttp - EventMachine's HTTP Client}
18
- #spec.description = %q{TODO: Write a longer description. Optional.}
17
+ spec.summary = %q{Ruby HTTP interface}
18
+ spec.description = spec.summary
19
19
  spec.homepage = ""
20
20
  spec.license = "MIT"
21
21
 
@@ -24,15 +24,15 @@ Gem::Specification.new do |spec|
24
24
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "event_object", "~> 0.9"
27
+ spec.add_dependency "event_object", "~> 1"
28
28
  spec.add_dependency "emmy-machine", "~> 0.2"
29
- spec.add_dependency "fibre", "~> 0.9"
29
+ spec.add_dependency "fibre", "~> 1"
30
30
  spec.add_dependency "util_pack", "~> 0.1"
31
- spec.add_dependency "model_pack", "~> 0.9"
32
- spec.add_dependency "addressable", "~> 2.3"
31
+ spec.add_dependency "model_pack", "~> 1"
32
+ spec.add_dependency "addressable", "~> 2.5"
33
33
 
34
34
  spec.add_development_dependency "eventmachine", "~> 1.0"
35
- spec.add_development_dependency "bundler", "~> 1.6"
36
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "bundler", "~> 1.12"
36
+ spec.add_development_dependency "rake", "~> 10"
37
37
  spec.add_development_dependency "rspec", "~> 3"
38
38
  end
@@ -28,7 +28,7 @@ module EmmyHttp
28
28
  autoload :Request, "emmy_http/request"
29
29
  autoload :Operation, "emmy_http/operation"
30
30
  autoload :Response, "emmy_http/response"
31
- autoload :Timeout, "emmy_http/timeout"
31
+ autoload :Timer, "emmy_http/timer"
32
32
  autoload :Utils, "emmy_http/utils"
33
33
  autoload :Model, "emmy_http/model"
34
34
 
@@ -61,11 +61,11 @@ module EmmyHttp
61
61
  define_method name do |path, as: nil|
62
62
  instance.api[as] = {path: path}
63
63
  if as
64
- cdef as.to_s do |a=nil|
64
+ define_singleton_method as.to_s do |a=nil|
65
65
  request(path: path).tap { |r| r.update_attributes(a) if a }
66
66
  end
67
67
 
68
- cdef "#{as}!" do |*a, &b|
68
+ define_singleton_method "#{as}!" do |*a, &b|
69
69
  send(as, *a, &b).operation
70
70
  end
71
71
  end
@@ -25,8 +25,8 @@ module EmmyHttp
25
25
  EmmyMachine.reconnect(*self)
26
26
  end
27
27
 
28
- def sync
29
- Fiber.sync do |fiber|
28
+ def await
29
+ Fiber.await do |fiber|
30
30
  # create connection
31
31
  connect
32
32
 
@@ -50,8 +50,8 @@ module EmmyHttp
50
50
 
51
51
  alias op operation
52
52
 
53
- def sync
54
- operation.sync
53
+ def await
54
+ operation.await
55
55
  end
56
56
 
57
57
  def real_url
@@ -15,17 +15,6 @@ module EmmyHttp
15
15
  end
16
16
  end
17
17
 
18
- def sync
19
- Fiber.sync do |fiber|
20
- # create connection
21
- start
22
-
23
- on :timeout do
24
- fiber.resume true
25
- end
26
- end
27
- end
28
-
29
18
  def await
30
19
  Fiber.await do |fiber|
31
20
  # create connection
@@ -1,3 +1,3 @@
1
1
  module EmmyHttp
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4"
3
3
  end
@@ -25,14 +25,14 @@ describe EmmyHttp::Model do
25
25
  end
26
26
 
27
27
  around do |example|
28
- EmmyMachine.run_block &example
28
+ EmmyMachine.run_once &example
29
29
  end
30
30
 
31
31
  it "has requests from model" do
32
32
  res = {
33
33
  get_response: HTTPBin.get_request!,
34
34
  post_response: HTTPBin.post_request!(form: {a: 5, b: 6})
35
- }.sync
35
+ }.await
36
36
 
37
37
  expect(res[:get_response].status).to be(200)
38
38
  expect(res[:post_response].status).to be(200)
@@ -41,7 +41,7 @@ describe EmmyHttp::Model do
41
41
  it "inherits models" do
42
42
  http_req = HTTPBin.get_request
43
43
  https_req = HTTPSBin.get_request
44
- https_req.sync
44
+ https_req.await
45
45
  expect(http_req.real_url.to_s).to eq('http://httpbin.org')
46
46
  expect(https_req.real_url.to_s).to eq('https://httpbin.org')
47
47
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  using EventObject
3
3
 
4
4
  describe EmmyHttp::Response do
5
- it "should response filled with chunks" do
5
+ it "concatinates chunks in body string" do
6
6
  subject.data!('hello')
7
7
  subject.data!('world')
8
8
 
@@ -11,16 +11,16 @@ describe EmmyHttp do
11
11
  end
12
12
 
13
13
  around do |example|
14
- EmmyMachine.run_block &example
14
+ EmmyMachine.run_once &example
15
15
  end
16
16
 
17
17
  it "should send HTTP-request with the fake adapter" do
18
18
  request = EmmyHttp::Request.new(
19
19
  type: 'get',
20
- url: 'http://google.com'
20
+ url: 'http://httpbin.org'
21
21
  )
22
22
  operation = EmmyHttp::Operation.new(request, FakeAdapter.new)
23
- response = operation.sync
23
+ response = operation.await
24
24
 
25
25
  expect(response.status).to be 200
26
26
  expect(response.headers).to include("Content-Type")
@@ -28,7 +28,7 @@ describe EmmyHttp do
28
28
  end
29
29
 
30
30
  it "should send HTTP-request using the short syntax" do
31
- response = request(adapter: FakeAdapter, raise_error: false).get('http://google.com').sync
31
+ response = request(adapter: FakeAdapter, raise_error: false).get('http://google.com').await
32
32
 
33
33
  expect(response).to_not be nil
34
34
  expect(response.status).to be 200
@@ -39,9 +39,9 @@ describe EmmyHttp do
39
39
  it "should send several requests in parallel" do
40
40
  req = request(adapter: FakeAdapter, raise_error: false)
41
41
  responses = {
42
- a: [req.copy.get('http://google.com'), req.copy.get('http://google.com')],
43
- b: req.copy.get('http://google.com')
44
- }.sync!
42
+ a: [req.copy.get('http://httpbin.org'), req.copy.get('http://httpbin.org')],
43
+ b: req.copy.get('http://httpbin.org')
44
+ }.await!
45
45
 
46
46
  expect(responses[:a][0].status).to be 200
47
47
  expect(responses[:a][1].status).to be 200
@@ -49,8 +49,8 @@ describe EmmyHttp do
49
49
  end
50
50
 
51
51
  it "should be waiting couple seconds" do
52
- timeout = EmmyHttp::Timeout.new(2)
53
- res = timeout.sync
52
+ timeout = EmmyHttp::Timer.new(2)
53
+ res = timeout.await
54
54
 
55
55
  expect(res).to be true
56
56
  end
@@ -58,10 +58,10 @@ describe EmmyHttp do
58
58
  it "should pack settings of the request in the Hash/Array structure" do
59
59
  request = EmmyHttp::Request.new(
60
60
  type: 'get',
61
- url: 'http://google.com'
61
+ url: 'http://httpbin.org'
62
62
  )
63
63
  request_hash = request.serializable_hash
64
64
 
65
- expect(request_hash).to include(type: 'get', url: 'http://google.com')
65
+ expect(request_hash).to include(type: 'get', url: 'http://httpbin.org')
66
66
  end
67
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emmy-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
- - inre
7
+ - Maksim V.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_object
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.9'
26
+ version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: emmy-machine
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.9'
47
+ version: '1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.9'
54
+ version: '1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: util_pack
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.9'
75
+ version: '1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.9'
82
+ version: '1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: addressable
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.3'
89
+ version: '2.5'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.3'
96
+ version: '2.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: eventmachine
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.6'
117
+ version: '1.12'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.6'
124
+ version: '1.12'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '10.0'
131
+ version: '10'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '10.0'
138
+ version: '10'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '3'
153
- description:
153
+ description: Ruby HTTP interface
154
154
  email:
155
155
  - inre.storm@gmail.com
156
156
  executables: []
@@ -177,7 +177,6 @@ files:
177
177
  - lib/emmy_http/utils.rb
178
178
  - lib/emmy_http/version.rb
179
179
  - spec/emmy_http/model_spec.rb
180
- - spec/emmy_http/request_spec.rb
181
180
  - spec/emmy_http/response_spec.rb
182
181
  - spec/emmy_http_spec.rb
183
182
  - spec/fakes.rb
@@ -205,12 +204,10 @@ rubyforge_project:
205
204
  rubygems_version: 2.5.1
206
205
  signing_key:
207
206
  specification_version: 4
208
- summary: EmmyHttp - EventMachine's HTTP Client
207
+ summary: Ruby HTTP interface
209
208
  test_files:
210
209
  - spec/emmy_http/model_spec.rb
211
- - spec/emmy_http/request_spec.rb
212
210
  - spec/emmy_http/response_spec.rb
213
211
  - spec/emmy_http_spec.rb
214
212
  - spec/fakes.rb
215
213
  - spec/spec_helper.rb
216
- has_rdoc:
@@ -1,5 +0,0 @@
1
- require "spec_helper"
2
- using EventObject
3
-
4
- describe EmmyHttp::Request do
5
- end