emmy-http 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d26296dca8f3723e6a546df57216f76bcac7b0d7
4
- data.tar.gz: 703a92886d8d7d49ad9d1d3b23f0aa45fc7a8b27
3
+ metadata.gz: 8ee8be3827495aa336fb2971686ad1cbfa901e53
4
+ data.tar.gz: 72d47e9269d8dd829ecb9926260fda5189a91659
5
5
  SHA512:
6
- metadata.gz: 7ba57901437a6bf3168f8e9eed31f9782f97adae2ec1a02597bd070b96502e34a6e0023e8a678d6773a619cc4886f4cf1b36dfef14927f8f2d2c73b9da68e6d0
7
- data.tar.gz: f99f6ac836f5be0312df16339a0f0d5d482a1d1c34ec83af52c11b702e77043578252bf867792343686e42e7dcc4168c7031ddd34dcd45f52da9130ac4c12745
6
+ metadata.gz: b22d65f1c793b2ce8b12b16ef64080f65713d7d4b93b7f25eb53d794b41d5c558639422b7ee0d883e72412f96bd79b9fffdcbc4fdc346e686fe4396062d0d84b
7
+ data.tar.gz: aba78e417ac83c315bbf118e5e5b990394fdc49979853ded65a37d18d6b9adca5f641762444e3eaab76d87d1b752558d4c6ebda6221d162cd0b133566c5481a3
@@ -1,15 +1,26 @@
1
1
  module EmmyHttp
2
2
  class Response
3
+ using EventObject
3
4
  include ModelPack::Document
4
5
 
5
6
  attribute :status
6
7
  dictionary :headers, writer: -> (head) { EmmyHttp::Utils.convert_headers(head) }
7
8
  attribute :body
8
9
 
10
+ events :data
11
+
12
+ def initialize
13
+ on :data do |chunk|
14
+ body << chunk
15
+ end
16
+
17
+ reset
18
+ end
19
+
9
20
  def reset
10
21
  @status = 0
11
22
  @headers = {}
12
- @body = nil
23
+ @body = ''
13
24
  end
14
25
 
15
26
  def chunked_encoding?
@@ -1,3 +1,3 @@
1
1
  module EmmyHttp
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,11 @@
1
+ require "spec_helper"
2
+ using EventObject
3
+
4
+ describe EmmyHttp::Response do
5
+ it "should response filled with chunks" do
6
+ subject.data!('hello')
7
+ subject.data!('world')
8
+
9
+ expect(subject.body).to eq('helloworld')
10
+ end
11
+ end
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ using EventObject
2
3
 
3
4
  describe EmmyHttp do
4
5
  Connection = EmmyMachine::Connection
@@ -20,7 +21,6 @@ describe EmmyHttp do
20
21
  class FakeAdapter
21
22
  attr_accessor :delegate
22
23
  include EmmyHttp::Adapter
23
- using EventObject
24
24
 
25
25
  def initialize_connection
26
26
  self.delegate.init! delegate
@@ -91,6 +91,5 @@ describe EmmyHttp do
91
91
  EventMachine.stop
92
92
  end
93
93
  expect(request_hash).to include(type: 'get', url: 'http://google.com')
94
-
95
94
  end
96
95
  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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - inre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fibre
@@ -122,6 +122,7 @@ files:
122
122
  - lib/emmy_http/version.rb
123
123
  - pkg/emmy-http-0.1.0.gem
124
124
  - pkg/emmy-http-0.1.1.gem
125
+ - spec/emmy_http/response_spec.rb
125
126
  - spec/emmy_http_spec.rb
126
127
  - spec/spec_helper.rb
127
128
  homepage: ''
@@ -149,5 +150,6 @@ signing_key:
149
150
  specification_version: 4
150
151
  summary: EmmyHttp is a
151
152
  test_files:
153
+ - spec/emmy_http/response_spec.rb
152
154
  - spec/emmy_http_spec.rb
153
155
  - spec/spec_helper.rb