firering 1.2.0 → 1.2.1

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.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/README.rdoc CHANGED
@@ -84,6 +84,7 @@ For more details take a look at spec/fixtures/load_server.rb file.
84
84
  * indirect (Andre Arko), https://github.com/EmmanuelOga/firering/pull/1 ,
85
85
  https://github.com/EmmanuelOga/firering/pull/2 ,
86
86
  https://github.com/EmmanuelOga/firering/pull/3
87
+ https://github.com/EmmanuelOga/firering/pull/7
87
88
  * caius (Caius Durling), https://github.com/EmmanuelOga/firering/pull/5
88
89
  * cesario (Franck Verrot), https://github.com/EmmanuelOga/firering/pull/6
89
90
  * PizzaPowered, https://github.com/PizzaPowered/firering
data/firering.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'firering'
7
- s.version = '1.2.0'
8
- s.date = '2011-08-08'
7
+ s.version = '1.2.1'
8
+ s.date = '2011-09-27'
9
9
  s.rubyforge_project = 'firering'
10
10
 
11
11
  s.summary = "Campfire API interface powered by eventmachine em-http-request and yajl-ruby."
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
 
33
33
  # = MANIFEST =
34
34
  s.files = %w[
35
+ Gemfile
35
36
  LICENSE
36
37
  README.rdoc
37
38
  Rakefile
@@ -64,8 +64,14 @@ module Firering
64
64
  http.callback {
65
65
  reset_retries_counter
66
66
  if callback
67
- data = Yajl::Parser.parse(http.response, :symbolize_keys => true) rescue Hash.new
68
- callback.call(data, http)
67
+ begin
68
+ data = Yajl::Parser.parse(http.response, :symbolize_keys => true)
69
+ callback.call(data, http)
70
+ rescue Yajl::ParseError
71
+ perform_retry(http) do
72
+ http(method, path, data, &callback)
73
+ end
74
+ end
69
75
  end
70
76
  }
71
77
 
@@ -15,13 +15,9 @@ module Firering
15
15
  if instance.respond_to?(setter)
16
16
  instance.send(setter, value)
17
17
  else
18
- warning = "WARNING: Tried to set #{setter} #{value.inspect} on a #{instance.class} instance but it didn't respond. Probably the API got updated, please report this! (https://github.com/EmmanuelOga/firering/issues)"
19
-
20
- if conn && conn.logger
21
- conn.logger.warn warning
22
- else
23
- Kernel.warn warning
24
- end
18
+ msg = "WARNING: Could not set attribute '#{key}' to value '#{value}' on #{self} object."
19
+ msg << " It is likely the Campfire API has changed. Please report this! (https://github.com/EmmanuelOga/firering/issues)"
20
+ conn.logger.warn msg
25
21
  end
26
22
  end
27
23
 
data/lib/firering.rb CHANGED
@@ -5,7 +5,7 @@ require 'yajl'
5
5
  require 'em-http'
6
6
 
7
7
  module Firering
8
- VERSION = '1.2.0'
8
+ VERSION = '1.2.1'
9
9
 
10
10
  Error = Class.new(StandardError)
11
11
 
@@ -7,12 +7,24 @@ class TestData
7
7
  end
8
8
 
9
9
  describe Firering::Instantiator do
10
+ before do
11
+ @logger = mock("logger")
12
+ @connection = mock("connection", :logger => @logger)
13
+ end
10
14
 
11
15
  it "initializes an object from a hash with a base key" do
12
- object = TestData.instantiate(:connection, {:test_data => { :a => 1, :b => 2}}, :test_data)
16
+ object = TestData.instantiate(@connection, {:test_data => { :a => 1, :b => 2}}, :test_data)
13
17
  object.a.should == 1
14
18
  object.b.should == 2
15
- object.connection.should == :connection
19
+ object.connection.should == @connection
20
+ end
21
+
22
+ it "warns when attributes don't exist on the struct" do
23
+ warning = "WARNING: Could not set attribute 'c' to value '3' on TestData object."
24
+ warning << " It is likely the Campfire API has changed. Please report this! (https://github.com/EmmanuelOga/firering/issues)"
25
+ @logger.should_receive(:warn).with(warning)
26
+ object = TestData.instantiate(@connection, {:test_data => {:c => 3}}, :test_data)
27
+ lambda { object.c }.should raise_error(NoMethodError)
16
28
  end
17
29
 
18
30
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firering
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 29
4
5
  prerelease:
5
- version: 1.2.0
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 1
10
+ version: 1.2.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - Emmanuel Oga
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-08-08 00:00:00 -03:00
18
+ date: 2011-09-27 00:00:00 -03:00
14
19
  default_executable: campf-notify
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,11 @@ dependencies:
21
26
  requirements:
22
27
  - - ~>
23
28
  - !ruby/object:Gem::Version
29
+ hash: 59
30
+ segments:
31
+ - 0
32
+ - 12
33
+ - 10
24
34
  version: 0.12.10
25
35
  type: :runtime
26
36
  version_requirements: *id001
@@ -32,6 +42,11 @@ dependencies:
32
42
  requirements:
33
43
  - - ~>
34
44
  - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 0
48
+ - 3
49
+ - 0
35
50
  version: 0.3.0
36
51
  type: :runtime
37
52
  version_requirements: *id002
@@ -43,6 +58,11 @@ dependencies:
43
58
  requirements:
44
59
  - - ~>
45
60
  - !ruby/object:Gem::Version
61
+ hash: 15
62
+ segments:
63
+ - 0
64
+ - 7
65
+ - 6
46
66
  version: 0.7.6
47
67
  type: :runtime
48
68
  version_requirements: *id003
@@ -54,6 +74,11 @@ dependencies:
54
74
  requirements:
55
75
  - - ~>
56
76
  - !ruby/object:Gem::Version
77
+ hash: 11
78
+ segments:
79
+ - 2
80
+ - 1
81
+ - 0
57
82
  version: 2.1.0
58
83
  type: :development
59
84
  version_requirements: *id004
@@ -65,6 +90,11 @@ dependencies:
65
90
  requirements:
66
91
  - - ">="
67
92
  - !ruby/object:Gem::Version
93
+ hash: 31
94
+ segments:
95
+ - 1
96
+ - 2
97
+ - 0
68
98
  version: 1.2.0
69
99
  type: :development
70
100
  version_requirements: *id005
@@ -78,6 +108,7 @@ extra_rdoc_files:
78
108
  - README.rdoc
79
109
  - LICENSE
80
110
  files:
111
+ - Gemfile
81
112
  - LICENSE
82
113
  - README.rdoc
83
114
  - Rakefile
@@ -155,12 +186,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
186
  requirements:
156
187
  - - ">="
157
188
  - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 0
158
192
  version: "0"
159
193
  required_rubygems_version: !ruby/object:Gem::Requirement
160
194
  none: false
161
195
  requirements:
162
196
  - - ">="
163
197
  - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
164
201
  version: "0"
165
202
  requirements: []
166
203