maestrano-connector-rails 0.4.0 → 0.4.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: 296c3f72e80c6876a39e3161e752292bad97d03f
4
- data.tar.gz: 155def8dc10315c64595ae0c4e6284890f896254
3
+ metadata.gz: efabe776dea52e8b1601a0de62be567ad16961a1
4
+ data.tar.gz: b2c779a4717875396a79a9dae1bd2d80017d0095
5
5
  SHA512:
6
- metadata.gz: 97e21e2088c3d7774052fe11aa6380e456dfa884a1165a57696bc21b723db99696410cde4011d2c6f9824a92d0e15fa7251d2c21a48dd6892ec3ea0293264879
7
- data.tar.gz: 9915cf3654bb531970ccaf5dee230a53ec5de525b96b08659bd2dd912d67eca7457619c8f5545c9695daa63b6d1594c2084f7d1d58e1995adb0d415f729b158d
6
+ metadata.gz: c064cc33f54e2a4571f93ba294b26ae52a889a678d7b5f7a26968ef3a25997d29108c61a6d0518c19142520e10642cf8b9f8279da08a77a3cb04a1c4b4b8bfde
7
+ data.tar.gz: c0ad8eee085a0bf878786773bc61a7e698368c8cf57d0aa0651f8e51c1ed78f1aa9c382f45cd2c6c8c94111aefd780a9643608ea0f0ad8357c94170d51bdc534
data/Gemfile.lock CHANGED
@@ -1,36 +1,36 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (4.2.5.1)
5
- actionpack (= 4.2.5.1)
6
- actionview (= 4.2.5.1)
7
- activejob (= 4.2.5.1)
4
+ actionmailer (4.2.6)
5
+ actionpack (= 4.2.6)
6
+ actionview (= 4.2.6)
7
+ activejob (= 4.2.6)
8
8
  mail (~> 2.5, >= 2.5.4)
9
9
  rails-dom-testing (~> 1.0, >= 1.0.5)
10
- actionpack (4.2.5.1)
11
- actionview (= 4.2.5.1)
12
- activesupport (= 4.2.5.1)
10
+ actionpack (4.2.6)
11
+ actionview (= 4.2.6)
12
+ activesupport (= 4.2.6)
13
13
  rack (~> 1.6)
14
14
  rack-test (~> 0.6.2)
15
15
  rails-dom-testing (~> 1.0, >= 1.0.5)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
- actionview (4.2.5.1)
18
- activesupport (= 4.2.5.1)
17
+ actionview (4.2.6)
18
+ activesupport (= 4.2.6)
19
19
  builder (~> 3.1)
20
20
  erubis (~> 2.7.0)
21
21
  rails-dom-testing (~> 1.0, >= 1.0.5)
22
22
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- activejob (4.2.5.1)
24
- activesupport (= 4.2.5.1)
23
+ activejob (4.2.6)
24
+ activesupport (= 4.2.6)
25
25
  globalid (>= 0.3.0)
26
- activemodel (4.2.5.1)
27
- activesupport (= 4.2.5.1)
26
+ activemodel (4.2.6)
27
+ activesupport (= 4.2.6)
28
28
  builder (~> 3.1)
29
- activerecord (4.2.5.1)
30
- activemodel (= 4.2.5.1)
31
- activesupport (= 4.2.5.1)
29
+ activerecord (4.2.6)
30
+ activemodel (= 4.2.6)
31
+ activesupport (= 4.2.6)
32
32
  arel (~> 6.0)
33
- activesupport (4.2.5.1)
33
+ activesupport (4.2.6)
34
34
  i18n (~> 0.7)
35
35
  json (~> 1.7, >= 1.7.7)
36
36
  minitest (~> 5.1)
@@ -38,30 +38,30 @@ GEM
38
38
  tzinfo (~> 1.1)
39
39
  addressable (2.4.0)
40
40
  arel (6.0.3)
41
- autoprefixer-rails (6.3.3.1)
41
+ autoprefixer-rails (6.3.6)
42
42
  execjs
43
43
  bootstrap-sass (3.3.6)
44
44
  autoprefixer-rails (>= 5.2.1)
45
45
  sass (>= 3.3.4)
46
46
  builder (3.2.2)
47
- concurrent-ruby (1.0.0)
47
+ concurrent-ruby (1.0.1)
48
48
  connection_pool (2.2.0)
49
49
  descendants_tracker (0.0.4)
50
50
  thread_safe (~> 0.3, >= 0.3.1)
51
51
  diff-lcs (1.2.5)
52
52
  docile (1.1.5)
