amaze_sns 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/lib/amaze/topic.rb +4 -11
- metadata +7 -7
data/README.md
CHANGED
@@ -3,11 +3,16 @@ Amazon SNS gem
|
|
3
3
|
|
4
4
|
Introduction
|
5
5
|
---------
|
6
|
+
|
6
7
|
A Ruby gem for use with the Amazon Simple Notification service (http://aws.amazon.com/sns/).
|
7
8
|
|
8
9
|
Usage
|
9
10
|
---------------
|
10
11
|
|
12
|
+
gem install amaze_sns
|
13
|
+
|
14
|
+
require 'amaze-sns'
|
15
|
+
|
11
16
|
AmazeSNS.skey = <your amazon aws secret key>
|
12
17
|
|
13
18
|
AmazeSNS.akey = <your amazon aws access key>
|
@@ -20,12 +25,14 @@ AmazeSNS.logger = my_logger # set a logger for the response
|
|
20
25
|
|
21
26
|
Dependencies
|
22
27
|
---------------
|
28
|
+
|
23
29
|
Require the CrackXML gem for parsing XML responses back from SNS; EventMachine
|
24
30
|
and EM-Http request gem for the requests; and ruby hmac gem for authenticating with Amazon Web Services
|
25
31
|
|
26
32
|
For Ruby 1.9.2 users, if you are having errors, please check that your em-http-request gem version is not
|
27
33
|
higher than 0.2.10 although the gemspec has been updated to reflect this
|
28
34
|
|
35
|
+
|
29
36
|
Tests
|
30
37
|
---------------
|
31
38
|
The specs are partly working at the moment as the gem is still under development
|
data/lib/amaze/topic.rb
CHANGED
@@ -96,7 +96,7 @@ class Topic
|
|
96
96
|
EM.stop
|
97
97
|
end
|
98
98
|
}
|
99
|
-
|
99
|
+
outcome
|
100
100
|
end
|
101
101
|
|
102
102
|
# The SetTopicAttributes action allows a topic owner to set an attribute of the topic to a new value.
|
@@ -126,7 +126,7 @@ class Topic
|
|
126
126
|
EM.stop
|
127
127
|
end
|
128
128
|
}
|
129
|
-
|
129
|
+
outcome
|
130
130
|
end
|
131
131
|
|
132
132
|
# subscribe method
|
@@ -148,7 +148,6 @@ class Topic
|
|
148
148
|
generate_request(params) do |response|
|
149
149
|
parsed_response = Crack::XML.parse(response.response)
|
150
150
|
res = parsed_response['SubscribeResponse']['SubscribeResult']['SubscriptionArn']
|
151
|
-
return res
|
152
151
|
EM.stop
|
153
152
|
end
|
154
153
|
}
|
@@ -171,7 +170,6 @@ class Topic
|
|
171
170
|
generate_request(params) do |response|
|
172
171
|
parsed_response = Crack::XML.parse(response.response)
|
173
172
|
res = parsed_response['UnsubscribeResponse']['ResponseMetadata']['RequestId']
|
174
|
-
return res
|
175
173
|
EM.stop
|
176
174
|
end
|
177
175
|
}
|
@@ -210,7 +208,6 @@ class Topic
|
|
210
208
|
arr.delete("SubscriptionArn")
|
211
209
|
nh[key.to_s] = arr
|
212
210
|
end
|
213
|
-
#return nh
|
214
211
|
EM.stop
|
215
212
|
end
|
216
213
|
}
|
@@ -239,7 +236,6 @@ class Topic
|
|
239
236
|
generate_request(params) do |response|
|
240
237
|
parsed_response = Crack::XML.parse(response.response)
|
241
238
|
res = parsed_response['AddPermissionResponse']['ResponseMetadata']['RequestId']
|
242
|
-
return res
|
243
239
|
EM.stop
|
244
240
|
end
|
245
241
|
}
|
@@ -264,7 +260,6 @@ class Topic
|
|
264
260
|
generate_request(params) do |response|
|
265
261
|
parsed_response = Crack::XML.parse(response.response)
|
266
262
|
res = parsed_response['RemovePermissionResponse']['ResponseMetadata']['RequestId']
|
267
|
-
return res
|
268
263
|
EM.stop
|
269
264
|
end
|
270
265
|
}
|
@@ -272,11 +267,11 @@ class Topic
|
|
272
267
|
end
|
273
268
|
|
274
269
|
|
275
|
-
def publish
|
270
|
+
def publish(msg, subject='My First Message')
|
276
271
|
raise InvalidOptions unless ( !(msg.empty?) && msg.instance_of?(String) )
|
277
272
|
res=''
|
278
273
|
params = {
|
279
|
-
'Subject' =>
|
274
|
+
'Subject' => subject,
|
280
275
|
'TopicArn' => "#{arn}",
|
281
276
|
"Message" => "#{msg}",
|
282
277
|
'Action' => 'Publish',
|
@@ -290,7 +285,6 @@ class Topic
|
|
290
285
|
generate_request(params) do |response|
|
291
286
|
parsed_response = Crack::XML.parse(response.response)
|
292
287
|
res = parsed_response['PublishResponse']['PublishResult']['MessageId']
|
293
|
-
return res
|
294
288
|
EM.stop
|
295
289
|
end
|
296
290
|
}
|
@@ -316,7 +310,6 @@ class Topic
|
|
316
310
|
resp = parsed_response['ConfirmSubscriptionResponse']['ConfirmSubscriptionResult']['SubscriptionArn']
|
317
311
|
id = parsed_response['ConfirmSubscriptionResponse']['ResponseMetadata']['RequestId']
|
318
312
|
arr = [resp,id]
|
319
|
-
return arr
|
320
313
|
EM.stop
|
321
314
|
end
|
322
315
|
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amaze_sns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chee Yeo
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-11-04 00:00:00 +00:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 59
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
- 12
|
34
|
-
-
|
35
|
-
version: 0.12.
|
34
|
+
- 10
|
35
|
+
version: 0.12.10
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|