zenpush 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/README.markdown +9 -6
- data/lib/zenpush/runner.rb +1 -1
- data/lib/zenpush/version.rb +1 -1
- data/lib/zenpush/zendesk.rb +24 -9
- data/lib/zenpush.rb +10 -3
- metadata +61 -31
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zenpush (0.1.
|
4
|
+
zenpush (0.1.1)
|
5
5
|
awesome_print (~> 1.0.0)
|
6
6
|
boson (~> 1.0)
|
7
7
|
httparty (~> 0.8.0)
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
multi_xml
|
19
19
|
json_pure (1.5.4)
|
20
20
|
spruz (~> 0.2.8)
|
21
|
-
multi_json (1.
|
21
|
+
multi_json (1.4.0)
|
22
22
|
multi_xml (0.4.1)
|
23
23
|
rake (0.9.2.2)
|
24
24
|
redcarpet (2.1.0)
|
data/README.markdown
CHANGED
@@ -21,15 +21,19 @@ Try:
|
|
21
21
|
|
22
22
|
## Configuration
|
23
23
|
|
24
|
-
Create a
|
24
|
+
Create a `.zenpush.yml` file in your home directory. Here is an example:
|
25
25
|
|
26
26
|
---
|
27
|
-
uri: https://myproduct.zendesk.com
|
28
|
-
user: email@address.com/token
|
29
|
-
password: LoDsQlEtBXSd8clW87DgWi0VNFod3U9xQggzwJEH
|
27
|
+
:uri: https://myproduct.zendesk.com
|
28
|
+
:user: email@address.com/token
|
29
|
+
:password: LoDsQlEtBXSd8clW87DgWi0VNFod3U9xQggzwJEH
|
30
30
|
|
31
31
|
You can find your API token at https://myproduct.zendesk.com/settings/api.
|
32
32
|
|
33
|
+
Additional configuration (optional):
|
34
|
+
|
35
|
+
:filenames_use_dashes_instead_of_spaces: false
|
36
|
+
|
33
37
|
## Usage
|
34
38
|
|
35
39
|
### Listing categories
|
@@ -43,7 +47,6 @@ You can find your API token at https://myproduct.zendesk.com/settings/api.
|
|
43
47
|
### Listing entries in a forum
|
44
48
|
|
45
49
|
$ zp entries -f <forum_id>
|
46
|
-
$ zp entries -F <forum_name>
|
47
50
|
|
48
51
|
### Creating/updating an entry
|
49
52
|
|
@@ -70,4 +73,4 @@ The gem will automatically discover the category and forum name of a given entry
|
|
70
73
|
|
71
74
|
## Contributors
|
72
75
|
|
73
|
-
* @nfo
|
76
|
+
* @nfo
|
data/lib/zenpush/runner.rb
CHANGED
data/lib/zenpush/version.rb
CHANGED
data/lib/zenpush/zendesk.rb
CHANGED
@@ -7,19 +7,34 @@ module ZenPush
|
|
7
7
|
class Zendesk
|
8
8
|
include HTTParty
|
9
9
|
|
10
|
+
attr_accessor :options
|
11
|
+
|
10
12
|
headers 'Content-Type' => 'application/json'
|
11
13
|
# debug_output
|
12
14
|
|
13
|
-
def initialize(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def initialize(options = {})
|
16
|
+
|
17
|
+
default_options = {
|
18
|
+
:uri => nil,
|
19
|
+
:user => nil,
|
20
|
+
:password => nil,
|
21
|
+
:filenames_use_dashes_instead_of_spaces => false,
|
22
|
+
}
|
23
|
+
|
24
|
+
zenpush_yml = File.join(ENV['HOME'], '.zenpush.yml')
|
25
|
+
|
26
|
+
if File.readable?(zenpush_yml)
|
27
|
+
zenpush_yml_opts = YAML.load_file(zenpush_yml)
|
28
|
+
default_options.merge!(zenpush_yml_opts)
|
19
29
|
end
|
20
30
|
|
21
|
-
|
22
|
-
|
31
|
+
opts = default_options.merge!(options)
|
32
|
+
opts.each_pair { |k,v| raise "#{k} is nil" if v.nil? }
|
33
|
+
|
34
|
+
@options = opts
|
35
|
+
|
36
|
+
self.class.base_uri opts[:uri] + '/api/v1'
|
37
|
+
self.class.basic_auth opts[:user], opts[:password]
|
23
38
|
end
|
24
39
|
|
25
40
|
def get(uri, options = {})
|
@@ -108,4 +123,4 @@ module ZenPush
|
|
108
123
|
end
|
109
124
|
|
110
125
|
end
|
111
|
-
end
|
126
|
+
end
|
data/lib/zenpush.rb
CHANGED
@@ -11,13 +11,20 @@ module ZenPush
|
|
11
11
|
@z ||= ZenPush::Zendesk.new
|
12
12
|
end
|
13
13
|
|
14
|
-
#
|
15
14
|
def file_to_category_forum_entry(file)
|
16
15
|
absolute_path = File.realpath(file)
|
16
|
+
file_extension = File.extname(file)
|
17
|
+
|
17
18
|
parts = absolute_path.split('/')
|
18
|
-
|
19
|
+
|
20
|
+
if ZenPush.z.options[:filenames_use_dashes_instead_of_spaces]
|
21
|
+
parts.each { |el| el.gsub!(/-/, ' ') }
|
22
|
+
end
|
23
|
+
|
24
|
+
entry_name = File.basename(parts[-1], file_extension)
|
19
25
|
forum_name = parts[-2]
|
20
26
|
category_name = parts[-3]
|
27
|
+
|
21
28
|
return category_name, forum_name, entry_name
|
22
29
|
end
|
23
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,82 +1,112 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zenpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
5
4
|
prerelease:
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nicolas Fouché
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
16
|
-
|
15
|
+
type: :runtime
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '1.0'
|
22
|
-
|
22
|
+
name: boson
|
23
23
|
prerelease: false
|
24
|
-
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
|
-
|
27
|
-
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
37
|
version: 0.8.0
|
33
|
-
|
38
|
+
name: httparty
|
34
39
|
prerelease: false
|
35
|
-
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
|
-
|
38
|
-
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 2.1.0
|
44
|
-
|
54
|
+
name: redcarpet
|
45
55
|
prerelease: false
|
46
|
-
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.1.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
|
-
|
49
|
-
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: 1.0.0
|
55
|
-
|
70
|
+
name: awesome_print
|
56
71
|
prerelease: false
|
57
|
-
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.0.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
|
-
|
60
|
-
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: 1.5.1
|
66
|
-
|
86
|
+
name: json_pure
|
67
87
|
prerelease: false
|
68
|
-
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.5.1
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
71
|
-
|
95
|
+
type: :development
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
75
100
|
- !ruby/object:Gem::Version
|
76
101
|
version: '0'
|
77
|
-
|
102
|
+
name: rake
|
78
103
|
prerelease: false
|
79
|
-
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
description: Push your markdown files to your Zendesk knowledge base
|
81
111
|
email:
|
82
112
|
- nicolas.fouche@cleverscale.com
|
@@ -113,22 +143,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
143
|
requirements:
|
114
144
|
- - ! '>='
|
115
145
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
146
|
segments:
|
118
147
|
- 0
|
119
|
-
hash:
|
148
|
+
hash: 1242870539657681757
|
149
|
+
version: '0'
|
120
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
151
|
none: false
|
122
152
|
requirements:
|
123
153
|
- - ! '>='
|
124
154
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
155
|
segments:
|
127
156
|
- 0
|
128
|
-
hash:
|
157
|
+
hash: 1242870539657681757
|
158
|
+
version: '0'
|
129
159
|
requirements: []
|
130
160
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.23
|
132
162
|
signing_key:
|
133
163
|
specification_version: 3
|
134
164
|
summary: Push your markdown files to your Zendesk knowledge base
|