postalmethods 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +16 -6
- data/README.rdoc +35 -0
- data/Rakefile +28 -4
- data/coverage/index.html +163 -0
- data/coverage/lib-postalmethods-document_processor_rb.html +226 -0
- data/coverage/lib-postalmethods-exceptions_rb.html +333 -0
- data/coverage/lib-postalmethods-get_letter_status_rb.html +285 -0
- data/coverage/lib-postalmethods-send_letter_rb.html +261 -0
- data/coverage/lib-postalmethods-utility_rb.html +277 -0
- data/coverage/lib-postalmethods_rb.html +282 -0
- data/lib/postalmethods/get_letter_status.rb +10 -11
- data/lib/postalmethods/send_letter.rb +10 -7
- data/lib/postalmethods/utility.rb +5 -4
- data/lib/postalmethods/version.rb +3 -3
- data/lib/postalmethods.rb +26 -4
- data/postalmethods.gemspec +36 -0
- data/spec/doc/WSDL-Output +868 -0
- data/spec/doc/default.rb +379 -0
- data/spec/doc/defaultMappingRegistry.rb +1 -0
- data/spec/doc/sample.pdf +0 -0
- data/spec/get_letter_status_spec.rb +4 -2
- data/spec/postalmethods_spec.rb +5 -20
- data/spec/send_letter_spec.rb +2 -3
- data/spec/spec.opts +1 -7
- data/spec/spec_helper.rb +1 -21
- data/spec/utility_spec.rb +6 -4
- data/tasks/rspec.rake +0 -12
- metadata +36 -20
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
data/spec/doc/default.rb
ADDED
@@ -0,0 +1,379 @@
|
|
1
|
+
require 'xsd/qname'
|
2
|
+
|
3
|
+
# {PostalMethods}GetLetterStatusResult
|
4
|
+
# resultCode - SOAP::SOAPInt
|
5
|
+
# status - SOAP::SOAPInt
|
6
|
+
# lastUpdateTime - SOAP::SOAPDateTime
|
7
|
+
class GetLetterStatusResult
|
8
|
+
attr_accessor :resultCode
|
9
|
+
attr_accessor :status
|
10
|
+
attr_accessor :lastUpdateTime
|
11
|
+
|
12
|
+
def initialize(resultCode = nil, status = nil, lastUpdateTime = nil)
|
13
|
+
@resultCode = resultCode
|
14
|
+
@status = status
|
15
|
+
@lastUpdateTime = lastUpdateTime
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# {PostalMethods}GetLetterStatus_MultipleResult
|
20
|
+
# resultCode - SOAP::SOAPInt
|
21
|
+
# letterStatuses - ArrayOfLetterStatus
|
22
|
+
class GetLetterStatus_MultipleResult
|
23
|
+
attr_accessor :resultCode
|
24
|
+
attr_accessor :letterStatuses
|
25
|
+
|
26
|
+
def initialize(resultCode = nil, letterStatuses = nil)
|
27
|
+
@resultCode = resultCode
|
28
|
+
@letterStatuses = letterStatuses
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# {PostalMethods}ArrayOfLetterStatus
|
33
|
+
class ArrayOfLetterStatus < ::Array
|
34
|
+
end
|
35
|
+
|
36
|
+
# {PostalMethods}LetterStatus
|
37
|
+
# iD - SOAP::SOAPInt
|
38
|
+
# status - SOAP::SOAPInt
|
39
|
+
# lastUpdateTime - SOAP::SOAPDateTime
|
40
|
+
class LetterStatus
|
41
|
+
attr_accessor :iD
|
42
|
+
attr_accessor :status
|
43
|
+
attr_accessor :lastUpdateTime
|
44
|
+
|
45
|
+
def initialize(iD = nil, status = nil, lastUpdateTime = nil)
|
46
|
+
@iD = iD
|
47
|
+
@status = status
|
48
|
+
@lastUpdateTime = lastUpdateTime
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# {PostalMethods}GetLetterStatus_RangeResult
|
53
|
+
# resultCode - SOAP::SOAPInt
|
54
|
+
# letterStatuses - ArrayOfLetterStatus
|
55
|
+
class GetLetterStatus_RangeResult
|
56
|
+
attr_accessor :resultCode
|
57
|
+
attr_accessor :letterStatuses
|
58
|
+
|
59
|
+
def initialize(resultCode = nil, letterStatuses = nil)
|
60
|
+
@resultCode = resultCode
|
61
|
+
@letterStatuses = letterStatuses
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# {PostalMethods}GetLetterDetailsResult
|
66
|
+
# resultCode - SOAP::SOAPInt
|
67
|
+
# iD - SOAP::SOAPInt
|
68
|
+
# price - SOAP::SOAPDecimal
|
69
|
+
# numOfSheets - SOAP::SOAPInt
|
70
|
+
# submitTime - SOAP::SOAPDateTime
|
71
|
+
# completionTime - SOAP::SOAPDateTime
|
72
|
+
# orientation - SOAP::SOAPString
|
73
|
+
# envelope - SOAP::SOAPString
|
74
|
+
# paper - SOAP::SOAPString
|
75
|
+
# printColor - SOAP::SOAPString
|
76
|
+
# printSides - SOAP::SOAPString
|
77
|
+
# nationalMailing - SOAP::SOAPString
|
78
|
+
# internationalMailing - SOAP::SOAPString
|
79
|
+
class GetLetterDetailsResult
|
80
|
+
attr_accessor :resultCode
|
81
|
+
attr_accessor :iD
|
82
|
+
attr_accessor :price
|
83
|
+
attr_accessor :numOfSheets
|
84
|
+
attr_accessor :submitTime
|
85
|
+
attr_accessor :completionTime
|
86
|
+
attr_accessor :orientation
|
87
|
+
attr_accessor :envelope
|
88
|
+
attr_accessor :paper
|
89
|
+
attr_accessor :printColor
|
90
|
+
attr_accessor :printSides
|
91
|
+
attr_accessor :nationalMailing
|
92
|
+
attr_accessor :internationalMailing
|
93
|
+
|
94
|
+
def initialize(resultCode = nil, iD = nil, price = nil, numOfSheets = nil, submitTime = nil, completionTime = nil, orientation = nil, envelope = nil, paper = nil, printColor = nil, printSides = nil, nationalMailing = nil, internationalMailing = nil)
|
95
|
+
@resultCode = resultCode
|
96
|
+
@iD = iD
|
97
|
+
@price = price
|
98
|
+
@numOfSheets = numOfSheets
|
99
|
+
@submitTime = submitTime
|
100
|
+
@completionTime = completionTime
|
101
|
+
@orientation = orientation
|
102
|
+
@envelope = envelope
|
103
|
+
@paper = paper
|
104
|
+
@printColor = printColor
|
105
|
+
@printSides = printSides
|
106
|
+
@nationalMailing = nationalMailing
|
107
|
+
@internationalMailing = internationalMailing
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# {PostalMethods}GetPDFResult
|
112
|
+
# resultCode - SOAP::SOAPInt
|
113
|
+
# fileData - SOAP::SOAPBase64
|
114
|
+
class GetPDFResult
|
115
|
+
attr_accessor :resultCode
|
116
|
+
attr_accessor :fileData
|
117
|
+
|
118
|
+
def initialize(resultCode = nil, fileData = nil)
|
119
|
+
@resultCode = resultCode
|
120
|
+
@fileData = fileData
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# {PostalMethods/AbstractTypes}StringArray
|
125
|
+
class StringArray < ::Array
|
126
|
+
end
|
127
|
+
|
128
|
+
# {PostalMethods}SendLetter
|
129
|
+
# username - SOAP::SOAPString
|
130
|
+
# password - SOAP::SOAPString
|
131
|
+
# myDescription - SOAP::SOAPString
|
132
|
+
# fileExtension - SOAP::SOAPString
|
133
|
+
# fileBinaryData - SOAP::SOAPBase64
|
134
|
+
class SendLetter
|
135
|
+
attr_accessor :username
|
136
|
+
attr_accessor :password
|
137
|
+
attr_accessor :myDescription
|
138
|
+
attr_accessor :fileExtension
|
139
|
+
attr_accessor :fileBinaryData
|
140
|
+
|
141
|
+
def initialize(username = nil, password = nil, myDescription = nil, fileExtension = nil, fileBinaryData = nil)
|
142
|
+
@username = username
|
143
|
+
@password = password
|
144
|
+
@myDescription = myDescription
|
145
|
+
@fileExtension = fileExtension
|
146
|
+
@fileBinaryData = fileBinaryData
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# {PostalMethods}SendLetterResponse
|
151
|
+
# sendLetterResult - SOAP::SOAPInt
|
152
|
+
class SendLetterResponse
|
153
|
+
attr_accessor :sendLetterResult
|
154
|
+
|
155
|
+
def initialize(sendLetterResult = nil)
|
156
|
+
@sendLetterResult = sendLetterResult
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# {PostalMethods}SendLetterAndAddress
|
161
|
+
# username - SOAP::SOAPString
|
162
|
+
# password - SOAP::SOAPString
|
163
|
+
# myDescription - SOAP::SOAPString
|
164
|
+
# fileExtension - SOAP::SOAPString
|
165
|
+
# fileBinaryData - SOAP::SOAPBase64
|
166
|
+
# attentionLine1 - SOAP::SOAPString
|
167
|
+
# attentionLine2 - SOAP::SOAPString
|
168
|
+
# attentionLine3 - SOAP::SOAPString
|
169
|
+
# company - SOAP::SOAPString
|
170
|
+
# address1 - SOAP::SOAPString
|
171
|
+
# address2 - SOAP::SOAPString
|
172
|
+
# city - SOAP::SOAPString
|
173
|
+
# state - SOAP::SOAPString
|
174
|
+
# postalCode - SOAP::SOAPString
|
175
|
+
# country - SOAP::SOAPString
|
176
|
+
class SendLetterAndAddress
|
177
|
+
attr_accessor :username
|
178
|
+
attr_accessor :password
|
179
|
+
attr_accessor :myDescription
|
180
|
+
attr_accessor :fileExtension
|
181
|
+
attr_accessor :fileBinaryData
|
182
|
+
attr_accessor :attentionLine1
|
183
|
+
attr_accessor :attentionLine2
|
184
|
+
attr_accessor :attentionLine3
|
185
|
+
attr_accessor :company
|
186
|
+
attr_accessor :address1
|
187
|
+
attr_accessor :address2
|
188
|
+
attr_accessor :city
|
189
|
+
attr_accessor :state
|
190
|
+
attr_accessor :postalCode
|
191
|
+
attr_accessor :country
|
192
|
+
|
193
|
+
def initialize(username = nil, password = nil, myDescription = nil, fileExtension = nil, fileBinaryData = nil, attentionLine1 = nil, attentionLine2 = nil, attentionLine3 = nil, company = nil, address1 = nil, address2 = nil, city = nil, state = nil, postalCode = nil, country = nil)
|
194
|
+
@username = username
|
195
|
+
@password = password
|
196
|
+
@myDescription = myDescription
|
197
|
+
@fileExtension = fileExtension
|
198
|
+
@fileBinaryData = fileBinaryData
|
199
|
+
@attentionLine1 = attentionLine1
|
200
|
+
@attentionLine2 = attentionLine2
|
201
|
+
@attentionLine3 = attentionLine3
|
202
|
+
@company = company
|
203
|
+
@address1 = address1
|
204
|
+
@address2 = address2
|
205
|
+
@city = city
|
206
|
+
@state = state
|
207
|
+
@postalCode = postalCode
|
208
|
+
@country = country
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
# {PostalMethods}SendLetterAndAddressResponse
|
213
|
+
# sendLetterAndAddressResult - SOAP::SOAPInt
|
214
|
+
class SendLetterAndAddressResponse
|
215
|
+
attr_accessor :sendLetterAndAddressResult
|
216
|
+
|
217
|
+
def initialize(sendLetterAndAddressResult = nil)
|
218
|
+
@sendLetterAndAddressResult = sendLetterAndAddressResult
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# {PostalMethods}GetLetterStatus
|
223
|
+
# username - SOAP::SOAPString
|
224
|
+
# password - SOAP::SOAPString
|
225
|
+
# iD - SOAP::SOAPInt
|
226
|
+
class GetLetterStatus
|
227
|
+
attr_accessor :username
|
228
|
+
attr_accessor :password
|
229
|
+
attr_accessor :iD
|
230
|
+
|
231
|
+
def initialize(username = nil, password = nil, iD = nil)
|
232
|
+
@username = username
|
233
|
+
@password = password
|
234
|
+
@iD = iD
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# {PostalMethods}GetLetterStatusResponse
|
239
|
+
# getLetterStatusResult - GetLetterStatusResult
|
240
|
+
class GetLetterStatusResponse
|
241
|
+
attr_accessor :getLetterStatusResult
|
242
|
+
|
243
|
+
def initialize(getLetterStatusResult = nil)
|
244
|
+
@getLetterStatusResult = getLetterStatusResult
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# {PostalMethods}GetLetterStatus_Multiple
|
249
|
+
# username - SOAP::SOAPString
|
250
|
+
# password - SOAP::SOAPString
|
251
|
+
# iD - SOAP::SOAPString
|
252
|
+
class GetLetterStatus_Multiple
|
253
|
+
attr_accessor :username
|
254
|
+
attr_accessor :password
|
255
|
+
attr_accessor :iD
|
256
|
+
|
257
|
+
def initialize(username = nil, password = nil, iD = nil)
|
258
|
+
@username = username
|
259
|
+
@password = password
|
260
|
+
@iD = iD
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# {PostalMethods}GetLetterStatus_MultipleResponse
|
265
|
+
# getLetterStatus_MultipleResult - GetLetterStatus_MultipleResult
|
266
|
+
class GetLetterStatus_MultipleResponse
|
267
|
+
attr_accessor :getLetterStatus_MultipleResult
|
268
|
+
|
269
|
+
def initialize(getLetterStatus_MultipleResult = nil)
|
270
|
+
@getLetterStatus_MultipleResult = getLetterStatus_MultipleResult
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
# {PostalMethods}GetLetterStatus_Range
|
275
|
+
# username - SOAP::SOAPString
|
276
|
+
# password - SOAP::SOAPString
|
277
|
+
# minID - SOAP::SOAPInt
|
278
|
+
# maxID - SOAP::SOAPInt
|
279
|
+
class GetLetterStatus_Range
|
280
|
+
attr_accessor :username
|
281
|
+
attr_accessor :password
|
282
|
+
attr_accessor :minID
|
283
|
+
attr_accessor :maxID
|
284
|
+
|
285
|
+
def initialize(username = nil, password = nil, minID = nil, maxID = nil)
|
286
|
+
@username = username
|
287
|
+
@password = password
|
288
|
+
@minID = minID
|
289
|
+
@maxID = maxID
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# {PostalMethods}GetLetterStatus_RangeResponse
|
294
|
+
# getLetterStatus_RangeResult - GetLetterStatus_RangeResult
|
295
|
+
class GetLetterStatus_RangeResponse
|
296
|
+
attr_accessor :getLetterStatus_RangeResult
|
297
|
+
|
298
|
+
def initialize(getLetterStatus_RangeResult = nil)
|
299
|
+
@getLetterStatus_RangeResult = getLetterStatus_RangeResult
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# {PostalMethods}GetLetterDetails
|
304
|
+
# username - SOAP::SOAPString
|
305
|
+
# password - SOAP::SOAPString
|
306
|
+
# iD - SOAP::SOAPInt
|
307
|
+
class GetLetterDetails
|
308
|
+
attr_accessor :username
|
309
|
+
attr_accessor :password
|
310
|
+
attr_accessor :iD
|
311
|
+
|
312
|
+
def initialize(username = nil, password = nil, iD = nil)
|
313
|
+
@username = username
|
314
|
+
@password = password
|
315
|
+
@iD = iD
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# {PostalMethods}GetLetterDetailsResponse
|
320
|
+
# getLetterDetailsResult - GetLetterDetailsResult
|
321
|
+
class GetLetterDetailsResponse
|
322
|
+
attr_accessor :getLetterDetailsResult
|
323
|
+
|
324
|
+
def initialize(getLetterDetailsResult = nil)
|
325
|
+
@getLetterDetailsResult = getLetterDetailsResult
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
# {PostalMethods}GetPDF
|
330
|
+
# username - SOAP::SOAPString
|
331
|
+
# password - SOAP::SOAPString
|
332
|
+
# iD - SOAP::SOAPInt
|
333
|
+
class GetPDF
|
334
|
+
attr_accessor :username
|
335
|
+
attr_accessor :password
|
336
|
+
attr_accessor :iD
|
337
|
+
|
338
|
+
def initialize(username = nil, password = nil, iD = nil)
|
339
|
+
@username = username
|
340
|
+
@password = password
|
341
|
+
@iD = iD
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
# {PostalMethods}GetPDFResponse
|
346
|
+
# getPDFResult - GetPDFResult
|
347
|
+
class GetPDFResponse
|
348
|
+
attr_accessor :getPDFResult
|
349
|
+
|
350
|
+
def initialize(getPDFResult = nil)
|
351
|
+
@getPDFResult = getPDFResult
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# {PostalMethods}CancelDelivery
|
356
|
+
# username - SOAP::SOAPString
|
357
|
+
# password - SOAP::SOAPString
|
358
|
+
# iD - SOAP::SOAPInt
|
359
|
+
class CancelDelivery
|
360
|
+
attr_accessor :username
|
361
|
+
attr_accessor :password
|
362
|
+
attr_accessor :iD
|
363
|
+
|
364
|
+
def initialize(username = nil, password = nil, iD = nil)
|
365
|
+
@username = username
|
366
|
+
@password = password
|
367
|
+
@iD = iD
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
# {PostalMethods}CancelDeliveryResponse
|
372
|
+
# cancelDeliveryResult - SOAP::SOAPInt
|
373
|
+
class CancelDeliveryResponse
|
374
|
+
attr_accessor :cancelDeliveryResult
|
375
|
+
|
376
|
+
def initialize(cancelDeliveryResult = nil)
|
377
|
+
@cancelDeliveryResult = cancelDeliveryResult
|
378
|
+
end
|
379
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'default.rb'
|
data/spec/doc/sample.pdf
ADDED
Binary file
|
@@ -17,7 +17,9 @@ describe "Get Letter Status" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should try to get status of a letter i don't have access to" do
|
20
|
-
|
20
|
+
# FIXME: this is a bad test as it doesn't really prove what we're trying to.
|
21
|
+
# much better to have a different user make a new post etc..
|
22
|
+
lambda { @client.get_letter_status(1020000)}.should raise_error(PostalMethods::APIStatusCode3116Exception)
|
21
23
|
end
|
22
24
|
|
23
25
|
|
@@ -26,7 +28,7 @@ describe "Get Letter Status" do
|
|
26
28
|
1.upto(3) do
|
27
29
|
@doc = open(File.dirname(__FILE__) + '/../spec/doc/sample.pdf')
|
28
30
|
@client = PostalMethods::Client.new(PM_OPTS)
|
29
|
-
@client.prepare!
|
31
|
+
@client.prepare!
|
30
32
|
rv = @client.send_letter(@doc, "the long goodbye")
|
31
33
|
rv.should > 0
|
32
34
|
letters << rv
|
data/spec/postalmethods_spec.rb
CHANGED
@@ -1,26 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
|
3
|
-
|
3
|
+
# Time to add your specs!
|
4
|
+
# http://rspec.info/
|
5
|
+
describe "Place your specs here" do
|
4
6
|
|
5
|
-
it "
|
6
|
-
|
7
|
-
c.class.should == PostalMethods::Client
|
7
|
+
it "find this spec in spec directory" do
|
8
|
+
violated "Be sure to write your specs"
|
8
9
|
end
|
9
10
|
|
10
|
-
it "should fail without a user/pass on instantiation" do
|
11
|
-
lambda {PostalMethods::Client.new()}.should raise_error(PostalMethods::NoCredentialsException)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should create a driver client thru the factory" do
|
15
|
-
c = PostalMethods::Client.new(PM_OPTS)
|
16
|
-
c.prepare!
|
17
|
-
c.rpc_driver.class.should == SOAP::RPC::Driver
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should raise a connection error exception when the api is unreachable" do
|
21
|
-
c = PostalMethods::Client.new(PM_OPTS)
|
22
|
-
c.stubs(:api_uri).returns("http://invaliduri.tld/api_endpoint.wtf?")
|
23
|
-
lambda {c.prepare!}.should raise_error(PostalMethods::NoConnectionError)
|
24
|
-
end
|
25
|
-
|
26
11
|
end
|
data/spec/send_letter_spec.rb
CHANGED
@@ -31,15 +31,14 @@ describe "Send Letter" do
|
|
31
31
|
# @client.prepare!
|
32
32
|
# lambda {@client.send_letter(@doc, nil)}.should raise_error(PostalMethods::APIStatusCode3004Exception)
|
33
33
|
#end
|
34
|
-
|
35
34
|
end
|
36
35
|
|
37
36
|
describe "Send Letter With Address" do
|
38
37
|
|
39
38
|
before :each do
|
40
39
|
@doc = open(File.dirname(__FILE__) + '/../spec/doc/sample.pdf')
|
41
|
-
@addr = {:AttentionLine1 => "
|
42
|
-
|
40
|
+
@addr = {:AttentionLine1 => "George Washington", :Address1 => "The White House", :Address2 => "1600 Pennsylvania Ave",
|
41
|
+
:City => "Washington", :State => "DC", :PostalCode => "20500", :Country => "USA"}
|
43
42
|
@client = PostalMethods::Client.new(PM_OPTS)
|
44
43
|
end
|
45
44
|
|
data/spec/spec.opts
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,30 +1,10 @@
|
|
1
1
|
begin
|
2
2
|
require 'spec'
|
3
|
-
require 'mocha'
|
4
3
|
rescue LoadError
|
5
4
|
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
6
|
require 'spec'
|
7
|
-
require 'mocha'
|
8
7
|
end
|
9
8
|
|
10
9
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
11
10
|
require 'postalmethods'
|
12
|
-
|
13
|
-
$VERBOSE = nil ##silence annoying warnings from soap4r
|
14
|
-
|
15
|
-
PM_OPTS = {:username => 'imajes', :password => 'rubyr00ls'}
|
16
|
-
|
17
|
-
# hash hacks to make hacking in specs easier
|
18
|
-
class Hash
|
19
|
-
# for excluding keys
|
20
|
-
def except(*exclusions)
|
21
|
-
self.reject { |key, value| exclusions.include? key.to_sym }
|
22
|
-
end
|
23
|
-
|
24
|
-
# for overriding keys
|
25
|
-
def with(overrides = {})
|
26
|
-
self.merge overrides
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
require "ruby-debug"
|
data/spec/utility_spec.rb
CHANGED
@@ -38,11 +38,13 @@ describe "Utility Methods" do
|
|
38
38
|
|
39
39
|
details.first.price.should == "0.00"
|
40
40
|
details.first.iD.to_i.should == id ## be careful not to confuse with class id
|
41
|
+
details.last.should be_a_kind_of(String)
|
42
|
+
details.last.should == "Development"
|
41
43
|
end
|
42
44
|
|
43
|
-
it "should raise
|
45
|
+
it "should raise a letter does not exist (3116) error when trying to get details of an invalid letter" do
|
44
46
|
sleep(6) # got to wait 6 seconds...
|
45
|
-
lambda { @client.get_letter_details(1)}.should raise_error(PostalMethods::
|
47
|
+
lambda { @client.get_letter_details(1)}.should raise_error(PostalMethods::APIStatusCode3116Exception)
|
46
48
|
end
|
47
49
|
|
48
50
|
it "should cancel delivery of a letter" do
|
@@ -51,8 +53,8 @@ describe "Utility Methods" do
|
|
51
53
|
rv.should be_true
|
52
54
|
end
|
53
55
|
|
54
|
-
it "should raise
|
55
|
-
lambda { @client.cancel_delivery(1)}.should raise_error(PostalMethods::
|
56
|
+
it "should raise a letter does not exist (3116) error when trying to cancel an invalid letter" do
|
57
|
+
lambda { @client.cancel_delivery(1)}.should raise_error(PostalMethods::APIStatusCode3116Exception)
|
56
58
|
end
|
57
59
|
|
58
60
|
|
data/tasks/rspec.rake
CHANGED
@@ -19,15 +19,3 @@ Spec::Rake::SpecTask.new do |t|
|
|
19
19
|
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
20
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
21
|
end
|
22
|
-
|
23
|
-
namespace :spec do
|
24
|
-
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
25
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
26
|
-
t.spec_opts = ['--options', "\"spec/spec.opts\""]
|
27
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
-
t.rcov = true
|
29
|
-
t.rcov_opts = lambda do
|
30
|
-
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postalmethods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Cox
|
@@ -9,9 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-22 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: newgem
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.1
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: hoe
|
17
27
|
type: :development
|
@@ -20,11 +30,11 @@ dependencies:
|
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
33
|
+
version: 1.8.0
|
24
34
|
version:
|
25
|
-
description:
|
35
|
+
description: API wrapper library for the postal methods api.
|
26
36
|
email:
|
27
|
-
- james
|
37
|
+
- james@imaj.es
|
28
38
|
executables: []
|
29
39
|
|
30
40
|
extensions: []
|
@@ -34,50 +44,56 @@ extra_rdoc_files:
|
|
34
44
|
- License.txt
|
35
45
|
- Manifest.txt
|
36
46
|
- PostInstall.txt
|
47
|
+
- README.rdoc
|
37
48
|
- README.txt
|
38
49
|
files:
|
39
50
|
- History.txt
|
40
51
|
- License.txt
|
41
52
|
- Manifest.txt
|
42
53
|
- PostInstall.txt
|
54
|
+
- README.rdoc
|
43
55
|
- README.txt
|
44
56
|
- Rakefile
|
45
57
|
- config/hoe.rb
|
46
58
|
- config/requirements.rb
|
59
|
+
- coverage/index.html
|
60
|
+
- coverage/lib-postalmethods-document_processor_rb.html
|
61
|
+
- coverage/lib-postalmethods-exceptions_rb.html
|
62
|
+
- coverage/lib-postalmethods-get_letter_status_rb.html
|
63
|
+
- coverage/lib-postalmethods-send_letter_rb.html
|
64
|
+
- coverage/lib-postalmethods-utility_rb.html
|
65
|
+
- coverage/lib-postalmethods_rb.html
|
47
66
|
- lib/postalmethods.rb
|
48
|
-
- lib/postalmethods/version.rb
|
49
67
|
- lib/postalmethods/document_processor.rb
|
50
68
|
- lib/postalmethods/exceptions.rb
|
51
69
|
- lib/postalmethods/get_letter_status.rb
|
52
70
|
- lib/postalmethods/send_letter.rb
|
53
71
|
- lib/postalmethods/utility.rb
|
72
|
+
- lib/postalmethods/version.rb
|
73
|
+
- postalmethods.gemspec
|
54
74
|
- script/console
|
55
75
|
- script/destroy
|
56
76
|
- script/generate
|
57
77
|
- setup.rb
|
78
|
+
- spec/doc/WSDL-Output
|
79
|
+
- spec/doc/default.rb
|
80
|
+
- spec/doc/defaultMappingRegistry.rb
|
81
|
+
- spec/doc/sample.pdf
|
58
82
|
- spec/document_processor_spec.rb
|
59
83
|
- spec/get_letter_status_spec.rb
|
60
84
|
- spec/postalmethods_spec.rb
|
61
|
-
- spec/send_letter_spec.rb
|
62
|
-
- spec/utility_spec.rb
|
63
85
|
- spec/rcov.opts
|
86
|
+
- spec/send_letter_spec.rb
|
64
87
|
- spec/spec.opts
|
65
88
|
- spec/spec_helper.rb
|
66
|
-
-
|
67
|
-
- tasks/environment.rake
|
89
|
+
- spec/utility_spec.rb
|
68
90
|
- tasks/rspec.rake
|
69
91
|
has_rdoc: true
|
70
|
-
homepage: http://postalmethods.
|
71
|
-
post_install_message:
|
72
|
-
|
73
|
-
For more information on working with Postal Methods,
|
74
|
-
see the API reference here:
|
75
|
-
|
76
|
-
http://www.postalmethods.com/resources/quickstart
|
77
|
-
|
92
|
+
homepage: "Info: http://www.postalmethods.com/resources/quickstart"
|
93
|
+
post_install_message: PostInstall.txt
|
78
94
|
rdoc_options:
|
79
95
|
- --main
|
80
|
-
- README.
|
96
|
+
- README.rdoc
|
81
97
|
require_paths:
|
82
98
|
- lib
|
83
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -98,6 +114,6 @@ rubyforge_project: postalmethods
|
|
98
114
|
rubygems_version: 1.2.0
|
99
115
|
signing_key:
|
100
116
|
specification_version: 2
|
101
|
-
summary:
|
117
|
+
summary: API wrapper library for the postal methods api.
|
102
118
|
test_files: []
|
103
119
|
|
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|