53
- domain_name (0.5.20160128)
53
+ domain_name (0.5.20160310)
54
54
  unf (>= 0.0.5, < 1.0.0)
55
55
  erubis (2.7.0)
56
56
  execjs (2.6.0)
57
- factory_girl (4.5.0)
57
+ factory_girl (4.7.0)
58
58
  activesupport (>= 3.0.0)
59
- factory_girl_rails (4.6.0)
60
- factory_girl (~> 4.5.0)
59
+ factory_girl_rails (4.7.0)
60
+ factory_girl (~> 4.7.0)
61
61
  railties (>= 3.0.0)
62
62
  faraday (0.9.2)
63
63
  multipart-post (>= 1.2, < 3)
64
- git (1.2.9.1)
64
+ git (1.3.0)
65
65
  github_api (0.13.1)
66
66
  addressable (~> 2.4.0)
67
67
  descendants_tracker (~> 0.0.4)
@@ -103,8 +103,8 @@ GEM
103
103
  nokogiri (>= 1.5.10)
104
104
  rake
105
105
  rdoc
106
- jquery-rails (4.1.0)
107
- rails-dom-testing (~> 1.0)
106
+ jquery-rails (4.1.1)
107
+ rails-dom-testing (>= 1, < 3)
108
108
  railties (>= 4.2.0)
109
109
  thor (>= 0.14, < 2.0)
110
110
  json (1.8.3)
@@ -113,19 +113,19 @@ GEM
113
113
  nokogiri (>= 1.5.9)
114
114
  macaddr (1.7.1)
115
115
  systemu (~> 2.6.2)
116
- maestrano (0.12.3)
116
+ maestrano (0.12.4)
117
117
  httparty (~> 0.13)
118
118
  json (~> 1.8)
119
119
  mime-types (~> 1.25)
120
120
  nokogiri (>= 1.5.0)
121
121
  rest-client (~> 1.4)
122
122
  uuid (~> 2.3)
123
- maestrano-rails (0.15.1)
123
+ maestrano-rails (0.15.2)
124
124
  jquery-rails
125
125
  maestrano
126
126
  rails
127
- mail (2.6.3)
128
- mime-types (>= 1.16, < 3)
127
+ mail (2.6.4)
128
+ mime-types (>= 1.16, < 4)
129
129
  mime-types (1.25.1)
130
130
  mini_portile2 (2.0.0)
131
131
  minitest (5.8.4)
@@ -144,16 +144,16 @@ GEM
144
144
  rack (1.6.4)
145
145
  rack-test (0.6.3)
146
146
  rack (>= 1.0)
147
- rails (4.2.5.1)
148
- actionmailer (= 4.2.5.1)
149
- actionpack (= 4.2.5.1)
150
- actionview (= 4.2.5.1)
151
- activejob (= 4.2.5.1)
152
- activemodel (= 4.2.5.1)
153
- activerecord (= 4.2.5.1)
154
- activesupport (= 4.2.5.1)
147
+ rails (4.2.6)
148
+ actionmailer (= 4.2.6)
149
+ actionpack (= 4.2.6)
150
+ actionview (= 4.2.6)
151
+ activejob (= 4.2.6)
152
+ activemodel (= 4.2.6)
153
+ activerecord (= 4.2.6)
154
+ activesupport (= 4.2.6)
155
155
  bundler (>= 1.3.0, < 2.0)
156
- railties (= 4.2.5.1)
156
+ railties (= 4.2.6)
157
157
  sprockets-rails
158
158
  rails-deprecated_sanitizer (1.0.3)
159
159
  activesupport (>= 4.2.0.alpha)
@@ -163,20 +163,20 @@ GEM
163
163
  rails-deprecated_sanitizer (>= 1.0.1)
164
164
  rails-html-sanitizer (1.0.3)
165
165
  loofah (~> 2.0)
166
- railties (4.2.5.1)
167
- actionpack (= 4.2.5.1)
168
- activesupport (= 4.2.5.1)
166
+ railties (4.2.6)
167
+ actionpack (= 4.2.6)
168
+ activesupport (= 4.2.6)
169
169
  rake (>= 0.8.7)
170
170
  thor (>= 0.18.1, < 2.0)
171
- rake (10.5.0)
171
+ rake (11.1.2)
172
172
  rdoc (3.12.2)
173
173
  json (~> 1.4)
174
- redis (3.2.2)
174
+ redis (3.3.0)
175
175
  rest-client (1.8.0)
176
176
  http-cookie (>= 1.0.2, < 2.0)
177
177
  mime-types (>= 1.16, < 3.0)
