maestrano-connector-rails 1.0.0 → 1.0.1
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/VERSION +1 -1
- data/app/models/maestrano/connector/rails/concerns/entity.rb +1 -0
- data/maestrano-connector-rails.gemspec +2 -2
- data/release_notes.md +1 -0
- data/spec/integration/singleton_spec.rb +10 -5
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a68bf394fe0506af2d7ebf7f26fd3d03c05f3fb6
         | 
| 4 | 
            +
              data.tar.gz: cf4b53e1b341757e263e0c12b68192fcbe187344
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a3feb1c40cef5102c1d68ff42b988b07fe604b2b9a2f70c4a5c1a6563310915003211ada51a2e063c2219f3796be7b5fd0dae664b24217b55255733793253264
         | 
| 7 | 
            +
              data.tar.gz: 6e0cc236c7a0e449a39611225ac8f2bf490f81556691ed5d7c26f52dab454dd7edc58fdd1aeb01206d6686d563db3b6c24189712bb0b265ca92093221da62e8d
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.0. | 
| 1 | 
            +
            1.0.1
         | 
| @@ -176,6 +176,7 @@ module Maestrano::Connector::Rails::Concerns::Entity | |
| 176 176 | 
             
                uri = "/#{self.class.normalized_connec_entity_name}?#{query_params.to_query}"
         | 
| 177 177 | 
             
                response_hash = fetch_connec(uri, 0)
         | 
| 178 178 | 
             
                entities = response_hash["#{self.class.normalized_connec_entity_name}"]
         | 
| 179 | 
            +
                entities = [entities] if self.class.singleton?
         | 
| 179 180 |  | 
| 180 181 | 
             
                # Fetch subsequent pages
         | 
| 181 182 | 
             
                while response_hash['pagination'] && response_hash['pagination']['next']
         | 
| @@ -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 1.0. | 
| 5 | 
            +
            # stub: maestrano-connector-rails 1.0.1 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "maestrano-connector-rails"
         | 
| 9 | 
            -
              s.version = "1.0. | 
| 9 | 
            +
              s.version = "1.0.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"]
         | 
    
        data/release_notes.md
    CHANGED
    
    | @@ -43,6 +43,7 @@ A major refactoring as lead to some breaking changes: | |
| 43 43 | 
             
            `not_modified_since_last_push_to_connec?`
         | 
| 44 44 | 
             
            `is_external_more_recent?`
         | 
| 45 45 | 
             
            `solve_conflict`
         | 
| 46 | 
            +
            * Organization.uid is now enforced as an uniq attributes
         | 
| 46 47 |  | 
| 47 48 | 
             
            * The following methods have been removed
         | 
| 48 49 | 
             
            `map_to_external_with_idmap`
         | 
| @@ -53,7 +53,7 @@ describe 'singleton workflow' do | |
| 53 53 | 
             
              let(:company_base) {
         | 
| 54 54 | 
             
                {
         | 
| 55 55 | 
             
                  "name" => "My awesome company",
         | 
| 56 | 
            -
                  "updated_at" => connec_updated
         | 
| 56 | 
            +
                  "updated_at" => connec_updated.iso8601
         | 
| 57 57 | 
             
                }
         | 
| 58 58 | 
             
              }
         | 
| 59 59 |  | 
| @@ -61,7 +61,7 @@ describe 'singleton workflow' do | |
| 61 61 | 
             
                {
         | 
| 62 62 | 
             
                  'id' => ext_comp_id,
         | 
| 63 63 | 
             
                  'name' => 'My not so awesome store',
         | 
| 64 | 
            -
                  'updated_at' => ext_updated
         | 
| 64 | 
            +
                  'updated_at' => ext_updated.iso8601
         | 
| 65 65 | 
             
                }
         | 
| 66 66 | 
             
              }
         | 
| 67 67 |  | 
| @@ -99,7 +99,7 @@ describe 'singleton workflow' do | |
| 99 99 | 
             
              describe 'when no idmap' do
         | 
| 100 100 |  | 
| 101 101 | 
             
                describe 'when received both' do
         | 
| 102 | 
            -
                  let(:company) {  | 
| 102 | 
            +
                  let(:company) { company_base.merge('id' => [{'id' => 'some connec id', 'provider' => 'connec', 'realm' => organization.uid}]) }
         | 
| 103 103 | 
             
                  let(:ext_company) { [ext_company_base] }
         | 
| 104 104 |  | 
| 105 105 | 
             
                  context 'when connec most recent' do
         | 
| @@ -127,6 +127,11 @@ describe 'singleton workflow' do | |
| 127 127 | 
             
                      }
         | 
| 128 128 | 
             
                    }
         | 
| 129 129 |  | 
| 130 | 
            +
                    it 'handles the get correctly' do
         | 
| 131 | 
            +
                      expect_any_instance_of(Entities::SingletonIntegration).to receive(:consolidate_and_map_data).with([company], ext_company).and_return({connec_entities: [], external_entities: []})
         | 
| 132 | 
            +
                      subject
         | 
| 133 | 
            +
                    end
         | 
| 134 | 
            +
             | 
| 130 135 | 
             
                    it 'handles the idmap correctly' do
         | 
| 131 136 | 
             
                      expect{
         | 
| 132 137 | 
             
                        subject
         | 
| @@ -182,7 +187,7 @@ describe 'singleton workflow' do | |
| 182 187 |  | 
| 183 188 | 
             
              describe 'when idmap exists' do
         | 
| 184 189 | 
             
                describe 'when received both' do
         | 
| 185 | 
            -
                  let(:company) {  | 
| 190 | 
            +
                  let(:company) { company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}]) }
         | 
| 186 191 | 
             
                  let(:ext_company) { [ext_company_base] }
         | 
| 187 192 | 
             
                  let!(:idmap) { Entities::SingletonIntegration.create_idmap(organization_id: organization.id, external_id: ext_comp_id) }
         | 
| 188 193 |  | 
| @@ -241,7 +246,7 @@ describe 'singleton workflow' do | |
| 241 246 | 
             
              end
         | 
| 242 247 |  | 
| 243 248 | 
             
              describe 'when received only connec one' do
         | 
| 244 | 
            -
                let(:company) {  | 
| 249 | 
            +
                let(:company) { company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}]) }
         | 
| 245 250 | 
             
                let(:ext_company) { [] }
         | 
| 246 251 | 
             
                let!(:idmap) { Entities::SingletonIntegration.create_idmap(organization_id: organization.id, external_id: ext_comp_id) }
         | 
| 247 252 |  |