bisques 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ef5dfd8e63a1fffb947d8c3b03c1d2e96ed2df4a
4
+ data.tar.gz: 7c984a1c6624ea967ac1f7cc3c1ba24bb6cf85db
5
+ SHA512:
6
+ metadata.gz: c7afc61d256a4dfaeeb914190cc216d2f8390f772ea5813feaeef22fd9f0d131095e3fbaf59ed5a682a2689dc93bd0effef406e9cced02958bef875ff5bdfea0
7
+ data.tar.gz: 90a12e4c7de3cb4df695e5d2b4eff40d1e4b998a07346f3f260ce1adc16c67a12d8be80e833448d936375e100bb0d9952b59f922c22537919c01d816e0508260
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === v1.0.4
2
+
3
+ Add bulk methods
4
+
1
5
  === v1.0.1
2
6
 
3
7
  Corrected homepage link
@@ -115,6 +115,14 @@ module Bisques
115
115
  end
116
116
  end
117
117
 
118
+ def marshal_dump
119
+ [@region, @service, @credentials]
120
+ end
121
+
122
+ def marshal_load array
123
+ @region, @service, @credentials = array
124
+ end
125
+
118
126
  private
119
127
  def aws_http_connection
120
128
  @aws_http_connection ||= HTTPClient.new.tap do |http|
@@ -165,6 +165,25 @@ module Bisques
165
165
  end
166
166
  end
167
167
 
168
+ def send_message_batch(queue_url, messages)
169
+ options = {}
170
+
171
+ messages.each_with_index do |message, index|
172
+ id = nil, body = nil
173
+
174
+ if message.is_a?(Array)
175
+ id, body, _ = message
176
+ else
177
+ body = message
178
+ end
179
+
180
+ options["SendMessageBatchRequestEntry.#{index+1}.Id"] = id if id.present?
181
+ options["SendMessageBatchRequestEntry.#{index+1}.MessageBody"] = body
182
+ end
183
+
184
+ action("SendMessageBatch", queue_url, options)
185
+ end
186
+
168
187
  # Delete a message from a queue. The message is deleted by the handle given
169
188
  # when the message is retrieved.
170
189
  #
data/lib/bisques/queue.rb CHANGED
@@ -115,6 +115,24 @@ module Bisques
115
115
  client.send_message(url, JSON.dump(object))
116
116
  end
117
117
 
118
+ def post_messages(objects)
119
+ objects = objects.dup
120
+ group = []
121
+ while objects.any?
122
+ group.push objects.pop
123
+
124
+ if group.length == 10
125
+ client.send_message_batch(url, objects.map{|obj| JSON.dump(obj)})
126
+ end
127
+ end
128
+
129
+ if group.length > 0
130
+ client.send_message_batch(url, objects.map{|obj| JSON.dump(obj)})
131
+ end
132
+
133
+ nil
134
+ end
135
+
118
136
  # Retrieve a message from the queue. Returns nil if no message is waiting
119
137
  # in the given poll time. Otherwise it returns a Message.
120
138
  #
metadata CHANGED
@@ -1,96 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bisques
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.0.3
4
+ version: 1.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeremy Wells
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
11
+ date: 2013-06-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httpclient
16
- type: :runtime
17
15
  requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
- none: false
20
+ type: :runtime
21
+ prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - ! '>='
24
+ - - '>='
26
25
  - !ruby/object:Gem::Version
27
26
  version: '0'
28
- none: false
29
- prerelease: false
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: addressable
32
- type: :runtime
33
29
  requirement: !ruby/object:Gem::Requirement
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
- none: false
34
+ type: :runtime
35
+ prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ! '>='
38
+ - - '>='
42
39
  - !ruby/object:Gem::Version
43
40
  version: '0'
44
- none: false
45
- prerelease: false
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
- type: :runtime
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
- none: false
48
+ type: :runtime
49
+ prerelease: false
55
50
  version_requirements: !ruby/object:Gem::Requirement
56
51
  requirements:
57
- - - ! '>='
52
+ - - '>='
58
53
  - !ruby/object:Gem::Version
59
54
  version: '0'
60
- none: false
61
- prerelease: false
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: json
64
- type: :runtime
65
57
  requirement: !ruby/object:Gem::Requirement
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
- none: false
62
+ type: :runtime
63
+ prerelease: false
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
- - - ! '>='
66
+ - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
76
- none: false
77
- prerelease: false
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
- type: :development
81
71
  requirement: !ruby/object:Gem::Requirement
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
- none: false
76
+ type: :development
77
+ prerelease: false
87
78
  version_requirements: !ruby/object:Gem::Requirement
88
79
  requirements:
89
- - - ! '>='
80
+ - - '>='
90
81
  - !ruby/object:Gem::Version
91
82
  version: '0'
92
- none: false
93
- prerelease: false
94
83
  description: AWS SQS client
95
84
  email: jemmyw@gmail.com
96
85
  executables: []
@@ -114,6 +103,7 @@ files:
114
103
  - lib/bisques.rb
115
104
  homepage: https://github.com/jemmyw/bisques
116
105
  licenses: []
106
+ metadata: {}
117
107
  post_install_message:
118
108
  rdoc_options:
119
109
  - --line-numbers
@@ -122,26 +112,18 @@ require_paths:
122
112
  - lib
123
113
  required_ruby_version: !ruby/object:Gem::Requirement
124
114
  requirements:
125
- - - ! '>='
115
+ - - '>='
126
116
  - !ruby/object:Gem::Version
127
- segments:
128
- - 0
129
- hash: -2629150874104003677
130
117
  version: '0'
131
- none: false
132
118
  required_rubygems_version: !ruby/object:Gem::Requirement
133
119
  requirements:
134
- - - ! '>='
120
+ - - '>='
135
121
  - !ruby/object:Gem::Version
136
- segments:
137
- - 0
138
- hash: -2629150874104003677
139
122
  version: '0'
140
- none: false
141
123
  requirements: []
142
124
  rubyforge_project:
143
- rubygems_version: 1.8.25
125
+ rubygems_version: 2.0.3
144
126
  signing_key:
145
- specification_version: 3
127
+ specification_version: 4
146
128
  summary: AWS SQS client
147
129
  test_files: []