178
178
  netrc (~> 0.7)
179
- rspec-core (3.4.2)
179
+ rspec-core (3.4.4)
180
180
  rspec-support (~> 3.4.0)
181
181
  rspec-expectations (3.4.0)
182
182
  diff-lcs (>= 1.2.0, < 2.0)
@@ -195,7 +195,7 @@ GEM
195
195
  rspec-support (3.4.1)
196
196
  ruby_parser (3.8.1)
197
197
  sexp_processor (~> 4.1)
198
- sass (3.4.21)
198
+ sass (3.4.22)
199
199
  sexp_processor (4.7.0)
200
200
  shoulda (3.5.0)
201
201
  shoulda-context (~> 1.0, >= 1.0.1)
@@ -203,7 +203,7 @@ GEM
203
203
  shoulda-context (1.2.1)
204
204
  shoulda-matchers (2.8.0)
205
205
  activesupport (>= 3.0.0)
206
- sidekiq (4.1.0)
206
+ sidekiq (4.1.1)
207
207
  concurrent-ruby (~> 1.0)
208
208
  connection_pool (~> 2.2, >= 2.2.0)
209
209
  redis (~> 3.2, >= 3.2.1)
@@ -212,10 +212,10 @@ GEM
212
212
  json (~> 1.8)
213
213
  simplecov-html (~> 0.10.0)
214
214
  simplecov-html (0.10.0)
215
- sprockets (3.5.2)
215
+ sprockets (3.6.0)
216
216
  concurrent-ruby (~> 1.0)
217
217
  rack (> 1, < 3)
218
- sprockets-rails (3.0.1)
218
+ sprockets-rails (3.0.4)
219
219
  actionpack (>= 4.0)
220
220
  activesupport (>= 4.0)
221
221
  sprockets (>= 3.0.0)
@@ -251,3 +251,6 @@ DEPENDENCIES
251
251
  sidekiq
252
252
  simplecov
253
253
  sqlite3
254
+
255
+ BUNDLED WITH
256
+ 1.11.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -191,7 +191,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
191
191
  query_params[:$filter] = filter
192
192
  end
193
193
  response = client.get("/#{self.class.normalized_connec_entity_name}?#{query_params.to_query}")
194
- raise "No data received from Connec! when trying to fetch #{self.class.normalized_connec_entity_name}" unless response
194
+ raise "No data received from Connec! when trying to fetch #{self.class.normalized_connec_entity_name}" unless response && !response.body.blank?
195
195
 
196
196
  response_hash = JSON.parse(response.body)
197
197
  Maestrano::Connector::Rails::ConnectorLogger.log('debug', organization, "received first page entity=#{self.class.connec_entity_name}, response=#{response.body}")
@@ -207,7 +207,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
207
207
  next_page = response_hash['pagination']['next'].gsub(/^(.*)\/#{self.class.normalized_connec_entity_name}/, self.class.normalized_connec_entity_name)
208
208
  response = client.get(next_page)
209
209
 
210
- raise "No data received from Connec! when trying to fetch subsequent page of #{self.class.connec_entity_name.pluralize}" unless response
210
+ raise "No data received from Connec! when trying to fetch subsequent page of #{self.class.connec_entity_name.pluralize}" unless response && !response.body.blank?
211
211
  Maestrano::Connector::Rails::ConnectorLogger.log('debug', organization, "received next page entity=#{self.class.connec_entity_name}, response=#{response.body}")
212
212
 
213
213
  response_hash = JSON.parse(response.body)
@@ -251,7 +251,9 @@ module Maestrano::Connector::Rails::Concerns::Entity
251
251
 
252
252
  # Batch call
253
253
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending batch request to Connec! for #{self.class.normalize_connec_entity_name(connec_entity_name)}. Batch_request_size: #{batch_request[:ops].size}. Call_number: #{(start/request_per_call) + 1}")
254
- response = connec_client.post('/batch', batch_request)
254
+ response = connec_client.batch(batch_request)
255
+ Maestrano::Connector::Rails::ConnectorLogger.log('debug', organization, "Received batch response from Connec! for #{self.class.normalize_connec_entity_name(connec_entity_name)}: #{response}")
256
+ raise "No data received from Connec! when trying to send batch request for #{self.class.connec_entity_name.pluralize}" unless response && !response.body.blank?
255
257
  response = JSON.parse(response.body)
256
258
 
257
259
  # Parse barch response
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: maestrano-connector-rails 0.4.0 ruby lib
5
+ # stub: maestrano-connector-rails 0.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maestrano-connector-rails"
9
- s.version = "0.4.0"
9
+ s.version = "0.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Pierre Berard"]
14
- s.date = "2016-04-14"
14
+ s.date = "2016-04-19"
15
15
  s.description = "Maestrano is the next generation marketplace for SME applications. See https://maestrano.com for details."
