infopark_cloud_connector 6.8.0.beta.200.720.44fbabd → 6.8.0.beta.200.744.99f67fc

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,10 @@ module RailsConnector
29
29
  end
30
30
 
31
31
  def s3_storage(config)
32
+ if config && !config.key?("s3_endpoint") && !config.key?(:s3_endpoint)
33
+ config = config.merge(:s3_endpoint => "s3-eu-west-1.amazonaws.com")
34
+ end
35
+
32
36
  bucket = AWS::S3.new(config).buckets[config[:bucket_name]]
33
37
  Kvom::Storage::S3Storage.new({
34
38
  :bucket => bucket,
@@ -113,9 +113,12 @@ module RailsConnector
113
113
  external? || resolved_internal?
114
114
  end
115
115
 
116
- # Returns the destination object (+Obj+) of this Link.
116
+ # Returns the destination object (+Obj+) of this Link. May be nil if the
117
+ # link is external or internal without an existing destination object.
117
118
  def destination_object
118
119
  @destination_object ||= Obj.find(destination) if resolved_internal?
120
+ rescue RailsConnector::ResourceNotFound
121
+ nil
119
122
  end
120
123
 
121
124
  def to_liquid # :nodoc:
@@ -497,12 +497,12 @@ module RailsConnector
497
497
  # Returns a list of the names of all custom attributes defined for this Obj as Symbols.
498
498
  # A custom attribute is a user-defined attribute, i.e. one that is not built-in in the CMS.
499
499
  def custom_attribute_names
500
- @attributes.keys.map(&:to_sym)
500
+ attributes.keys.map(&:to_sym)
501
501
  end
502
502
 
503
503
  def has_attribute?(name)
504
504
  name_as_string = name.to_s
505
- @values.has_key?(name_as_string) || @attributes.has_key?(name_as_string)
505
+ @values.has_key?(name_as_string) || attributes.has_key?(name_as_string)
506
506
  end
507
507
 
508
508
  def self.preview_time=(t) # :nodoc:
@@ -522,11 +522,25 @@ module RailsConnector
522
522
  def update_data(values = {}, meta = {})
523
523
  @values = values || {}
524
524
  meta ||= {}
525
- @attributes = meta["attributes"] || {}
525
+ @rtc_ref = meta["rtc_ref"]
526
526
  @ext_ref = meta["ext_ref"]
527
527
  @attr_cache = {}
528
528
  end
529
529
 
530
+ def attributes
531
+ @attributes ||= @rtc_ref ? (
532
+ rtc = DictStorage.get(@rtc_ref)
533
+ if rtc['obj_classes'] && rtc['attributes'] && oc = rtc['obj_classes'][@values['_obj_class']]
534
+ rtc['attributes'].inject({}) do |attrs, (name, value)|
535
+ attrs[name] = value if oc['attributes'] && oc['attributes'].include?(name)
536
+ attrs
537
+ end
538
+ else
539
+ {}
540
+ end
541
+ ) : {}
542
+ end
543
+
530
544
  def read_attribute(name)
531
545
  name = name.to_s
532
546
  @attr_cache[name] ||= attribute_value_from_raw_attribute_value(name)
@@ -566,7 +580,7 @@ module RailsConnector
566
580
  when "title"
567
581
  :html
568
582
  else
569
- if attr_def = @attributes[key]
583
+ if attr_def = attributes[key]
570
584
  type = attr_def["type"]
571
585
  type.to_sym if type
572
586
  end
@@ -9,8 +9,6 @@ module RailsConnector
9
9
  property :base_revision_id
10
10
  property :title
11
11
  property :content_cache_id
12
- property :attributes
13
- property :obj_classes
14
12
 
15
13
  # Selects the revision with the given id as current revision
16
14
  def self.current=(revision)
@@ -62,6 +60,14 @@ module RailsConnector
62
60
  "<#{self.class} id=\"#{id}\" title=\"#{title}\">"
63
61
  end
64
62
 
63
+ def obj_classes
64
+ rtc['obj_classes']
65
+ end
66
+
67
+ def attributes
68
+ rtc['attributes']
69
+ end
70
+
65
71
  private
66
72
 
67
73
  COMPOUND_KEY_INDICES = [:ppath].freeze
@@ -130,13 +136,16 @@ module RailsConnector
130
136
  "values" => data["values"].merge(
131
137
  "_id" => data["obj_id"],
132
138
  "_obj_type" => data["obj_type"],
133
- "_obj_class" => data["obj_class"]["name"]
139
+ "_obj_class" => data["obj_class_name"]
134
140
  ),
135
- "attributes" => data["attributes"],
141
+ "rtc_ref" => data["rtc_ref"],
136
142
  "ext_ref" => data["ext_ref"],
137
143
  }
138
144
  end
139
145
 
146
+ def rtc
147
+ @rtc ||= DictStorage.get(read_attribute("rtc_ref"))
148
+ end
140
149
  end
141
150
 
142
151
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -23731721781
4
+ hash: -71426954407
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,10 +9,12 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 720
13
- - 44
14
- - fbabd
15
- version: 6.8.0.beta.200.720.44fbabd
12
+ - 744
13
+ - 99
14
+ - f
15
+ - 67
16
+ - fc
17
+ version: 6.8.0.beta.200.744.99f67fc
16
18
  platform: ruby
17
19
  authors:
18
20
  - Infopark AG
@@ -20,7 +22,7 @@ autorequire:
20
22
  bindir: bin
21
23
  cert_chain: []
22
24
 
23
- date: 2012-07-02 00:00:00 +02:00
25
+ date: 2012-07-05 00:00:00 +02:00
24
26
  default_executable:
25
27
  dependencies:
26
28
  - !ruby/object:Gem::Dependency
@@ -61,17 +63,19 @@ dependencies:
61
63
  requirements:
62
64
  - - "="
63
65
  - !ruby/object:Gem::Version
64
- hash: -23731721781
66
+ hash: -71426954407
65
67
  segments:
66
68
  - 6
67
69
  - 8
68
70
  - 0
69
71
  - beta
70
72
  - 200
71
- - 720
72
- - 44
73
- - fbabd
74
- version: 6.8.0.beta.200.720.44fbabd
73
+ - 744
74
+ - 99
75
+ - f
76
+ - 67
77
+ - fc
78
+ version: 6.8.0.beta.200.744.99f67fc
75
79
  version_requirements: *id003
76
80
  name: kvom
77
81
  prerelease: false