frodo 0.10.7 → 0.10.8
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 +4 -4
- data/lib/frodo/concerns/api.rb +5 -3
- data/lib/frodo/version.rb +1 -1
- data/spec/frodo/concerns/api_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 242a3a7ce0b9c2a356ba2cdba2445f8a7be56ebfce1c17b542389ed2e05941e8
|
4
|
+
data.tar.gz: fbbca282e8ef8ab298414dff1f646a471791b6ddff5461513647841d4a3717f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec596fae3c352d1fe14761180222b61807156fbff0827f4dcf5cb66e8a1cc4bf65e0af18d9166993bb3b2073ba5ab193fb08dc7153d2ede76c1b590176d5e38a
|
7
|
+
data.tar.gz: 024b0d345a278018da16c3e0cc5b257e45ada7bd7ffd6b0f54ad42287ecdeb2243216cbbd7e2830d8ca6a7aca17d8da5c697df7d1d5a9fce7bdb06749816b0c5
|
data/lib/frodo/concerns/api.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require 'erb'
|
4
3
|
require 'uri'
|
5
4
|
require 'frodo/concerns/verbs'
|
@@ -151,13 +150,16 @@ module Frodo
|
|
151
150
|
#
|
152
151
|
# Returns true if the entity was successfully updated.
|
153
152
|
# Raises an exception if an error is returned from Dynamics.
|
154
|
-
def update!(entity_set, attrs)
|
153
|
+
def update!(entity_set, attrs, additional_headers={})
|
155
154
|
entity = service[entity_set].new_entity(attrs)
|
156
155
|
url_chunk = to_url_chunk(entity)
|
157
156
|
|
158
157
|
raise ArgumentError, 'ID field missing from provided attributes' if entity.is_new?
|
159
158
|
|
160
|
-
api_patch url_chunk, attrs
|
159
|
+
api_patch url_chunk, attrs do |req|
|
160
|
+
puts "#{req.class.name}"
|
161
|
+
req.headers.merge!(additional_headers)
|
162
|
+
end
|
161
163
|
true
|
162
164
|
end
|
163
165
|
|
data/lib/frodo/version.rb
CHANGED
@@ -211,6 +211,27 @@ describe Frodo::Concerns::API do
|
|
211
211
|
expect(subject).to be(true)
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
context 'with additional headers' do
|
216
|
+
let(:additional_header) { {"header" => '1' } }
|
217
|
+
|
218
|
+
before do
|
219
|
+
stub_request(verb, uri).to_return(body: body.to_json, headers: headers.merge!(additional_header))
|
220
|
+
end
|
221
|
+
|
222
|
+
subject { client.update!(entity_type, attributes, additional_header) }
|
223
|
+
|
224
|
+
it 'should update' do
|
225
|
+
expect(subject).to be(true)
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'sets headers on the built request object' do
|
229
|
+
expect_any_instance_of(Faraday::Builder).to receive(:build_response)
|
230
|
+
.with(anything(), have_attributes(headers: hash_including(additional_header)))
|
231
|
+
|
232
|
+
subject
|
233
|
+
end
|
234
|
+
end
|
214
235
|
end
|
215
236
|
|
216
237
|
describe '.destroy' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Pinault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|