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.
@@ -1,6 +1,12 @@
1
- require 'lib/zendesk-api'
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
@@ -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
- make_request("entries", :update => Zendesk::Main.to_xml('entrie', input))
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)
@@ -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
- # PUT seems badly broken, at least I can't get it to work without always
75
- # raising an exception about rewinding the data stream
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{zendesk-api-naoya}
5
- s.version = "0.3.6"
5
+ s.version = "0.3.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Peter Ericson"]
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Ericson