zci 0.9.0 → 0.10.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/lib/zci/export.rb +3 -11
- data/lib/zci/helpers.rb +1 -1
- data/lib/zci/import.rb +6 -14
- data/lib/zci/version.rb +1 -1
- data/zci.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74d10c78dae275240dac15dcbdf4f4bb21f7a3df8da95aece0879daed0d70f1a
|
4
|
+
data.tar.gz: 4dbb97dfebf3039dfdceaa0989029114f3dce7831593209235e404c08578004b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b9d954ce145e4dfb1f0ead2677cdb6f281c6c8acf53f53a14a8ebb9cf9243545842e4502accb8d7249f2c02b57da0f069e959cbd8d0268f272081ca04fbed35
|
7
|
+
data.tar.gz: 6380d9d389e21a13600f4a3c973ed1f6289377fededd190b506ccc5c32092931179a419426e349ee6ff5b2e5b94c052734376903fff2d43298c846a672039e3d
|
data/lib/zci/export.rb
CHANGED
@@ -1,47 +1,39 @@
|
|
1
1
|
module ZCI
|
2
|
-
|
3
2
|
def parse_category_xml(xml_file)
|
4
3
|
doc = Nokogiri::XML.parse(xml_file)
|
5
4
|
category_xml = doc.xpath("//category").first
|
6
5
|
|
7
|
-
|
6
|
+
{
|
8
7
|
id: category_xml[:id],
|
9
8
|
name: category_xml.xpath('name').text,
|
10
9
|
description: category_xml.xpath('description').text,
|
11
10
|
position: category_xml[:position],
|
12
11
|
}
|
13
|
-
|
14
|
-
return category
|
15
12
|
end
|
16
13
|
|
17
14
|
def parse_section_xml(xml_file)
|
18
15
|
doc = Nokogiri::XML.parse(xml_file)
|
19
16
|
section_xml = doc.xpath("//section").first
|
20
17
|
|
21
|
-
|
18
|
+
{
|
22
19
|
id: section_xml[:id],
|
23
20
|
category_id: section_xml[:category_id],
|
24
21
|
name: section_xml.xpath('name').text,
|
25
22
|
description: section_xml.xpath('description').text,
|
26
23
|
position: section_xml[:position],
|
27
24
|
}
|
28
|
-
|
29
|
-
return section
|
30
25
|
end
|
31
26
|
|
32
27
|
def parse_article_xml(xml_file)
|
33
28
|
doc = Nokogiri::XML.parse(xml_file)
|
34
29
|
article_xml = doc.xpath('//article').first
|
35
30
|
|
36
|
-
|
31
|
+
{
|
37
32
|
id: article_xml[:id],
|
38
33
|
section_id: article_xml[:section_id],
|
39
34
|
title: article_xml.xpath('title').text,
|
40
35
|
body: article_xml.xpath('body').text,
|
41
36
|
position: article_xml[:position],
|
42
37
|
}
|
43
|
-
|
44
|
-
return article
|
45
38
|
end
|
46
|
-
|
47
39
|
end
|
data/lib/zci/helpers.rb
CHANGED
data/lib/zci/import.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module ZCI
|
2
|
-
|
3
2
|
def build_category_xml(category)
|
4
|
-
|
3
|
+
Nokogiri::XML::Builder.new do |xml|
|
5
4
|
xml.root {
|
6
5
|
xml.category(id: category.id, position: category.position, identifier: 'category', type: 'document') {
|
7
6
|
xml.name {
|
@@ -13,12 +12,10 @@ module ZCI
|
|
13
12
|
}
|
14
13
|
}
|
15
14
|
end
|
16
|
-
|
17
|
-
return category_xml
|
18
15
|
end
|
19
16
|
|
20
17
|
def build_category_hash(category)
|
21
|
-
|
18
|
+
{
|
22
19
|
id: category.id,
|
23
20
|
position: category.position,
|
24
21
|
name: category.name,
|
@@ -27,7 +24,7 @@ module ZCI
|
|
27
24
|
end
|
28
25
|
|
29
26
|
def build_section_xml(section)
|
30
|
-
|
27
|
+
Nokogiri::XML::Builder.new do |xml|
|
31
28
|
xml.root {
|
32
29
|
# id - id of the original section
|
33
30
|
# category_id - id of the original category
|
@@ -41,12 +38,10 @@ module ZCI
|
|
41
38
|
}
|
42
39
|
}
|
43
40
|
end
|
44
|
-
|
45
|
-
return section_xml
|
46
41
|
end
|
47
42
|
|
48
43
|
def build_section_hash(section)
|
49
|
-
|
44
|
+
{
|
50
45
|
id: section.id,
|
51
46
|
category_id: section.category_id,
|
52
47
|
position: section.position,
|
@@ -60,7 +55,7 @@ module ZCI
|
|
60
55
|
article.title.to_s.gsub!(/[\u0001-\u001A]/ , '')
|
61
56
|
article.body.to_s.gsub!(/[\u0001-\u001A]/ , '')
|
62
57
|
|
63
|
-
|
58
|
+
Nokogiri::XML::Builder.new do |xml|
|
64
59
|
xml.root {
|
65
60
|
# id - id of the original acticle
|
66
61
|
# section_id - id of the original section
|
@@ -74,12 +69,10 @@ module ZCI
|
|
74
69
|
}
|
75
70
|
}
|
76
71
|
end
|
77
|
-
|
78
|
-
return article_xml
|
79
72
|
end
|
80
73
|
|
81
74
|
def build_article_hash(article)
|
82
|
-
|
75
|
+
{
|
83
76
|
id: article.id,
|
84
77
|
section_id: article.section_id,
|
85
78
|
position: article.position,
|
@@ -87,5 +80,4 @@ module ZCI
|
|
87
80
|
body: article.body,
|
88
81
|
}
|
89
82
|
end
|
90
|
-
|
91
83
|
end
|
data/lib/zci/version.rb
CHANGED
data/zci.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_runtime_dependency 'nokogiri', '~> 1.10'
|
17
17
|
s.add_runtime_dependency 'rubyzip', '~> 1.2'
|
18
18
|
s.add_runtime_dependency 'crowdin-api', '~> 0.5'
|
19
|
-
s.add_runtime_dependency 'zendesk_help_center_api', '~> 0.
|
19
|
+
s.add_runtime_dependency 'zendesk_help_center_api', '~> 0.8.0'
|
20
20
|
s.add_runtime_dependency 'gli', '~> 2.18'
|
21
21
|
s.add_development_dependency 'rake', '~> 12.3'
|
22
22
|
s.add_development_dependency 'rdoc', '~> 6.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Maminov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.8.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.8.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gli
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|