canadapost 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 134aaf80be1b1760b5ff916e7610f3a68c54bc84
4
- data.tar.gz: 6402272921f2a0246282ac313152a2f7fe3cda7e
3
+ metadata.gz: ea0bb123bc7190ea6a8d06c4c04583ed7e9eb6af
4
+ data.tar.gz: 1270061793596a5aa54d33f50feb9726e18886bb
5
5
  SHA512:
6
- metadata.gz: 66f2bb34d2dd943be4334f38e69f11e65c46b4a15cd0d9cd63c16b62034ea3aee8fda4b838d1103edb57ff486607c3428eb6a47b555c56be84b9c99c6e80d1ad
7
- data.tar.gz: 9f4bcfb2dc25989786e13442af59ed18d4940c0a1322f2d3c26f7780a904f9d4438009dd4e6994fbba822b2b920dde00802ce64809556a9c3a83bac77098281b
6
+ metadata.gz: 80dcab57c6b421967a65cb363724e0387766f397104c215c3e4f758c80e278e8c02a541e66b997bb31fb8bca7aafbf70c6c2fa12700702509d406cb4f0458404
7
+ data.tar.gz: c73a94c9d470126cf3e8d247aacf67f794763f31a8646177646605617b827b87df3cf208c35744173689c72d096798a3482e07cf0b08370ea069b73e934e4cc4
@@ -0,0 +1 @@
1
+ lib/canadapost.rb 6d698b1be2d1a2bc2fd7a2c393044d32ef0eb1e3
Binary file
Binary file
Binary file
data/README.md CHANGED
@@ -19,34 +19,35 @@ Or install it yourself as:
19
19
  $ gem install canadapost
20
20
 
21
21
  ## Usage
