russianpost 0.4.2 → 0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 772b1e1f91222d1370f33a2b338728eb92c704cf
4
- data.tar.gz: abda3738909f807591b4e4a93a4a470ad1211b3d
3
+ metadata.gz: c5c7faa5c898406ea60051e097b08e86c3903511
4
+ data.tar.gz: fbecdcde1434ea1ae21708292bd3555c9132490a
5
5
  SHA512:
6
- metadata.gz: 5a801bf8b3046131a6f36e29c797b67b3b1501e41e74b8a976b6fbea7b62d4ae09c31a3319077b2c4bb1b9ecb71f864c41d4b40cd3b806bfc0ce7ae363c52e75
7
- data.tar.gz: 0f4b04debbfec647d7bb813447e8d8a2f8d501792f66ba0404dd03e002ea94ebfb08ade2a4a62c729635a232b874f51a4b40582cc7e3489a56bb285f3f915b7c
6
+ metadata.gz: 868eff4aa1929d16c5ebf7a7f23c5b5675d9640e2acf51a4c62186ca1c443519bc3aae7d067458261519d1d717356958acec792f7a731c6da2d89e19ba0494ed
7
+ data.tar.gz: 11eb9bae98a6860910dd9a78c6d4083ca2873723b17c1971017691a72bf0c3b55b2725564eda2ec0746c4ca91feb7b91b0bc1cfb82d5432275b33647c3e52638
data/README.md CHANGED
@@ -12,7 +12,7 @@ To install gem stand-alone:
12
12
 
13
13
  To use gem in a Rails app, add the following to your `Gemfile`:
14
14
 
15
- gem "russianpost", "~> 0.4.2"
15
+ gem "russianpost", "~> 0.4.3"
16
16
 
17
17
  This gem uses [Savon](http://savonrb.com/), which in turn uses [HTTPI](https://github.com/savonrb/httpi) internally. HTTPI chooses the best HTTP library of those you have installed. For the fastest results, make sure you add [Curb](https://github.com/taf2/curb) to your `Gemfile`:
18
18
 
@@ -54,7 +54,7 @@ RussianPost makes guesses about current state of the parcel.
54
54
 
55
55
  ### Operations API
56
56
 
57
- Each `Operation` responds to the following methods. If there is no information, methods return `nil`. More thorough documentation coming soon.
57
+ Each `Operation` responds to the following methods. If there is no information, methods return `nil`. See the [wiki](https://github.com/artemshitov/russianpost/wiki) for a list of what else can be returned.
58
58
 
59
59
  #### Address parameters
60
60
 
@@ -16,7 +16,7 @@ module RussianPost
16
16
  end
17
17
 
18
18
  def location
19
- operations.last.operation_address
19
+ operations.last.operation_address unless operations.empty?
20
20
  end
21
21
 
22
22
  def mass
@@ -32,7 +32,7 @@ module RussianPost
32
32
  end
33
33
 
34
34
  def type
35
- operations.last.mail_type
35
+ operations.last.mail_type unless operations.empty?
36
36
  end
37
37
 
38
38
  private
@@ -1,3 +1,3 @@
1
1
  module Russianpost
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -60,5 +60,14 @@ module RussianPost
60
60
  def test_knows_recipient
61
61
  assert_equal "ЕЛЕНА", parcel.recipient
62
62
  end
63
+
64
+ def test_meta_methods_dont_fail_when_no_operations
65
+ VCR.use_cassette("RR123456785EE") do
66
+ parcel = Parcel.new("RR123456785EE")
67
+ [:location, :mass, :type, :rank, :recipient].each do |m|
68
+ assert_nil parcel.send(m)
69
+ end
70
+ end
71
+ end
63
72
  end
64
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: russianpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Shitov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-30 00:00:00.000000000 Z
11
+ date: 2013-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler