frodo 0.10.7 → 0.10.8

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
  SHA256:
3
- metadata.gz: e79cbc935ff239133a2d2e8a4442dfc20485909cafd792d6ae0d8b7e3337754c
4
- data.tar.gz: 9f53db97b39d58ecd07229c3cfdedd25316dccb0d1836b8f324e72a9351597b5
3
+ metadata.gz: 242a3a7ce0b9c2a356ba2cdba2445f8a7be56ebfce1c17b542389ed2e05941e8
4
+ data.tar.gz: fbbca282e8ef8ab298414dff1f646a471791b6ddff5461513647841d4a3717f8
5
5
  SHA512:
6
- metadata.gz: c49953c39c409d193ddde2dc3cadf7259d2758b7b2a96122f354a62b1031827357a999b921bf926d2d08b147cdaeecd92e7d1d408e9a412c46e25ec581f0bd5a
7
- data.tar.gz: b6aaf7be4aed684517230a70e6a148d798931493d9803cabf89c788bbaeac6dd0e96f688c861df80146121cde6eec1f2fdaf11ec0533313222e95953f11f8564
6
+ metadata.gz: ec596fae3c352d1fe14761180222b61807156fbff0827f4dcf5cb66e8a1cc4bf65e0af18d9166993bb3b2073ba5ab193fb08dc7153d2ede76c1b590176d5e38a
7
+ data.tar.gz: 024b0d345a278018da16c3e0cc5b257e45ada7bd7ffd6b0f54ad42287ecdeb2243216cbbd7e2830d8ca6a7aca17d8da5c697df7d1d5a9fce7bdb06749816b0c5
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Frodo
2
- VERSION = '0.10.7'
2
+ VERSION = '0.10.8'
3
3
  end
@@ -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.7
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-24 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri