maestrano-connector-rails 2.0.2.pre.RC2 → 2.0.2.pre.RC3

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: fe9b69ee7aafe9ac46d755de03dc7781929f6e36
4
- data.tar.gz: 4f52bc12c68ac6c471490d6958856da416f15fdb
3
+ metadata.gz: aa8b3f59cffa5ade47c728b287171f1c7bdd0c42
4
+ data.tar.gz: bcc4269dd6c0068d84845dbd1ff833ff42a3fa4e
5
5
  SHA512:
6
- metadata.gz: 55ede4aed50e33f8cdab471d6a62e69cc41f80a9539f09de072671aeb81d82862e1b426ab387fcbc9384a32a0fc42394a401882d2e68a0b629d76bd146b76fd9
7
- data.tar.gz: ec8a3be889554f9e7bea0b6afd244d176d14a5db35acca1bbd17d5c8612ba7cd729e7e8e972ec0929bf07397e36b460c91fa237c4b7fbf55cdc424e554297d50
6
+ metadata.gz: 812328467071809832e1a8369ca246f5b9d5ebf7a14a3ba467246d498443ba879621b8112ffb881438b9104414d2471d07da426e8cc1fad6bddcd2918e2506a1
7
+ data.tar.gz: 0d490ec05cf1109659b6b7ced8a714ff9b89116bca771d328f8c428b4970d4cabf7416029485b2d13b82daf975c929076dcd6f8ba5ee150744266cae7d47e634
data/Gemfile CHANGED
@@ -22,6 +22,7 @@ gem 'slim'
22
22
 
23
23
  # Add dependencies to develop your gem here.
24
24
  group :development do
25
+ gem 'webmock', '~> 1.24.1'
25
26
  gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
26
27
  gem 'bundler'
27
28
  gem 'factory_girl_rails'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2.pre.RC2
1
+ 2.0.2.pre.RC3
@@ -14,8 +14,9 @@ module Maestrano::Connector::Rails
14
14
  def initialize
15
15
  super
16
16
  self.synchronized_entities = {}
17
+ self.set_instance_metadata
17
18
  External.entities_list.each do |entity|
18
- self.synchronized_entities[entity.to_sym] = {can_push_to_connec: true, can_push_to_external: true}
19
+ self.synchronized_entities[entity.to_sym] = {can_push_to_connec: !self.pull_disabled, can_push_to_external: !self.push_disabled}
19
20
  end
20
21
  end
21
22
 
@@ -141,9 +142,10 @@ module Maestrano::Connector::Rails
141
142
  def set_instance_metadata
142
143
  auth = {username: Maestrano[tenant].param('api.id'), password: Maestrano[tenant].param('api.key')}
143
144
  res = HTTParty.get("#{Maestrano[tenant].param('api.host')}/api/v1/account/groups/#{uid}", basic_auth: auth)
145
+ response = JSON.parse(res.body)
144
146
 
145
- self.push_disabled = res.dig('data', 'metadata', 'push_disabled')
146
- self.pull_disabled = res.dig('data', 'metadata', 'pull_disabled')
147
+ self.push_disabled = response.dig('data', 'metadata', 'push_disabled')
148
+ self.pull_disabled = response.dig('data', 'metadata', 'pull_disabled')
147
149
 
148
150
  self.save
149
151
  end
@@ -1,15 +1,18 @@
1
1
  class UpdateOrganizationMetadata < ActiveRecord::Migration
2
2
  def change
3
- add_column :organizations, :push_disabled, :boolean
4
- add_column :organizations, :pull_disabled, :boolean
5
- # Migration to update the way we handle synchronized_entities for data sharing.
6
- # Before : synchronized_entities = {company: true}
7
- # After: synchronized_entities = {company: {can_push_to_connec: true, can_push_to_external: true}}
3
+ add_column :organizations, :push_disabled, :boolean
4
+ add_column :organizations, :pull_disabled, :boolean
5
+ change_column :organizations, :synchronized_entities, :text
8
6
 