22
- canada_post = CanadaPost.new({
22
+ canada_post = Canadapost.new({
23
23
  username: "xxx",
24
24
  password: "xxx",
25
25
  customer_number: 'xxx',
26
26
  development: true (optional)
27
27
  })
28
28
 
29
- canada_post.origin_postal_code = "xxx"
30
- canada_post.dimensions = dimension_hash
31
- canada_post.customer = customer_hash
32
- canada_post.get_rates
29
+ canada_post.origin_postal_code = "xxx"
30
+ canada_post.dimensions = {}
31
+ canada_post.customer = {}
32
+ canada_post.get_rates
33
33
 
34
34
  get_rates returns a hash of services, including:
35
+
35
36
  - :service_name
36
37
  - :service_code
37
- - :price_details[:due]
38
- - :service_link[:href]
39
- - :service_standard[:expected_transit_time]
38
+ - :price_details, with [:due] as the total amount
39
+ - :service_link, with [:href] as the URL
40
+ - :service_standard, with [:expected_transit_time] as the estimated number of days for delivery (from today)
41
+
42
+ **dimension hash**
43
+ {weight: x.x, height: x.x, length: x.x, width: x.x }
44
+ Weight is kilograms; height, length, width are centimetres
40
45
 
41
46
  **customer hash:**
42
47
  for us: { :'united-states' => { :'zip-code' => 'xxxxx' } }
43
48
  for canada: { domestic: { :'postal-code' => 'xxxxxx' } }
44
49
  for international: { international: { :'country-code' => 'xx' } }
45
50
 
46
- **dimension hash**
47
- {weight: x.x, height: x.x, length: x.x, width: x.x }
48
- Weight is kilograms; height, length, width are centimetres
49
-
50
51
  ## Contributing
51
52
 
52
53
  1. Fork it
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "canadapost"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["Gordon B. Isnor"]
9
9
  spec.email = ["gordonbisnor@gmail.com"]
10
10
  spec.description = %q{A basic gem to interface with the Canada POST REST API}
11
- spec.summary = %q{A basic gem to interface with the Canada POST REST API}
11
+ spec.summary = %q{Works with Ruby on Rails. Requires HTTParty. Currently only addressing the Get Rates endpoint.}
12
12
  spec.homepage = "http://www.github.com/gordonbisnor/canadapost"
13
13
  spec.license = "MIT"
14
14
 
@@ -0,0 +1,1220 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Canadapost
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (C)</a> &raquo;
35
+
36
+
37
+ <span class="title">Canadapost</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Canadapost
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Canadapost</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/canadapost.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>CanadaPost gem for use with Canada Post REST API</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#accept_header-instance_method" title="#accept_header (instance method)">- (Object) <strong>accept_header</strong> </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'>
141
+ <p>Returns the value of attribute accept_header.</p>
142
+ </div></span>
143
+
144
+ </li>
145
+
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#auth-instance_method" title="#auth (instance method)">- (Object) <strong>auth</strong> </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'>
168
+ <p>Returns the value of attribute auth.</p>
169
+ </div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#content_type_header-instance_method" title="#content_type_header (instance method)">- (Object) <strong>content_type_header</strong> </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Returns the value of attribute content_type_header.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#customer-instance_method" title="#customer (instance method)">- (Object) <strong>customer</strong> </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+ <span class="summary_desc"><div class='inline'>
222
+ <p>Returns the value of attribute customer.</p>
223
+ </div></span>
224
+
225
+ </li>
226
+
227
+
228
+ <li class="public ">
229
+ <span class="summary_signature">
230
+
231
+ <a href="#customer_number-instance_method" title="#customer_number (instance method)">- (Object) <strong>customer_number</strong> </a>
232
+
233
+
234
+
235
+ </span>
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'>
249
+ <p>Returns the value of attribute customer_number.</p>
250
+ </div></span>
251
+
252
+ </li>
253
+
254
+
255
+ <li class="public ">
256
+ <span class="summary_signature">
257
+
258
+ <a href="#development-instance_method" title="#development (instance method)">- (Object) <strong>development</strong> </a>
259
+
260
+
261
+
262
+ </span>
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ <span class="summary_desc"><div class='inline'>
276
+ <p>Returns the value of attribute development.</p>
277
+ </div></span>
278
+
279
+ </li>
280
+
281
+
282
+ <li class="public ">
283
+ <span class="summary_signature">
284
+
285
+ <a href="#dimensions-instance_method" title="#dimensions (instance method)">- (Object) <strong>dimensions</strong> </a>
286
+
287
+
288
+
289
+ </span>
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'>
303
+ <p>Returns the value of attribute dimensions.</p>
304
+ </div></span>
305
+
306
+ </li>
307
+
308
+
309
+ <li class="public ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#origin_postal_code-instance_method" title="#origin_postal_code (instance method)">- (Object) <strong>origin_postal_code</strong> </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ <span class="summary_desc"><div class='inline'>
330
+ <p>Returns the value of attribute origin_postal_code.</p>
331
+ </div></span>
332
+
333
+ </li>
334
+
335
+
336
+ <li class="public ">
337
+ <span class="summary_signature">
338
+
339
+ <a href="#password-instance_method" title="#password (instance method)">- (Object) <strong>password</strong> </a>
340
+
341
+
342
+
343
+ </span>
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+ <span class="summary_desc"><div class='inline'>
357
+ <p>Returns the value of attribute password.</p>
358
+ </div></span>
359
+
360
+ </li>
361
+
362
+
363
+ <li class="public ">
364
+ <span class="summary_signature">
365
+
366
+ <a href="#response-instance_method" title="#response (instance method)">- (Object) <strong>response</strong> </a>
367
+
368
+
369
+
370
+ </span>
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ <span class="summary_desc"><div class='inline'>
384
+ <p>Returns the value of attribute response.</p>
385
+ </div></span>
386
+
387
+ </li>
388
+
389
+
390
+ <li class="public ">
391
+ <span class="summary_signature">
392
+
393
+ <a href="#username-instance_method" title="#username (instance method)">- (Object) <strong>username</strong> </a>
394
+
395
+
396
+
397
+ </span>
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+ <span class="summary_desc"><div class='inline'>
411
+ <p>Returns the value of attribute username.</p>
412
+ </div></span>
413
+
414
+ </li>
415
+
416
+
417
+ </ul>
418
+
419
+
420
+
421
+
422
+
423
+ <h2>
424
+ Instance Method Summary
425
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
426
+ </h2>
427
+
428
+ <ul class="summary">
429
+
430
+ <li class="public ">
431
+ <span class="summary_signature">
432
+
433
+ <a href="#get_rates-instance_method" title="#get_rates (instance method)">- (Object) <strong>get_rates</strong>(params = {}) </a>
434
+
435
+
436
+
437
+ </span>
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+ <span class="summary_desc"><div class='inline'>
448
+ <p>Hash a hash of services.</p>
449
+ </div></span>
450
+
451
+ </li>
452
+
453
+
454
+ <li class="public ">
455
+ <span class="summary_signature">
456
+
457
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Canadapost) <strong>initialize</strong>(params = {}) </a>
458
+
459
+
460
+
461
+ </span>
462
+
463
+
464
+ <span class="note title constructor">constructor</span>
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+ <span class="summary_desc"><div class='inline'>
474
+ <p>A new instance of Canadapost.</p>
475
+ </div></span>
476
+
477
+ </li>
478
+
479
+
480
+ </ul>
481
+
482
+
483
+ <div id="constructor_details" class="method_details_list">
484
+ <h2>Constructor Details</h2>
485
+
486
+ <div class="method_details first">
487
+ <h3 class="signature first" id="initialize-instance_method">
488
+
489
+ - (<tt><span class='object_link'><a href="" title="Canadapost (class)">Canadapost</a></span></tt>) <strong>initialize</strong>(params = {})
490
+
491
+
492
+
493
+
494
+
495
+ </h3><div class="docstring">
496
+ <div class="discussion">
497
+
498
+ <p>Returns a new instance of Canadapost</p>
499
+
500
+
501
+ </div>
502
+ </div>
503
+ <div class="tags">
504
+ <p class="tag_title">Parameters:</p>
505
+ <ul class="param">
506
+
507
+ <li>
508
+
509
+ <span class='name'>params</span>
510
+
511
+
512
+ <span class='type'>(<tt>Hash</tt>)</span>
513
+
514
+
515
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
516
+
517
+
518
+ </li>
519
+
520
+ </ul>
521
+
522
+
523
+
524
+
525
+ <p class="tag_title">Options Hash (<tt>params</tt>):</p>
526
+ <ul class="option">
527
+
528
+ <li>
529
+ <span class="name">:username</span>
530
+ <span class="type">(<tt>String</tt>)</span>
531
+ <span class="default">
532
+
533
+ </span>
534
+
535
+ &mdash; <div class='inline'>
536
+ <p>your API key username</p>
537
+ </div>
538
+
539
+ </li>
540
+
541
+ <li>
542
+ <span class="name">:password</span>
543
+ <span class="type">(<tt>String</tt>)</span>
544
+ <span class="default">
545
+
546
+ </span>
547
+
548
+ &mdash; <div class='inline'>
549
+ <p>your API key password</p>
550
+ </div>
551
+
552
+ </li>
553
+
554
+ <li>
555
+ <span class="name">:development</span>
556
+ <span class="type">(<tt>Boolean</tt>)</span>
557
+ <span class="default">
558
+
559
+ </span>
560
+
561
+ &mdash; <div class='inline'>
562
+ <p>to specify development mode</p>
563
+ </div>
564
+
565
+ </li>
566
+
567
+ <li>
568
+ <span class="name">:customer_number</span>
569
+ <span class="type">(<tt>String</tt>)</span>
570
+ <span class="default">
571
+
572
+ </span>
573
+
574
+ &mdash; <div class='inline'>
575
+ <p>your Canada Post customer account number</p>
576
+ </div>
577
+
578
+ </li>
579
+
580
+ </ul>
581
+
582
+
583
+
584
+ </div><table class="source_code">
585
+ <tr>
586
+ <td>
587
+ <pre class="lines">
588
+
589
+
590
+ 22
591
+ 23
592
+ 24
593
+ 25
594
+ 26
595
+ 27
596
+ 28</pre>
597
+ </td>
598
+ <td>
599
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 22</span>
600
+
601
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
602
+ <span class='ivar'>@username</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:username</span><span class='rbracket'>]</span>
603
+ <span class='ivar'>@password</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:password</span><span class='rbracket'>]</span>
604
+ <span class='ivar'>@development</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:development</span><span class='rbracket'>]</span>
605
+ <span class='ivar'>@customer_number</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:customer_number</span><span class='rbracket'>]</span>
606
+ <span class='ivar'>@auth</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>username:</span> <span class='id identifier rubyid_username'>username</span><span class='comma'>,</span> <span class='label'>password:</span> <span class='id identifier rubyid_password'>password</span> <span class='rbrace'>}</span>
607
+ <span class='kw'>end</span></pre>
608
+ </td>
609
+ </tr>
610
+ </table>
611
+ </div>
612
+
613
+ </div>
614
+
615
+ <div id="instance_attr_details" class="attr_details">
616
+ <h2>Instance Attribute Details</h2>
617
+
618
+
619
+ <span id="accept_header=-instance_method"></span>
620
+ <div class="method_details first">
621
+ <h3 class="signature first" id="accept_header-instance_method">
622
+
623
+ - (<tt>Object</tt>) <strong>accept_header</strong>
624
+
625
+
626
+
627
+
628
+
629
+ </h3><div class="docstring">
630
+ <div class="discussion">
631
+
632
+ <p>Returns the value of attribute accept_header</p>
633
+
634
+
635
+ </div>
636
+ </div>
637
+ <div class="tags">
638
+
639
+
640
+ </div><table class="source_code">
641
+ <tr>
642
+ <td>
643
+ <pre class="lines">
644
+
645
+
646
+ 3
647
+ 4
648
+ 5</pre>
649
+ </td>
650
+ <td>
651
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
652
+
653
+ <span class='kw'>def</span> <span class='id identifier rubyid_accept_header'>accept_header</span>
654
+ <span class='ivar'>@accept_header</span>
655
+ <span class='kw'>end</span></pre>
656
+ </td>
657
+ </tr>
658
+ </table>
659
+ </div>
660
+
661
+
662
+ <span id="auth=-instance_method"></span>
663
+ <div class="method_details ">
664
+ <h3 class="signature " id="auth-instance_method">
665
+
666
+ - (<tt>Object</tt>) <strong>auth</strong>
667
+
668
+
669
+
670
+
671
+
672
+ </h3><div class="docstring">
673
+ <div class="discussion">
674
+
675
+ <p>Returns the value of attribute auth</p>
676
+
677
+
678
+ </div>
679
+ </div>
680
+ <div class="tags">
681
+
682
+
683
+ </div><table class="source_code">
684
+ <tr>
685
+ <td>
686
+ <pre class="lines">
687
+
688
+
689
+ 3
690
+ 4
691
+ 5</pre>
692
+ </td>
693
+ <td>
694
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
695
+
696
+ <span class='kw'>def</span> <span class='id identifier rubyid_auth'>auth</span>
697
+ <span class='ivar'>@auth</span>
698
+ <span class='kw'>end</span></pre>
699
+ </td>
700
+ </tr>
701
+ </table>
702
+ </div>
703
+
704
+
705
+ <span id="content_type_header=-instance_method"></span>
706
+ <div class="method_details ">
707
+ <h3 class="signature " id="content_type_header-instance_method">
708
+
709
+ - (<tt>Object</tt>) <strong>content_type_header</strong>
710
+
711
+
712
+
713
+
714
+
715
+ </h3><div class="docstring">
716
+ <div class="discussion">
717
+
718
+ <p>Returns the value of attribute content_type_header</p>
719
+
720
+
721
+ </div>
722
+ </div>
723
+ <div class="tags">
724
+
725
+
726
+ </div><table class="source_code">
727
+ <tr>
728
+ <td>
729
+ <pre class="lines">
730
+
731
+
732
+ 3
733
+ 4
734
+ 5</pre>
735
+ </td>
736
+ <td>
737
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
738
+
739
+ <span class='kw'>def</span> <span class='id identifier rubyid_content_type_header'>content_type_header</span>
740
+ <span class='ivar'>@content_type_header</span>
741
+ <span class='kw'>end</span></pre>
742
+ </td>
743
+ </tr>
744
+ </table>
745
+ </div>
746
+
747
+
748
+ <span id="customer=-instance_method"></span>
749
+ <div class="method_details ">
750
+ <h3 class="signature " id="customer-instance_method">
751
+
752
+ - (<tt>Object</tt>) <strong>customer</strong>
753
+
754
+
755
+
756
+
757
+
758
+ </h3><div class="docstring">
759
+ <div class="discussion">
760
+
761
+ <p>Returns the value of attribute customer</p>
762
+
763
+
764
+ </div>
765
+ </div>
766
+ <div class="tags">
767
+
768
+
769
+ </div><table class="source_code">
770
+ <tr>
771
+ <td>
772
+ <pre class="lines">
773
+
774
+
775
+ 3
776
+ 4
777
+ 5</pre>
778
+ </td>
779
+ <td>
780
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
781
+
782
+ <span class='kw'>def</span> <span class='id identifier rubyid_customer'>customer</span>
783
+ <span class='ivar'>@customer</span>
784
+ <span class='kw'>end</span></pre>
785
+ </td>
786
+ </tr>
787
+ </table>
788
+ </div>
789
+
790
+
791
+ <span id="customer_number=-instance_method"></span>
792
+ <div class="method_details ">
793
+ <h3 class="signature " id="customer_number-instance_method">
794
+
795
+ - (<tt>Object</tt>) <strong>customer_number</strong>
796
+
797
+
798
+
799
+
800
+
801
+ </h3><div class="docstring">
802
+ <div class="discussion">
803
+
804
+ <p>Returns the value of attribute customer_number</p>
805
+
806
+
807
+ </div>
808
+ </div>
809
+ <div class="tags">
810
+
811
+
812
+ </div><table class="source_code">
813
+ <tr>
814
+ <td>
815
+ <pre class="lines">
816
+
817
+
818
+ 3
819
+ 4
820
+ 5</pre>
821
+ </td>
822
+ <td>
823
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
824
+
825
+ <span class='kw'>def</span> <span class='id identifier rubyid_customer_number'>customer_number</span>
826
+ <span class='ivar'>@customer_number</span>
827
+ <span class='kw'>end</span></pre>
828
+ </td>
829
+ </tr>
830
+ </table>
831
+ </div>
832
+
833
+
834
+ <span id="development=-instance_method"></span>
835
+ <div class="method_details ">
836
+ <h3 class="signature " id="development-instance_method">
837
+
838
+ - (<tt>Object</tt>) <strong>development</strong>
839
+
840
+
841
+
842
+
843
+
844
+ </h3><div class="docstring">
845
+ <div class="discussion">
846
+
847
+ <p>Returns the value of attribute development</p>
848
+
849
+
850
+ </div>
851
+ </div>
852
+ <div class="tags">
853
+
854
+
855
+ </div><table class="source_code">
856
+ <tr>
857
+ <td>
858
+ <pre class="lines">
859
+
860
+
861
+ 3
862
+ 4
863
+ 5</pre>
864
+ </td>
865
+ <td>
866
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
867
+
868
+ <span class='kw'>def</span> <span class='id identifier rubyid_development'>development</span>
869
+ <span class='ivar'>@development</span>
870
+ <span class='kw'>end</span></pre>
871
+ </td>
872
+ </tr>
873
+ </table>
874
+ </div>
875
+
876
+
877
+ <span id="dimensions=-instance_method"></span>
878
+ <div class="method_details ">
879
+ <h3 class="signature " id="dimensions-instance_method">
880
+
881
+ - (<tt>Object</tt>) <strong>dimensions</strong>
882
+
883
+
884
+
885
+
886
+
887
+ </h3><div class="docstring">
888
+ <div class="discussion">
889
+
890
+ <p>Returns the value of attribute dimensions</p>
891
+
892
+
893
+ </div>
894
+ </div>
895
+ <div class="tags">
896
+
897
+
898
+ </div><table class="source_code">
899
+ <tr>
900
+ <td>
901
+ <pre class="lines">
902
+
903
+
904
+ 3
905
+ 4
906
+ 5</pre>
907
+ </td>
908
+ <td>
909
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
910
+
911
+ <span class='kw'>def</span> <span class='id identifier rubyid_dimensions'>dimensions</span>
912
+ <span class='ivar'>@dimensions</span>
913
+ <span class='kw'>end</span></pre>
914
+ </td>
915
+ </tr>
916
+ </table>
917
+ </div>
918
+
919
+
920
+ <span id="origin_postal_code=-instance_method"></span>
921
+ <div class="method_details ">
922
+ <h3 class="signature " id="origin_postal_code-instance_method">
923
+
924
+ - (<tt>Object</tt>) <strong>origin_postal_code</strong>
925
+
926
+
927
+
928
+
929
+
930
+ </h3><div class="docstring">
931
+ <div class="discussion">
932
+
933
+ <p>Returns the value of attribute origin_postal_code</p>
934
+
935
+
936
+ </div>
937
+ </div>
938
+ <div class="tags">
939
+
940
+
941
+ </div><table class="source_code">
942
+ <tr>
943
+ <td>
944
+ <pre class="lines">
945
+
946
+
947
+ 3
948
+ 4
949
+ 5</pre>
950
+ </td>
951
+ <td>
952
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
953
+
954
+ <span class='kw'>def</span> <span class='id identifier rubyid_origin_postal_code'>origin_postal_code</span>
955
+ <span class='ivar'>@origin_postal_code</span>
956
+ <span class='kw'>end</span></pre>
957
+ </td>
958
+ </tr>
959
+ </table>
960
+ </div>
961
+
962
+
963
+ <span id="password=-instance_method"></span>
964
+ <div class="method_details ">
965
+ <h3 class="signature " id="password-instance_method">
966
+
967
+ - (<tt>Object</tt>) <strong>password</strong>
968
+
969
+
970
+
971
+
972
+
973
+ </h3><div class="docstring">
974
+ <div class="discussion">
975
+
976
+ <p>Returns the value of attribute password</p>
977
+
978
+
979
+ </div>
980
+ </div>
981
+ <div class="tags">
982
+
983
+
984
+ </div><table class="source_code">
985
+ <tr>
986
+ <td>
987
+ <pre class="lines">
988
+
989
+
990
+ 3
991
+ 4
992
+ 5</pre>
993
+ </td>
994
+ <td>
995
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
996
+
997
+ <span class='kw'>def</span> <span class='id identifier rubyid_password'>password</span>
998
+ <span class='ivar'>@password</span>
999
+ <span class='kw'>end</span></pre>
1000
+ </td>
1001
+ </tr>
1002
+ </table>
1003
+ </div>
1004
+
1005
+
1006
+ <span id="response=-instance_method"></span>
1007
+ <div class="method_details ">
1008
+ <h3 class="signature " id="response-instance_method">
1009
+
1010
+ - (<tt>Object</tt>) <strong>response</strong>
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+ </h3><div class="docstring">
1017
+ <div class="discussion">
1018
+
1019
+ <p>Returns the value of attribute response</p>
1020
+
1021
+
1022
+ </div>
1023
+ </div>
1024
+ <div class="tags">
1025
+
1026
+
1027
+ </div><table class="source_code">
1028
+ <tr>
1029
+ <td>
1030
+ <pre class="lines">
1031
+
1032
+
1033
+ 3
1034
+ 4
1035
+ 5</pre>
1036
+ </td>
1037
+ <td>
1038
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
1039
+
1040
+ <span class='kw'>def</span> <span class='id identifier rubyid_response'>response</span>
1041
+ <span class='ivar'>@response</span>
1042
+ <span class='kw'>end</span></pre>
1043
+ </td>
1044
+ </tr>
1045
+ </table>
1046
+ </div>
1047
+
1048
+
1049
+ <span id="username=-instance_method"></span>
1050
+ <div class="method_details ">
1051
+ <h3 class="signature " id="username-instance_method">
1052
+
1053
+ - (<tt>Object</tt>) <strong>username</strong>
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+ </h3><div class="docstring">
1060
+ <div class="discussion">
1061
+
1062
+ <p>Returns the value of attribute username</p>
1063
+
1064
+
1065
+ </div>
1066
+ </div>
1067
+ <div class="tags">
1068
+
1069
+
1070
+ </div><table class="source_code">
1071
+ <tr>
1072
+ <td>
1073
+ <pre class="lines">
1074
+
1075
+
1076
+ 3
1077
+ 4
1078
+ 5</pre>
1079
+ </td>
1080
+ <td>
1081
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 3</span>
1082
+
1083
+ <span class='kw'>def</span> <span class='id identifier rubyid_username'>username</span>
1084
+ <span class='ivar'>@username</span>
1085
+ <span class='kw'>end</span></pre>
1086
+ </td>
1087
+ </tr>
1088
+ </table>
1089
+ </div>
1090
+
1091
+ </div>
1092
+
1093
+
1094
+ <div id="instance_method_details" class="method_details_list">
1095
+ <h2>Instance Method Details</h2>
1096
+
1097
+
1098
+ <div class="method_details first">
1099
+ <h3 class="signature first" id="get_rates-instance_method">
1100
+
1101
+ - (<tt>Object</tt>) <strong>get_rates</strong>(params = {})
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+ </h3><div class="docstring">
1108
+ <div class="discussion">
1109
+
1110
+ <p>Returns Hash a hash of services</p>
1111
+
1112
+
1113
+ </div>
1114
+ </div>
1115
+ <div class="tags">
1116
+ <p class="tag_title">Parameters:</p>
1117
+ <ul class="param">
1118
+
1119
+ <li>
1120
+
1121
+ <span class='name'>options</span>
1122
+
1123
+
1124
+ <span class='type'>(<tt>Hash</tt>)</span>
1125
+
1126
+
1127
+
1128
+ &mdash;
1129
+ <div class='inline'>
1130
+ <p>a customizable set of options</p>
1131
+ </div>
1132
+
1133
+ </li>
1134
+
1135
+ </ul>
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+ <p class="tag_title">Returns:</p>
1142
+ <ul class="return">
1143
+
1144
+ <li>
1145
+
1146
+
1147
+ <span class='type'></span>
1148
+
1149
+
1150
+
1151
+
1152
+ <div class='inline'>
1153
+ <p>Hash a hash of services</p>
1154
+ </div>
1155
+
1156
+ </li>
1157
+
1158
+ </ul>
1159
+
1160
+ </div><table class="source_code">
1161
+ <tr>
1162
+ <td>
1163
+ <pre class="lines">
1164
+
1165
+
1166
+ 77
1167
+ 78
1168
+ 79
1169
+ 80
1170
+ 81
1171
+ 82
1172
+ 83
1173
+ 84
1174
+ 85
1175
+ 86
1176
+ 87
1177
+ 88
1178
+ 89
1179
+ 90
1180
+ 91
1181
+ 92
1182
+ 93</pre>
1183
+ </td>
1184
+ <td>
1185
+ <pre class="code"><span class="info file"># File 'lib/canadapost.rb', line 77</span>
1186
+
1187
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_rates'>get_rates</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1188
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_origin_postal_code'>origin_postal_code</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:origin_postal_code</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s+</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:origin_postal_code</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1189
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_customer'>customer</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:customer</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:customer</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1190
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dimensions'>dimensions</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:dimensions</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:dimensions</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1191
+
1192
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content_type_header'>content_type_header</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_accept_header'>accept_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/vnd.cpc.ship.rate-v2+xml</span><span class='tstring_end'>&#39;</span></span>
1193
+
1194
+ <span class='kw'>begin</span>
1195
+ <span class='id identifier rubyid_do_request'>do_request</span><span class='lparen'>(</span><span class='id identifier rubyid_get_rates_xml'>get_rates_xml</span><span class='comma'>,</span> <span class='id identifier rubyid_get_rates_url'>get_rates_url</span><span class='rparen'>)</span>
1196
+ <span class='id identifier rubyid_services'>services</span> <span class='op'>=</span> <span class='id identifier rubyid_results'>results</span><span class='lbracket'>[</span><span class='symbol'>:price_quotes</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:price_quote</span><span class='rbracket'>]</span>
1197
+ <span class='id identifier rubyid_services'>services</span> <span class='op'>=</span> <span class='id identifier rubyid_services'>services</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:deep_symbolize_keys!</span><span class='rparen'>)</span>
1198
+ <span class='kw'>return</span> <span class='id identifier rubyid_services'>services</span>
1199
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1200
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ERROR :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
1201
+ <span class='kw'>end</span>
1202
+ <span class='kw'>return</span> <span class='id identifier rubyid_services'>services</span>
1203
+ <span class='kw'>end</span></pre>
1204
+ </td>
1205
+ </tr>
1206
+ </table>
1207
+ </div>
1208
+
1209
+ </div>
1210
+
1211
+ </div>
1212
+
1213
+ <div id="footer">
1214
+ Generated on Sat Dec 21 15:54:21 2013 by
1215
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1216
+ 0.8.7.3 (ruby-2.0.0).
1217
+ </div>
1218
+
1219
+ </body>
1220
+ </html>