hal-client 3.2.0 → 3.2.1

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: b01e2f92e2ff7241a7b3b9af4e040792ce9254ef
4
- data.tar.gz: 70adee990ffa32582f0e40836353746066cf3478
3
+ metadata.gz: 8bf3dbaee4f59a7aebeef04df5f3b260ea96e14d
4
+ data.tar.gz: 10fbcaf4a00a62ac11e917e5d93214b810079e77
5
5
  SHA512:
6
- metadata.gz: 2ae965fff453c3252769221d653689da092c984fa2e30c47c1696b09ab9504ea13e8cde54a82d265e601a03248f44fe85b5d12245380a4795eff685bf1aa8cf3
7
- data.tar.gz: 1466db8f6c04ed59b314b15c996c6c118646989819a98bdac069d3e15bcf0a037052c1655156b8ce1479b317e052670d9e98bcaca652ab3427a406d1321a7b23
6
+ metadata.gz: ffc936c961f98e01120b3e06d1f3a76f594747b44d2fb7ac8d30f3cd3ad11be2e08be478f1abad14a1dd91bde237d763699d69740e77b1df2115117667953233
7
+ data.tar.gz: 5dca7b5381d4c78444461780ba7851a265d4bd578249b5d154b8dad883b880e7adb006691041181c3cb4d6a1084d8d36490df6e434d4a4226e5ce1c684ecfbc9
@@ -83,7 +83,11 @@ class HalClient
83
83
 
84
84
  # Returns the URL of the resource this representation represents.
85
85
  def href
86
- @href ||= links.hrefs('self').first
86
+ @href ||= if has_related? "self"
87
+ links.hrefs('self').first
88
+ else
89
+ nil
90
+ end
87
91
  end
88
92
 
89
93
  # Returns the value of the specified property or representations
@@ -200,7 +204,7 @@ class HalClient
200
204
  # Returns a short human readable description of this
201
205
  # representation.
202
206
  def to_s
203
- "#<" + self.class.name + ": " + href + ">"
207
+ "#<" + self.class.name + ": " + (href || "ANONYMOUS") + ">"
204
208
  end
205
209
 
206
210
  # Returns the raw json representation of this representation
@@ -1,3 +1,3 @@
1
1
  class HalClient
2
- VERSION = "3.2.0"
2
+ VERSION = "3.2.1"
3
3
  end
@@ -75,6 +75,13 @@ HAL
75
75
  subject(:return_val) { repr.to_s }
76
76
 
77
77
  it { is_expected.to eq "#<HalClient::Representation: http://example.com/foo>" }
78
+
79
+ context "anonymous" do
80
+ let(:repr) { described_class.new(hal_client: a_client,
81
+ parsed_json: MultiJson.load("{}")) }
82
+
83
+ it { is_expected.to eq "#<HalClient::Representation: ANONYMOUS>" }
84
+ end
78
85
  end
79
86
 
80
87
  specify { expect(repr.property "prop1").to eq 1 }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http