global_registry_models 0.10.2 → 0.11.0
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/.gitignore +1 -0
- data/README.md +1 -1
- data/global_registry_models.gemspec +2 -2
- data/lib/global_registry_models.rb +8 -1
- data/lib/global_registry_models/api_operations/add_enum_value.rb +14 -0
- data/lib/global_registry_models/api_operations/finders.rb +1 -1
- data/lib/global_registry_models/api_operations/persistence.rb +1 -0
- data/lib/global_registry_models/api_operations/search.rb +2 -2
- data/lib/global_registry_models/common_base.rb +13 -1
- data/lib/global_registry_models/entity/base.rb +31 -2
- data/lib/global_registry_models/entity/enum_value.rb +1 -2
- data/lib/global_registry_models/entity/global_mcc.rb +1 -1
- data/lib/global_registry_models/entity/indigitous_event_classic.rb +21 -0
- data/lib/global_registry_models/entity/indigitous_event_hash.rb +20 -0
- data/lib/global_registry_models/entity/indigitous_event_session.rb +20 -0
- data/lib/global_registry_models/entity/indigitous_event_session_attendee.rb +22 -0
- data/lib/global_registry_models/entity/ministry.rb +1 -0
- data/lib/global_registry_models/entity/person.rb +28 -0
- data/lib/global_registry_models/entity/relationship.rb +15 -0
- data/lib/global_registry_models/entity_type/base.rb +0 -5
- data/lib/global_registry_models/measurement_type/base.rb +0 -4
- data/lib/global_registry_models/relationship_type/base.rb +0 -4
- data/lib/global_registry_models/subscription/base.rb +0 -4
- data/lib/global_registry_models/system/base.rb +0 -5
- data/lib/global_registry_models/system/system.rb +5 -1
- data/lib/global_registry_models/version.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc67d0666fbdc964e5f262c01ba3f1199523018
|
4
|
+
data.tar.gz: 1c5e793ce80db4c64d5ff260e7a0d578cd3fb56e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318f53e62f0d21afdff5cc958389c263f133a0bf0c88b53815c4b429435a0ecbfcb28ba12e8f49ef8097dc7925e0c75467315b8e4400aaeaec095a8c7f38f324
|
7
|
+
data.tar.gz: 905f6ba3642d6fa5bf34b886c93f4e29dea6709ea3c3b8206fa40871cc4a2859b7d868a50515ea5ab60d62e14755edf2b6aa10251714d18a7290b7c68abb0e67
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
26
|
|
27
27
|
## Contributing
|
28
28
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/CruGlobal/global_registry_models
|
30
30
|
|
31
31
|
## License
|
32
32
|
|
@@ -6,12 +6,12 @@ require 'global_registry_models/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'global_registry_models'
|
8
8
|
spec.version = GlobalRegistryModels::VERSION
|
9
|
-
spec.authors = ['Sheldon Dueck','Daniel Fugere']
|
9
|
+
spec.authors = ['Sheldon Dueck', 'Daniel Fugere']
|
10
10
|
spec.email = ['sheldon.dueck@gmail.com']
|
11
11
|
|
12
12
|
spec.summary = %q{Data models for the Global Registry.}
|
13
13
|
spec.description = %q{Provides data models for interacting with the Global Registry. Built ontop of the client gem global_registry.}
|
14
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/CruGlobal/global_registry_models'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/all'
|
2
2
|
|
3
|
+
require 'global_registry/base'
|
3
4
|
require 'global_registry/subscription'
|
4
5
|
require 'global_registry/system_methods'
|
5
6
|
|
@@ -16,7 +17,7 @@ require 'global_registry_models/api_operations/finders'
|
|
16
17
|
require 'global_registry_models/api_operations/search'
|
17
18
|
require 'global_registry_models/api_operations/delete'
|
18
19
|
require 'global_registry_models/api_operations/reset_access_token'
|
19
|
-
|
20
|
+
require 'global_registry_models/api_operations/add_enum_value'
|
20
21
|
|
21
22
|
require 'global_registry_models/common_base'
|
22
23
|
|
@@ -28,6 +29,12 @@ require 'global_registry_models/entity/iso_country'
|
|
28
29
|
require 'global_registry_models/entity/ministry'
|
29
30
|
require 'global_registry_models/entity/ministry_brand'
|
30
31
|
require 'global_registry_models/entity/target_area'
|
32
|
+
require 'global_registry_models/entity/person'
|
33
|
+
require 'global_registry_models/entity/indigitous_event_classic'
|
34
|
+
require 'global_registry_models/entity/indigitous_event_hash'
|
35
|
+
require 'global_registry_models/entity/indigitous_event_session'
|
36
|
+
require 'global_registry_models/entity/indigitous_event_session_attendee'
|
37
|
+
require 'global_registry_models/entity/relationship'
|
31
38
|
|
32
39
|
require 'global_registry_models/entity_type/base'
|
33
40
|
require 'global_registry_models/entity_type/entity_type'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module APIOperations
|
3
|
+
module AddEnumValue
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def add_enum_value(entity_type_name, enum_value)
|
8
|
+
hash = { 'entity' => { '_enum_values' => { entity_type_name => enum_value } } }
|
9
|
+
GlobalRegistry::Entity.post(hash)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -9,7 +9,7 @@ module GlobalRegistryModels
|
|
9
9
|
|
10
10
|
module ClassMethods
|
11
11
|
|
12
|
-
def all!(filters: nil, start_page: 1, per_page: nil, order: nil, fields:
|
12
|
+
def all!(filters: nil, start_page: 1, per_page: nil, order: nil, fields: '*', ruleset: nil, max_attempts: 1)
|
13
13
|
GlobalRegistryModels::Collection.new(meta: {}, list: []).tap do |collection|
|
14
14
|
page_num = start_page
|
15
15
|
loop do
|
@@ -8,6 +8,7 @@ module GlobalRegistryModels
|
|
8
8
|
def prepare_parameters(object, attributes)
|
9
9
|
attribute_keys = attributes.keys.collect(&:to_sym) & writeable_attributes
|
10
10
|
prepared_attributes = object.attributes.with_indifferent_access.slice(*attribute_keys)
|
11
|
+
prepared_attributes = specific_attributes_preparations(object, prepared_attributes)
|
11
12
|
prepared_attributes
|
12
13
|
end
|
13
14
|
|
@@ -4,8 +4,8 @@ module GlobalRegistryModels
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
module ClassMethods
|
7
|
-
|
8
|
-
def search(filters: nil, page: nil, per_page: nil, order: nil, fields:
|
7
|
+
|
8
|
+
def search(filters: nil, page: nil, per_page: nil, order: nil, fields: default_field, ruleset: nil)
|
9
9
|
|
10
10
|
params = params_by_offset_and_limit(page, per_page) if requires_pagination?(page, per_page)
|
11
11
|
|
@@ -39,11 +39,23 @@ module GlobalRegistryModels
|
|
39
39
|
attribute_names - [:id]
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.default_field
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.has_meta
|
47
|
+
true
|
48
|
+
end
|
49
|
+
|
42
50
|
private
|
43
51
|
|
44
52
|
def underscore_name
|
45
53
|
self.name = self.name.downcase.tr(' ','_') if self.name
|
46
|
-
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.specific_attributes_preparations(object, attributes)
|
57
|
+
attributes
|
58
|
+
end
|
47
59
|
|
48
60
|
end
|
49
61
|
|
@@ -7,6 +7,14 @@ module GlobalRegistryModels
|
|
7
7
|
attribute :client_integration_id, String
|
8
8
|
validates_presence_of :client_integration_id
|
9
9
|
|
10
|
+
def initialize(params = {})
|
11
|
+
super(params)
|
12
|
+
@relationships = []
|
13
|
+
params.each do |key,value|
|
14
|
+
create_relationship(key,value) if key.to_s.include? ':relationship'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
def self.search_params
|
11
19
|
{
|
12
20
|
entity_type: name
|
@@ -26,8 +34,29 @@ module GlobalRegistryModels
|
|
26
34
|
to_s.gsub(/.*::/, '').underscore
|
27
35
|
end
|
28
36
|
|
29
|
-
def self.
|
30
|
-
|
37
|
+
def self.default_field
|
38
|
+
'*'
|
39
|
+
end
|
40
|
+
|
41
|
+
def relationships
|
42
|
+
@relationships
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.specific_attributes_preparations(object, attributes)
|
46
|
+
object.relationships.each do |relationship|
|
47
|
+
attributes["#{relationship.relationship_type}:relationship"] = {
|
48
|
+
relationship.entity_type => relationship.related_entity_id,
|
49
|
+
'client_integration_id' => relationship.client_integration_id
|
50
|
+
}
|
51
|
+
end
|
52
|
+
attributes
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def create_relationship(key,value_hash)
|
58
|
+
@relationships << Relationship.new(relationship_type: key.to_s.split(':').first, entity_type: value_hash.keys.first,
|
59
|
+
related_entity_id: value_hash.values.first, client_integration_id: value_hash['client_integration_id'])
|
31
60
|
end
|
32
61
|
end
|
33
62
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module GlobalRegistryModels
|
2
2
|
module Entity
|
3
3
|
class EnumValueBase < Base
|
4
|
-
|
4
|
+
include GlobalRegistryModels::APIOperations::AddEnumValue
|
5
5
|
attribute :enum_value, String
|
6
6
|
|
7
7
|
def initialize(enum_value)
|
@@ -15,7 +15,6 @@ module GlobalRegistryModels
|
|
15
15
|
def to_s
|
16
16
|
enum_value
|
17
17
|
end
|
18
|
-
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class IndigitousEventClassic < Base
|
4
|
+
attribute :city, String
|
5
|
+
attribute :date, String
|
6
|
+
attribute :full_attendees, Integer
|
7
|
+
attribute :day_pass_attendees, Integer
|
8
|
+
attribute :nations, Integer
|
9
|
+
attribute :organizations, Integer
|
10
|
+
attribute :projects, Integer
|
11
|
+
|
12
|
+
def self.identifying_attributes
|
13
|
+
[:city, :date, :full_attendees]
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"#{city} #{date}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class IndigitousEventHash < Base
|
4
|
+
attribute :date, Date
|
5
|
+
attribute :city, String
|
6
|
+
attribute :country, String
|
7
|
+
attribute :days, Integer
|
8
|
+
attribute :local_lead, String
|
9
|
+
attribute :number_attended, Integer
|
10
|
+
|
11
|
+
def self.identifying_attributes
|
12
|
+
[:city, :date, :number_attended]
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
"#{city} #{date.to_s}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class IndigitousEventSession < Base
|
4
|
+
attribute :date, Date
|
5
|
+
attribute :title, String
|
6
|
+
attribute :webinar_id, String
|
7
|
+
attribute :language, String
|
8
|
+
attribute :registered, Integer
|
9
|
+
attribute :attended, Integer
|
10
|
+
|
11
|
+
def self.identifying_attributes
|
12
|
+
[:title, :date, :attended]
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
title
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class IndigitousEventSessionAttendee < Base
|
4
|
+
attribute :attended, Boolean
|
5
|
+
attribute :interest_rating, Integer
|
6
|
+
attribute :last_name, String
|
7
|
+
attribute :first_name, String
|
8
|
+
attribute :email_address, String
|
9
|
+
attribute :registration_date, Date
|
10
|
+
attribute :time_in_session, String
|
11
|
+
attribute :indigitous_event_session, Hash
|
12
|
+
|
13
|
+
def self.identifying_attributes
|
14
|
+
[:attended, :first_name, :last_name]
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
"#{first_name} #{last_name}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class Person < Base
|
4
|
+
attribute :first_name, String
|
5
|
+
attribute :last_name, String
|
6
|
+
attribute :gsw_access, Boolean
|
7
|
+
attribute :key_guid, String
|
8
|
+
|
9
|
+
def initialize(params)
|
10
|
+
super
|
11
|
+
self.key_guid = params['authentication'] && params['authentication']['key_guid'] unless self.key_guid
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
[first_name, last_name].compact.join(' ')
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.specific_attributes_preparations(object, attributes)
|
21
|
+
attributes = super(object, attributes)
|
22
|
+
attributes['authentication'] = {'key_guid' => attributes['key_guid']} if attributes['key_guid']
|
23
|
+
attributes.delete('key_guid')
|
24
|
+
attributes
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GlobalRegistryModels
|
2
|
+
module Entity
|
3
|
+
class Relationship < Base
|
4
|
+
attribute :relationship_type, String
|
5
|
+
attribute :entity_type, String
|
6
|
+
attribute :related_entity_id, String
|
7
|
+
attribute :relationship_entity_id, String
|
8
|
+
|
9
|
+
def self.identifying_attributes
|
10
|
+
[:name, :description, :is_editable, :field_type, :data_visibility, :parent_id]
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -14,7 +14,7 @@ module GlobalRegistryModels
|
|
14
14
|
validates_presence_of :name
|
15
15
|
|
16
16
|
def self.identifying_attributes
|
17
|
-
[:id, :name, :contact_name, :contact_email, :permalink
|
17
|
+
[:id, :name, :contact_name, :contact_email, :permalink]
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.identifying_root_attributes
|
@@ -25,6 +25,10 @@ module GlobalRegistryModels
|
|
25
25
|
find 'deadbeef-dead-beef-dead-beefdeadbeef'
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.has_meta
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: global_registry_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Dueck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02
|
12
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/global_registry/system_methods.rb
|
148
148
|
- lib/global_registry_models.rb
|
149
149
|
- lib/global_registry_models/.DS_Store
|
150
|
+
- lib/global_registry_models/api_operations/add_enum_value.rb
|
150
151
|
- lib/global_registry_models/api_operations/delete.rb
|
151
152
|
- lib/global_registry_models/api_operations/finders.rb
|
152
153
|
- lib/global_registry_models/api_operations/persistence.rb
|
@@ -159,9 +160,15 @@ files:
|
|
159
160
|
- lib/global_registry_models/entity/base.rb
|
160
161
|
- lib/global_registry_models/entity/enum_value.rb
|
161
162
|
- lib/global_registry_models/entity/global_mcc.rb
|
163
|
+
- lib/global_registry_models/entity/indigitous_event_classic.rb
|
164
|
+
- lib/global_registry_models/entity/indigitous_event_hash.rb
|
165
|
+
- lib/global_registry_models/entity/indigitous_event_session.rb
|
166
|
+
- lib/global_registry_models/entity/indigitous_event_session_attendee.rb
|
162
167
|
- lib/global_registry_models/entity/iso_country.rb
|
163
168
|
- lib/global_registry_models/entity/ministry.rb
|
164
169
|
- lib/global_registry_models/entity/ministry_brand.rb
|
170
|
+
- lib/global_registry_models/entity/person.rb
|
171
|
+
- lib/global_registry_models/entity/relationship.rb
|
165
172
|
- lib/global_registry_models/entity/target_area.rb
|
166
173
|
- lib/global_registry_models/entity_type/.DS_Store
|
167
174
|
- lib/global_registry_models/entity_type/base.rb
|
@@ -182,7 +189,7 @@ files:
|
|
182
189
|
- lib/global_registry_models/system/base.rb
|
183
190
|
- lib/global_registry_models/system/system.rb
|
184
191
|
- lib/global_registry_models/version.rb
|
185
|
-
homepage: https://github.com/
|
192
|
+
homepage: https://github.com/CruGlobal/global_registry_models
|
186
193
|
licenses:
|
187
194
|
- MIT
|
188
195
|
metadata: {}
|