zendesk-api-naoya 0.3.6 → 0.3.7
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.
- data/lib/console.rb +7 -1
- data/lib/zendesk/entry.rb +3 -2
- data/lib/zendesk/main.rb +3 -5
- data/zendesk-api.gemspec +1 -1
- metadata +3 -3
data/lib/console.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'zendesk-api'
|
2
2
|
puts <<-TXT
|
3
3
|
Stuff here to explain what it does
|
4
4
|
TXT
|
5
5
|
|
6
6
|
include Zendesk
|
7
|
+
z = Zendesk::Main.new('clio1337811979', 'naoya@goclio.com', 'nmakin00', {:ssl => true, :api_version => '1'})
|
8
|
+
input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<entry>\n <body>htis is body from api</body>\n</entry>\n"
|
9
|
+
output = z.update_entrie(21472643, input, :authorization => "Basic bmFveWFAZ29jbGlvLmNvbTpubWFraW4wMA==")
|
10
|
+
puts output.headers
|
11
|
+
puts output.url
|
12
|
+
puts output.body
|
data/lib/zendesk/entry.rb
CHANGED
@@ -13,8 +13,9 @@ module Zendesk
|
|
13
13
|
make_request("entries", :create => Zendesk::Main.to_xml('entrie', input))
|
14
14
|
end
|
15
15
|
|
16
|
-
def update_entrie(input)
|
17
|
-
|
16
|
+
def update_entrie(id, input, options = {})
|
17
|
+
body = {:update => Zendesk::Main.to_xml('entrie', input)}
|
18
|
+
make_request("entries/#{id}", body, options)
|
18
19
|
end
|
19
20
|
|
20
21
|
def delete_entrie(id)
|
data/lib/zendesk/main.rb
CHANGED
@@ -60,6 +60,7 @@ module Zendesk
|
|
60
60
|
|
61
61
|
curl.headers={}
|
62
62
|
curl.headers.merge!({"X-On-Behalf-Of" => options[:on_behalf_of]}) if options[:on_behalf_of].present?
|
63
|
+
curl.headers.merge!({ "Authorization" => options[:authorization]}) if options[:authorization].present?
|
63
64
|
|
64
65
|
if body.empty? or body[:list]
|
65
66
|
curl.url = curl.url + params_list(body[:list]) if body[:list]
|
@@ -71,11 +72,8 @@ module Zendesk
|
|
71
72
|
curl.headers.merge!({"Content-Type" => "application/xml"})
|
72
73
|
curl.http_post(string_body(body))
|
73
74
|
elsif body[:update]
|
74
|
-
|
75
|
-
|
76
|
-
# curl.http_put(final_body)
|
77
|
-
curl.headers.merge!({ "Content-Type" => "application/xml", "X-Http-Method-Override" => "put" })
|
78
|
-
curl.http_post(string_body(body))
|
75
|
+
curl.headers.merge!({ "Content-Type" => "application/xml"})
|
76
|
+
curl.http_put(string_body(body))
|
79
77
|
elsif body[:destroy]
|
80
78
|
curl.http_delete
|
81
79
|
end
|
data/zendesk-api.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk-api-naoya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 7
|
10
|
+
version: 0.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Ericson
|