hal-client 4.3.0 → 5.0.0

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: 77b2bd2a2ee75f106ff5dfc1ca7af3bb49c53ac7
4
- data.tar.gz: 5e2abf209a2e898da64afb88f0118a58a61a4c47
3
+ metadata.gz: 9c3528fbb7facf2ddaaf7cab9634d158b385edc3
4
+ data.tar.gz: c67b245256c4d41e8f859bfa90c0b2b14c58e450
5
5
  SHA512:
6
- metadata.gz: 8bbbb2faa0fcc3cc2f072b9fff4e0acf582509cd554cd0884aaeaa95ddcba4a81fc800970139a37a66550189f7b07eee9d5c4a80a95a301d9fa26b358fa02725
7
- data.tar.gz: 25982fec801a367a71d163ce0830e7cbaae826531a1d4d56505d2464a43c3264fb7865768adf740e0aeab7ad05363c5774c838fa1b9ca5d039614d99fdbbe8f1
6
+ metadata.gz: 296b8c5870795fb49c223bde5526ac3d2be9a9e506545919910752fb28bde495048e33bca1f24c4b88108c5ffbb127d328ac02f9e7752675ee3a2fbf017bcb53
7
+ data.tar.gz: 612db56ad0eb2dae52f6fd26004349d6d55bb2ec08471a645c6eafcb89e841ee79e95ef616e42935fbf236e0cefaf3e5eea2b40460e57f0cb4c2c10f69b853fb
data/README.md CHANGED
@@ -188,6 +188,10 @@ Or install it yourself as:
188
188
 
189
189
  $ gem install hal-client
190
190
 
191
+ ## Upgrading from 4.x to 5.x
192
+
193
+ `HalClient::RepresentationEditor#add_link` now raises if passed nil or empty values. This is the only breaking change.
194
+
191
195
  ## Upgrading from 3.x to 4.x
192
196
 
193
197
  Support for ruby 2.0 has been removed. Please upgrade to ruby 2.1 or later. No other breaking changes were made.
@@ -122,6 +122,7 @@ class HalClient
122
122
  # opts
123
123
  # :templated - is this link templated? Default: false
124
124
  def add_link(rel, target, opts={})
125
+ raise ArgumentError, "target must not be nil or empty" if target.nil? || target.empty?
125
126
  templated = opts.fetch(:templated, false)
126
127
 
127
128
  link_obj = { "href" => target.to_s }
@@ -1,3 +1,3 @@
1
1
  class HalClient
2
- VERSION = "4.3.0"
2
+ VERSION = "5.0.0"
3
3
  end
@@ -122,6 +122,14 @@ RSpec.describe HalClient::RepresentationEditor do
122
122
  .and have_link("about", with_href("http://example.com/another"))
123
123
  end
124
124
 
125
+ it "raises if target is nil" do
126
+ expect { subject.add_link("nowhere", nil) }.to raise_error(ArgumentError)
127
+ end
128
+
129
+ it "raises if target is empty" do
130
+ expect { subject.add_link("nowhere", "") }.to raise_error(ArgumentError)
131
+ end
132
+
125
133
  it "adds templated links" do
126
134
  expect(subject.add_link("related", "http://example.com/third{?wat}", templated: true))
127
135
  .to have_link "related", with_href("http://example.com/third{?wat}")
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: 4.3.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http