infopark_cloud_connector 6.8.0.16.def5e85 → 6.8.0.23.da7f96b

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,21 +24,23 @@ module RailsConnector
24
24
 
25
25
  # Accesses Cms Api Search using #query and fetches search hits.
26
26
  def fetch_hits
27
+ headers = {
28
+ :content_type => :json,
29
+ :accept => :json,
30
+ :params => {
31
+ :query => @query_string,
32
+ :offset => @options[:offset],
33
+ :limit => @options[:limit],
34
+ },
35
+ }
36
+ headers[:host] = @options[:http_host] if @options[:http_host].present?
27
37
  hits = JSON.parse(
28
38
  RestClient::Request.execute({
29
39
  :method => :get,
30
40
  :url => url,
31
41
  :user => @options[:login],
32
42
  :password => @options[:api_key],
33
- :headers => {
34
- :content_type => :json,
35
- :accept => :json,
36
- :params => {
37
- :query => @query_string,
38
- :offset => @options[:offset],
39
- :limit => @options[:limit],
40
- },
41
- },
43
+ :headers => headers,
42
44
  })
43
45
  )
44
46
 
@@ -510,7 +510,7 @@ module RailsConnector
510
510
  end
511
511
 
512
512
  def has_attribute?(name)
513
- data_from_cms.has_attribute?(name.to_s)
513
+ data_from_cms.has_custom_attribute?(name.to_s)
514
514
  end
515
515
 
516
516
  private
@@ -532,13 +532,13 @@ module RailsConnector
532
532
 
533
533
  def prepare_attribute_value(attribute_value, attribute_type)
534
534
  case attribute_type
535
- when :markdown
535
+ when "markdown"
536
536
  StringTagging.tag_as_markdown(attribute_value, self)
537
- when :html
537
+ when "html"
538
538
  StringTagging.tag_as_html(attribute_value, self)
539
- when :date
539
+ when "date"
540
540
  DateAttribute.parse(attribute_value) if attribute_value
541
- when :linklist
541
+ when "linklist"
542
542
  LinkList.new(attribute_value)
543
543
  else
544
544
  attribute_value
@@ -10,10 +10,38 @@ module RailsConnector
10
10
  raise "implement in subclass"
11
11
  end
12
12
 
13
- def has_attribute?(name)
13
+ def has_custom_attribute?(name)
14
14
  raise "implement in subclass"
15
15
  end
16
16
 
17
+ private
18
+
19
+ def type_of_internal(key)
20
+ case key
21
+ when "_text_links"
22
+ "linklist"
23
+ when "_valid_from"
24
+ "date"
25
+ when "_valid_until"
26
+ "date"
27
+ when "_last_changed"
28
+ "date"
29
+ when "title"
30
+ "html"
31
+ end
32
+ end
33
+
34
+ def default_attribute_value(attribute_type)
35
+ case attribute_type
36
+ when "linklist"
37
+ []
38
+ when "multienum"
39
+ []
40
+ else
41
+ nil
42
+ end
43
+ end
44
+
17
45
  end
18
46
 
19
47
  end
@@ -30,38 +30,43 @@ module RailsConnector
30
30
  [attribute_value, attribute_type]
31
31
  end
32
32
 
33
- def has_attribute?(name)
33
+ def has_custom_attribute?(name)
34
34
  obj_class_attributes.include?(name)
35
35
  end
36
36
 
37
37
  private
38
38
 
39
- attr_reader :values, :ext_ref, :rtc_ref, :revision
39
+ attr_reader :values, :rtc_ref, :revision
40
40
 
41
41
  def current_attribute_type(name)
42
- revision.attributes[name]["type"].to_sym
42
+ revision.attributes[name]["type"]
43
43
  end
44
44
 
45
45
  def obj_class_attributes