16
16
  s.email = "pierre.berard@maestrano.com"
17
17
  s.executables = ["rails"]
@@ -388,7 +388,7 @@ describe Maestrano::Connector::Rails::ComplexEntity do
388
388
  allow(klass).to receive(:external?).and_return(true)
389
389
  allow(klass).to receive(:entity_name).and_return('n')
390
390
  end
391
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: [{status: 200, body: {connec1s: {}}}]}.to_json, {}))
391
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [{status: 200, body: {connec1s: {}}}]}.to_json, {}))
392
392
  }
393
393
  it 'is successful' do
394
394
  subject.push_entities_to_connec(client, external_hash, organization)
@@ -279,7 +279,7 @@ describe Maestrano::Connector::Rails::Entity do
279
279
 
280
280
  describe 'without response' do
281
281
  before {
282
- allow(client).to receive(:get).and_return(nil)
282
+ allow(client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, nil, {}))
283
283
  }
284
284
  it { expect{ subject.get_connec_entities(client, nil, organization) }.to raise_error("No data received from Connec! when trying to fetch #{connec_name.pluralize.downcase}") }
285
285
  end
@@ -318,7 +318,7 @@ describe Maestrano::Connector::Rails::Entity do
318
318
  context 'when create_only' do
319
319
  before {
320
320
  allow(subject.class).to receive(:can_update_connec?).and_return(false)
321
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: []}.to_json, {}))
321
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: []}.to_json, {}))
322
322
  }
323
323
 
324
324
  it 'creates batch op for create only' do
@@ -332,7 +332,7 @@ describe Maestrano::Connector::Rails::Entity do
332
332
  let(:result200) { {status: 200, body: {connec_name.downcase.pluralize.to_sym => {}}} }
333
333
  let(:result201) { {status: 201, body: {connec_name.downcase.pluralize.to_sym => {id: id}}} }
334
334
  before {
335
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: [result200, result201]}.to_json, {}))
335
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [result200, result201]}.to_json, {}))
336
336
  }
337
337
 
338
338
  let(:batch_request) {
@@ -359,7 +359,7 @@ describe Maestrano::Connector::Rails::Entity do
359
359
  end
360
360
 
361
361
  it 'creates a batch request' do
362
- expect(client).to receive(:post).with('/batch', batch_request)
362
+ expect(client).to receive(:batch).with(batch_request)
363
363
  subject.push_entities_to_connec_to(client, entities_with_idmaps, connec_name, organization)
364
364
  end
365
365
 
@@ -385,11 +385,11 @@ describe Maestrano::Connector::Rails::Entity do
385
385
  entities << entity_with_idmap1
386
386
  results << result200
387
387
  end
388
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: results}.to_json, {}))
388
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: results}.to_json, {}))
389
389
  }
390
390
 
391
391
  it 'does one call' do
392
- expect(client).to receive(:post).once
392
+ expect(client).to receive(:batch).once
393
393
  subject.push_entities_to_connec_to(client, entities, connec_name, organization)
394
394
  end
395
395
  end
@@ -401,11 +401,11 @@ describe Maestrano::Connector::Rails::Entity do
401
401
  results << result200
402
402
  end
403
403
  entities << entity_with_idmap2
404
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: results}.to_json, {}), ActionDispatch::Response.new(200, {}, {results: [result201]}.to_json, {}))
404
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: results}.to_json, {}), ActionDispatch::Response.new(200, {}, {results: [result201]}.to_json, {}))
405
405
  }
406
406
 
407
407
  it 'does several call' do
408
- expect(client).to receive(:post).twice
408
+ expect(client).to receive(:batch).twice
409
409
  subject.push_entities_to_connec_to(client, entities, connec_name, organization)
410
410
  end
411
411
 
@@ -422,7 +422,7 @@ describe Maestrano::Connector::Rails::Entity do
422
422
  context 'with errors' do
423
423
  let(:result400) { {status: 400, body: 'Not Found'} }
424
424
  before {
425
- allow(client).to receive(:post).and_return(ActionDispatch::Response.new(200, {}, {results: [result400, result400]}.to_json, {}))
425
+ allow(client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [result400, result400]}.to_json, {}))
426
426
  }
427
427
 
428
428
  it 'stores the errr in the idmap' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Berard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-14 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maestrano-rails