9
- #We also add metadata from MnoHub
7
+ # Migration to update the way we handle synchronized_entities for data sharing.
8
+ # Before : synchronized_entities = {company: true}
9
+ # After: synchronized_entities = {company: {can_push_to_connec: true, can_push_to_external: true}}
10
+
11
+ #We also add metadata from MnoHub
10
12
  Maestrano::Connector::Rails::Organization.all.each do |o|
11
13
  o.set_instance_metadata
12
14
  o.reset_synchronized_entities
15
+ o.enable_historical_data(true) if o.push_disabled
13
16
  end
14
17
  end
15
18
  end
@@ -2,11 +2,11 @@
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 2.0.2.pre.RC2 ruby lib
5
+ # stub: maestrano-connector-rails 2.0.2.pre.RC3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maestrano-connector-rails".freeze
9
- s.version = "2.0.2.pre.RC2"
9
+ s.version = "2.0.2.pre.RC3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -242,6 +242,7 @@ Gem::Specification.new do |s|
242
242
  s.add_runtime_dependency(%q<sidekiq-unique-jobs>.freeze, [">= 0"])
243
243
  s.add_runtime_dependency(%q<sinatra>.freeze, [">= 0"])
244
244
  s.add_runtime_dependency(%q<slim>.freeze, [">= 0"])
245
+ s.add_development_dependency(%q<webmock>.freeze, ["~> 1.24.1"])
245
246
  s.add_development_dependency(%q<activerecord-jdbcsqlite3-adapter>.freeze, [">= 0"])
246
247
  s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
247
248
  s.add_development_dependency(%q<factory_girl_rails>.freeze, [">= 0"])
@@ -270,6 +271,7 @@ Gem::Specification.new do |s|
270
271
  s.add_dependency(%q<sidekiq-unique-jobs>.freeze, [">= 0"])
271
272
  s.add_dependency(%q<sinatra>.freeze, [">= 0"])
272
273
  s.add_dependency(%q<slim>.freeze, [">= 0"])
274
+ s.add_dependency(%q<webmock>.freeze, ["~> 1.24.1"])
273
275
  s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>.freeze, [">= 0"])
274
276
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
275
277
  s.add_dependency(%q<factory_girl_rails>.freeze, [">= 0"])
@@ -299,6 +301,7 @@ Gem::Specification.new do |s|
299
301
  s.add_dependency(%q<sidekiq-unique-jobs>.freeze, [">= 0"])
300
302
  s.add_dependency(%q<sinatra>.freeze, [">= 0"])
301
303
  s.add_dependency(%q<slim>.freeze, [">= 0"])
304
+ s.add_dependency(%q<webmock>.freeze, ["~> 1.24.1"])
302
305
  s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>.freeze, [">= 0"])
303
306
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
304
307
  s.add_dependency(%q<factory_girl_rails>.freeze, [">= 0"])
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'shoulda/matchers'
7
7
  require 'simplecov'
8
8
  require 'timecop'
9
9
  require 'maestrano_connector_rails/factories.rb'
10
+ require 'webmock/rspec'
10
11
  SimpleCov.start
11
12
 
12
13
  Rails.backtrace_cleaner.remove_silencers!
@@ -26,6 +27,8 @@ RSpec.configure do |config|
26
27
  allow(Maestrano::Connector::Rails::External).to receive(:external_name).and_return('External app')
27
28
  allow(Maestrano::Connector::Rails::External).to receive(:get_client).and_return(Object.new)
28
29
  allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w(entity1 entity2))
30
+ stub_request(:get, "#{Maestrano['default'].param('api.host')}/api/v1/account/groups/").
31
+ to_return({status: 200, body: "{}", headers: {}})
29
32
  Rails.cache.clear
30
33
  end
31
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2.pre.RC2
4
+ version: 2.0.2.pre.RC3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maestrano
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: webmock
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 1.24.1
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 1.24.1
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: activerecord-jdbcsqlite3-adapter
211
225
  requirement: !ruby/object:Gem::Requirement