sdl-ng 0.0.5 → 0.0.6
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/examples/services/salesforce_sales_cloud.service.rb +1 -1
- data/examples/translations/en.yml +6 -4
- data/lib/sdl.rb +4 -8
- data/lib/sdl/base/property.rb +4 -1
- data/lib/sdl/base/service_compendium.rb +1 -1
- data/lib/sdl/base/type.rb +6 -2
- data/lib/sdl/ng/version.rb +1 -1
- data/lib/sdl/receivers.rb +1 -13
- data/lib/sdl/receivers/service_receiver.rb +4 -4
- data/lib/sdl/receivers/type_instance_receiver.rb +4 -5
- data/lib/sdl/receivers/type_receiver.rb +3 -3
- data/lib/sdl/types.rb +9 -10
- data/lib/sdl/types/sdl_description.rb +14 -1
- data/lib/sdl/types/sdl_simple_type.rb +1 -14
- data/lib/sdl/types/sdl_url.rb +1 -1
- data/lib/sdl/util.rb +3 -3
- data/lib/sdl/util/documentation.rb +30 -17
- data/lib/sdl/util/nokogiri.rb +2 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d1ec08b2a5a2c3e43249e9b10d3de36c4c3a98b
|
4
|
+
data.tar.gz: 1c0a4526564013c5a575a0067d0928222398d466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7d602e5a4aea0d43a67ea9ccf6af365d71f81e18b89425787be450bbc84b0260e708f375c2c0443d537b2403fe068dc8e4aedcc2f0df2e9248dc3883eda962
|
7
|
+
data.tar.gz: 43a04fd9d23ddd0e0a8ef6bb9de7091f5d681cfef670bec02ea802512863706ffff9ffae953f2048a215cc8def1652e787ddc64df7b19bfc27ad98cee66539a6
|
@@ -42,7 +42,7 @@ has_payment_option credit_card
|
|
42
42
|
has_payment_option cheque
|
43
43
|
has_payment_option invoice
|
44
44
|
|
45
|
-
features = fetch_from_url 'http://www.salesforce.com/sales-cloud/overview/', '.slide h3 +
|
45
|
+
features = fetch_from_url 'http://www.salesforce.com/sales-cloud/overview/', '.slide h3 + *'
|
46
46
|
|
47
47
|
has_feature 'Mobile', features[0]
|
48
48
|
has_feature 'Contact Management', features[1]
|
@@ -10,10 +10,6 @@ en:
|
|
10
10
|
communication_protection: The communication with the service is protected
|
11
11
|
continuous_service_improvement: The service has continuous service improvement
|
12
12
|
means
|
13
|
-
continuous_service_improvement_feedback_page: The service has a feedback page
|
14
|
-
continuous_service_improvement_future_roadmap: The service has a future roadmap
|
15
|
-
continuous_service_improvement_past_release_notes: The service has past release
|
16
|
-
notes
|
17
13
|
data_capability: The service can carry out operations on a specific data format
|
18
14
|
data_deletion_policy: The service allows for complete deletion of user data
|
19
15
|
after termination of contract
|
@@ -116,6 +112,12 @@ en:
|
|
116
112
|
communication_protection: Protection means
|
117
113
|
continuous_service_improvement:
|
118
114
|
url: Link
|
115
|
+
continuous_service_improvement_feedback_page:
|
116
|
+
url: Feedback page
|
117
|
+
continuous_service_improvement_future_roadmap:
|
118
|
+
url: Future roadmap
|
119
|
+
continuous_service_improvement_past_release_notes:
|
120
|
+
url: Past release notes
|
119
121
|
data_capability:
|
120
122
|
format: Format
|
121
123
|
operation: Operation
|
data/lib/sdl.rb
CHANGED
@@ -5,8 +5,7 @@ require 'active_support/dependencies'
|
|
5
5
|
require 'active_support/inflector'
|
6
6
|
|
7
7
|
require 'i18n'
|
8
|
-
|
9
|
-
ActiveSupport::Dependencies.autoload_paths += ['sdl']
|
8
|
+
require 'verbs'
|
10
9
|
|
11
10
|
##
|
12
11
|
#
|
@@ -18,11 +17,8 @@ module SDL
|
|
18
17
|
autoload :Base
|
19
18
|
autoload :Exporters
|
20
19
|
autoload :Receivers
|
20
|
+
autoload :Types
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
require_relative 'sdl/util'
|
27
|
-
require_relative 'sdl/ng/version'
|
22
|
+
ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'sdl', 'util.rb')
|
23
|
+
ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'sdl', 'ng', 'version.rb')
|
28
24
|
end
|
data/lib/sdl/base/property.rb
CHANGED
@@ -10,9 +10,12 @@ class SDL::Base::Property
|
|
10
10
|
# Is this Property multi-valued
|
11
11
|
attr :multi
|
12
12
|
|
13
|
-
# The
|
13
|
+
# The type, for which the property is defined
|
14
14
|
attr :parent
|
15
15
|
|
16
|
+
# The type, which currently holds this property
|
17
|
+
attr_accessor :holder
|
18
|
+
|
16
19
|
# Is this Property single-valued
|
17
20
|
def single?
|
18
21
|
!@multi
|
@@ -111,7 +111,7 @@ class SDL::Base::ServiceCompendium
|
|
111
111
|
##
|
112
112
|
# Registers all default types
|
113
113
|
def register_default_types
|
114
|
-
SDL::Types::SDLSimpleType.
|
114
|
+
SDL::Types::SDLSimpleType.descendants.each do |type|
|
115
115
|
register_sdltype_codes type
|
116
116
|
end
|
117
117
|
end
|
data/lib/sdl/base/type.rb
CHANGED
@@ -23,9 +23,13 @@ class SDL::Base::Type
|
|
23
23
|
|
24
24
|
def properties(including_super = false)
|
25
25
|
if including_super && is_sub?
|
26
|
-
self.properties + superclass.properties(true)
|
26
|
+
retrieved_properties = self.properties + superclass.properties(true)
|
27
27
|
else
|
28
|
-
@properties ||= []
|
28
|
+
retrieved_properties = @properties ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
retrieved_properties.each do |p|
|
32
|
+
p.holder = self
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
data/lib/sdl/ng/version.rb
CHANGED
data/lib/sdl/receivers.rb
CHANGED
@@ -2,22 +2,10 @@ module SDL
|
|
2
2
|
module Receivers
|
3
3
|
extend ActiveSupport::Autoload
|
4
4
|
|
5
|
+
autoload :Receiver
|
5
6
|
autoload :FactReceiver
|
6
7
|
autoload :ServiceReceiver
|
7
8
|
autoload :TypeReceiver
|
8
9
|
autoload :TypeInstanceReceiver
|
9
|
-
|
10
|
-
#
|
11
|
-
def self.set_value(type_class, type_instance, *property_values, compendium)
|
12
|
-
property_values.zip(type_class.properties(true)).each do |value, property|
|
13
|
-
if(value.is_a?(Hash))
|
14
|
-
TypeInstanceReceiver.new(type_instance, compendium).send(value.keys.first.to_s, value.values.first)
|
15
|
-
else
|
16
|
-
raise "Specified value '#{value}' for non-existing property." unless property
|
17
|
-
|
18
|
-
TypeInstanceReceiver.new(type_instance, compendium).send(property.name, value)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
10
|
end
|
23
11
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'verbs'
|
2
2
|
|
3
|
-
class SDL::Receivers::ServiceReceiver
|
3
|
+
class SDL::Receivers::ServiceReceiver < SDL::Receivers::Receiver
|
4
4
|
include ActiveSupport::Inflector
|
5
5
|
|
6
6
|
attr :service
|
7
|
-
attr :compendium
|
8
7
|
|
9
8
|
def initialize(sym, compendium)
|
9
|
+
super(compendium)
|
10
|
+
|
10
11
|
@service = SDL::Base::Service.new(sym.to_s)
|
11
|
-
@compendium = compendium
|
12
12
|
|
13
13
|
compendium.fact_classes.each do |fact_class|
|
14
14
|
define_singleton_method("is_#{fact_class.local_name.underscore.verb.conjugate(:tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)}") do |*args, &block|
|
@@ -30,7 +30,7 @@ class SDL::Receivers::ServiceReceiver
|
|
30
30
|
fact_instance = fact_class.new
|
31
31
|
fact_instance.service = @service
|
32
32
|
|
33
|
-
|
33
|
+
set_value(fact_class, fact_instance, *property_values)
|
34
34
|
|
35
35
|
if block_given?
|
36
36
|
SDL::Receivers::TypeInstanceReceiver.new(fact_instance, @compendium).instance_eval &block
|
@@ -1,16 +1,15 @@
|
|
1
1
|
##
|
2
2
|
# Receiver for setting the properties of Type instances
|
3
|
-
class SDL::Receivers::TypeInstanceReceiver
|
3
|
+
class SDL::Receivers::TypeInstanceReceiver < SDL::Receivers::Receiver
|
4
4
|
attr_accessor :instance
|
5
5
|
|
6
|
-
attr_accessor :compendium
|
7
|
-
|
8
6
|
##
|
9
7
|
# When initialized for a fact or type instance, the receiver creates singleton methods on itself for all
|
10
8
|
# properties.
|
11
9
|
def initialize(instance, compendium)
|
10
|
+
super(compendium)
|
11
|
+
|
12
12
|
@instance = instance
|
13
|
-
@compendium = compendium
|
14
13
|
|
15
14
|
instance.class.properties(true).each do |property|
|
16
15
|
if property.single?
|
@@ -48,7 +47,7 @@ class SDL::Receivers::TypeInstanceReceiver
|
|
48
47
|
else
|
49
48
|
new_list_item = property.type.new
|
50
49
|
|
51
|
-
|
50
|
+
set_value(property.type, new_list_item, *property_values)
|
52
51
|
|
53
52
|
self.class.new(new_list_item, @compendium).instance_exec(&block) unless block.nil?
|
54
53
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
class SDL::Receivers::TypeReceiver
|
1
|
+
class SDL::Receivers::TypeReceiver < SDL::Receivers::Receiver
|
2
2
|
include ActiveSupport::Inflector
|
3
3
|
|
4
4
|
attr :klass
|
5
5
|
attr :subclasses
|
6
|
-
attr :compendium
|
7
6
|
|
8
7
|
def initialize(sym, compendium, superklass = nil)
|
9
|
-
|
8
|
+
super(compendium)
|
9
|
+
|
10
10
|
@klass = Class.new(superklass || base_class)
|
11
11
|
@klass.local_name = sym.to_s.camelize
|
12
12
|
|
data/lib/sdl/types.rb
CHANGED
@@ -9,17 +9,16 @@ module SDL
|
|
9
9
|
extend ActiveSupport::Autoload
|
10
10
|
|
11
11
|
# Required, as these types register Receiver methods for their usage in property definitions.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
autoload :SDLDuration
|
18
|
-
autoload :SDLNumber
|
19
|
-
autoload :SDLString
|
20
|
-
autoload :SDLUrl
|
12
|
+
autoload :SDLType
|
13
|
+
autoload :SDLSimpleType
|
14
|
+
|
15
|
+
%w[datetime description duration number string url].each do |typefile|
|
16
|
+
ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'types', "sdl_#{typefile}.rb")
|
21
17
|
end
|
22
18
|
|
23
|
-
|
19
|
+
autoload :SDLDescription
|
20
|
+
autoload :SDLDuration
|
21
|
+
autoload :SDLNumber
|
22
|
+
autoload :SDLUrl
|
24
23
|
end
|
25
24
|
end
|
@@ -1,10 +1,23 @@
|
|
1
|
+
##
|
2
|
+
# Description values are extended string values with additional conversion functions.
|
1
3
|
class SDL::Types::SDLDescription < SDL::Types::SDLSimpleType
|
2
4
|
include SDL::Types::SDLType
|
3
5
|
|
4
6
|
wraps String
|
5
7
|
codes :description
|
6
8
|
|
7
|
-
def
|
9
|
+
def from_nil_class(nilvalue)
|
8
10
|
@value = ""
|
9
11
|
end
|
12
|
+
|
13
|
+
def from_nokogiri_xml_element(element)
|
14
|
+
@value = element.content.squish
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_html
|
18
|
+
case @raw_value.class
|
19
|
+
when Nokogiri::XML::Element
|
20
|
+
@raw_value.to_s
|
21
|
+
end
|
22
|
+
end
|
10
23
|
end
|
@@ -5,19 +5,6 @@
|
|
5
5
|
class SDL::Types::SDLSimpleType
|
6
6
|
include SDL::Types::SDLType
|
7
7
|
|
8
|
-
##
|
9
|
-
# Array of all SDLSimpleTypes. Used by the ServiceCompendium.
|
10
|
-
def self.sdl_types
|
11
|
-
@@sdl_types ||= []
|
12
|
-
end
|
13
|
-
|
14
|
-
##
|
15
|
-
# Every descendant of SDLSimpleType registers it with this class, so that all ServiceCompendiums
|
16
|
-
# recognize the codes of descendants.
|
17
|
-
def self.inherited(subclass)
|
18
|
-
sdl_types << subclass
|
19
|
-
end
|
20
|
-
|
21
8
|
# The SDL value type value, possibly converted to the wrapped ruby type, e.g., an URI object created from an
|
22
9
|
# "http://" String
|
23
10
|
attr_reader :value
|
@@ -59,6 +46,6 @@ class SDL::Types::SDLSimpleType
|
|
59
46
|
|
60
47
|
private
|
61
48
|
def conversion_method_name(value)
|
62
|
-
value.class.name.
|
49
|
+
'from_' + value.class.name.underscore.gsub('/', '_')
|
63
50
|
end
|
64
51
|
end
|
data/lib/sdl/types/sdl_url.rb
CHANGED
data/lib/sdl/util.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
ActiveSupport::Dependencies.load_file File.join(__dir__, 'util', 'nokogiri.rb')
|
2
|
+
ActiveSupport::Dependencies.load_file File.join(__dir__, 'util', 'documentation.rb')
|
3
|
+
ActiveSupport::Dependencies.load_file File.join(__dir__, 'util', 'verbs.rb')
|
4
4
|
|
5
5
|
I18n.load_path << File.join(__dir__, 'translations', 'en.yml')
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'active_support/inflector'
|
2
2
|
|
3
|
+
I18n.config.enforce_available_locales = true
|
4
|
+
|
3
5
|
module I18n
|
4
6
|
class MissingTranslation
|
5
7
|
module Base
|
6
|
-
alias :old_message :message
|
8
|
+
alias :old_message :message unless method_defined?(:old_message)
|
7
9
|
|
8
10
|
def message
|
9
11
|
puts old_message
|
10
12
|
|
11
|
-
puts @key
|
12
|
-
|
13
13
|
I18n.backend.store_translations I18n.locale, to_deep_hash({@key => 'Translate'})
|
14
14
|
|
15
15
|
old_message
|
@@ -59,28 +59,41 @@ module SDL
|
|
59
59
|
|
60
60
|
klass_key
|
61
61
|
end
|
62
|
-
|
63
|
-
[SDL::Base::Type, SDL::Base::Fact, SDL::Base::Property].each do |m| m.class_eval do include SDL::Util::Documentation end end
|
64
62
|
end
|
65
63
|
end
|
66
|
-
end
|
67
64
|
|
68
|
-
module SDL
|
69
65
|
module Base
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
66
|
+
[Type, Fact, Property].each do |m| m.class_eval do include SDL::Util::Documentation end end
|
67
|
+
end
|
68
|
+
end
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
|
70
|
+
module SDL::Base
|
71
|
+
class Type
|
72
|
+
def self.documentation_key
|
73
|
+
"sdl.#{SDL::Util::Documentation.walk_the_class_name(self)}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def documentation_key
|
77
|
+
"sdl.instance.#{SDL::Util::Documentation.walk_the_class_name(self.class)}.#{@identifier}"
|
78
78
|
end
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
class Property
|
82
|
+
##
|
83
|
+
# As properties are inherited, the documentation could either be defined by the current type, or any subtypes, which
|
84
|
+
# also define or inherit this key. This method finds the first defined key.
|
85
|
+
def documentation_key
|
86
|
+
# Search class and ancestors, if any defines a documentation key
|
87
|
+
@holder.ancestors.each do |ancestor|
|
88
|
+
break if ancestor.eql? SDL::Base::Type
|
89
|
+
|
90
|
+
key = "sdl.property.#{SDL::Util::Documentation.walk_the_class_name(ancestor)}.#{@name}"
|
91
|
+
|
92
|
+
return key if I18n.exists? key
|
83
93
|
end
|
94
|
+
|
95
|
+
# Return default key
|
96
|
+
return "sdl.property.#{SDL::Util::Documentation.walk_the_class_name(@parent)}.#{@name}"
|
84
97
|
end
|
85
98
|
end
|
86
99
|
end
|
data/lib/sdl/util/nokogiri.rb
CHANGED
@@ -17,12 +17,6 @@ module SDL
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
[FactReceiver, ServiceReceiver, TypeInstanceReceiver, TypeReceiver].each do |r|
|
23
|
-
r.class_eval do
|
24
|
-
include(SDL::Util::NokogiriUtils)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
20
|
+
SDL::Receivers::Receiver.class_eval do
|
21
|
+
include(SDL::Util::NokogiriUtils)
|
28
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdl-ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Slawik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|