46
- name = values["_obj_class"]
47
- if data = revision.obj_classes[name]
48
- data["attributes"] || []
49
- else
50
- raise "Could not find ObjClass with name #{name} in Revision #{revision.id}!"
51
- end
46
+ @obj_class_attributes ||=
47
+ begin
48
+ name = values["_obj_class"]
49
+ if data = revision.obj_classes[name]
50
+ Set.new(data["attributes"]) || Set.new
51
+ else
52
+ raise "Could not find ObjClass with name #{name} in Revision #{revision.id}!"
53
+ end
54
+ end
52
55
  end
53
56
 
54
57
  def read_value(attribute_name)
55
58
  return values[attribute_name] if values.key?(attribute_name)
56
- if ext_ref && (attribute_name == "_text_links" || ?_ != attribute_name[0])
59
+ if @ext_ref && (attribute_name == "_text_links" || attribute_name[0] != ?_)
57
60
  extend_values_with_dict_storage_values
58
61
  end
59
62
  values[attribute_name]
60
63
  end
61
64
 
62
65
  def extend_values_with_dict_storage_values
66
+ return unless @ext_ref
67
+
63
68
  # may raise Kvom::Storage::NotFound
64
- ext_values = DictStorage.get(ext_ref)
69
+ ext_values = DictStorage.get(@ext_ref)
65
70
  values.reverse_merge!(ext_values)
66
71
  @ext_ref = nil
67
72
  end
@@ -72,36 +77,9 @@ module RailsConnector
72
77
  ?_ == attribute_name[0] || SPECIAL_INTERNAL_ATTRIBUTES.include?(attribute_name)
73
78
  end
74
79
 
75
- def type_of_internal(key)
76
- case key
77
- when "_text_links"
78
- :linklist
79
- when "_valid_from"
80
- :date
81
- when "_valid_until"
82
- :date
83
- when "_last_changed"
84
- :date
85
- when "title"
86
- :html
87
- end
88
- end
89
-
90
80
  def legacy_attribute_type(name)
91
81
  if attr_def = legacy_attributes[name]
92
- type = attr_def["type"]
93
- type.to_sym if type
94
- end
95
- end
96
-
97
- def default_attribute_value(attribute_type)
98
- case attribute_type
99
- when :linklist
100
- []
101
- when :multienum
102
- []
103
- else
104
- nil
82
+ attr_def["type"]
105
83
  end
106
84
  end
107
85
 
@@ -10,7 +10,7 @@ module RailsConnector
10
10
  [@hash[attribute_name], nil]
11
11
  end
12
12
 
13
- def has_attribute?(name)
13
+ def has_custom_attribute?(name)
14
14
  @hash.has_key?(name)
15
15
  end
16
16
 
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -308667469
4
+ hash: 363582215
5
5
  prerelease: 9
6
6
  segments:
7
7
  - 6
8
8
  - 8
9
9
  - 0
10
- - 16
11
- - def
12
- - 5
13
- - e
14
- - 85
15
- version: 6.8.0.16.def5e85
10
+ - 23
11
+ - da
12
+ - 7
13
+ - f
14
+ - 96
15
+ - b
16
+ version: 6.8.0.23.da7f96b
16
17
  platform: ruby
17
18
  authors:
18
19
  - Infopark AG
@@ -20,7 +21,7 @@ autorequire:
20
21
  bindir: bin
21
22
  cert_chain: []
22
23
 
23
- date: 2012-09-13 00:00:00 +02:00
24
+ date: 2012-09-18 00:00:00 +02:00
24
25
  default_executable:
25
26
  dependencies:
26
27
  - !ruby/object:Gem::Dependency
@@ -60,17 +61,18 @@ dependencies:
60
61
  requirements:
61
62
  - - "="
62
63
  - !ruby/object:Gem::Version
63
- hash: -308667469
64
+ hash: 363582215
64
65
  segments:
65
66
  - 6
66
67
  - 8
67
68
  - 0
68
- - 16
69
- - def
70
- - 5
71
- - e
72
- - 85
73
- version: 6.8.0.16.def5e85
69
+ - 23
70
+ - da
71
+ - 7
72
+ - f
73
+ - 96
74
+ - b
75
+ version: 6.8.0.23.da7f96b
74
76
  version_requirements: *id003
75
77
  name: kvom
76
78
  prerelease: false