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 +4 -4
- data/lib/hal_client/representation.rb +6 -2
- data/lib/hal_client/version.rb +1 -1
- data/spec/hal_client/representation_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf3dbaee4f59a7aebeef04df5f3b260ea96e14d
|
4
|
+
data.tar.gz: 10fbcaf4a00a62ac11e917e5d93214b810079e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 ||=
|
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
|
data/lib/hal_client/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|