zendesk_api 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9b5cc8be9234d6da4cd1b90cbdf4462bf7d1fa7
4
- data.tar.gz: ae424a078cd9a89561d9acc2be8e31b979611139
3
+ metadata.gz: 29e998ef5ac29f169434e9f790efadefacb2643f
4
+ data.tar.gz: 4c04948d4dbe97717235756b3d966f90de072b5a
5
5
  SHA512:
6
- metadata.gz: 9fc5f11d463221cb917757de68241566ea3ea972ccacb68a10d8e2ecd4f7a17101493af05de639f18cc04263fe02d292083bff7acbdfb60f21fb2c9712730083
7
- data.tar.gz: 40bbdf4e474b4662f395deaf59c04ccd854c74d609da8af4187be052c30d79ebc54c3a0671efb15d22a02eb1e0a6d656b866c71d1e8072fecff6d8fc2ea18881
6
+ metadata.gz: 1ff31fb5fc88df8a3eba6d624fc838a6e2a339184dbd66749cefe7a097a6e01877524a95215f75bb8d7cb5625c43719aaf247a2df61df23dc2bc99368b364824
7
+ data.tar.gz: 9a02b1a2563b332facca8b17a3a2469e3765a406c46ae1f5a39110b8a3cb206cd39417f5764903f48dd23626f4e0dcf81c64e06e25e2ee9cc5a8b10cb63363aa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zendesk_api (1.3.8)
4
+ zendesk_api (1.3.9)
5
5
  faraday (~> 0.9)
6
6
  hashie (>= 1.2)
7
7
  inflection
data/README.md CHANGED
@@ -15,6 +15,7 @@ Please check out the [wiki](https://github.com/zendesk/zendesk_api_client_rb/wik
15
15
  * Version 0.3.2 introduced a regression when side-loading roles on users. This was fixed in 0.3.4.
16
16
  * Version 1.0.0 changes the way errors are handled. Please see the [wiki page](https://github.com/zendesk/zendesk_api_client_rb/wiki/Errors) for more info.
17
17
  * Version 1.3.0 updates the Faraday dependency to 0.9. Since Faraday did not bump a major version we have not either, but there is no guarantee >= 1.3.0 works with Faraday < 0.9
18
+ * Version 1.3.8 had a bug where attachments were created, but the response was not handled properly
18
19
 
19
20
  ## Installation
20
21
 
@@ -1,5 +1,15 @@
1
1
  module ZendeskAPI
2
+ module ResponseHandler
3
+ def handle_response(response)
4
+ if response.body && response.body[self.class.singular_resource_name]
5
+ @attributes.replace(@attributes.deep_merge(response.body[self.class.singular_resource_name]))
6
+ end
7
+ end
8
+ end
9
+
2
10
  module Save
11
+ include ResponseHandler
12
+
3
13
  # If this resource hasn't been deleted, then create or save it.
4
14
  # Executes a POST if it is a {Data#new_record?}, otherwise a PUT.
5
15
  # Merges returned attributes on success.
@@ -75,6 +85,7 @@ module ZendeskAPI
75
85
  module Read
76
86
  def self.extended(klass)
77
87
  klass.send(:include, ZendeskAPI::Sideloading)
88
+ klass.send(:include, ResponseHandler)
78
89
  end
79
90
 
80
91
  # Finds a resource by an id and any options passed in.
@@ -143,12 +143,6 @@ module ZendeskAPI
143
143
  class DataResource < Data
144
144
  attr_accessor :error, :error_message
145
145
  extend Verbs
146
-
147
- def handle_response(response)
148
- if response.body && response.body[self.class.singular_resource_name]
149
- @attributes.replace(@attributes.deep_merge(response.body[self.class.singular_resource_name]))
150
- end
151
- end
152
146
  end
153
147
 
154
148
  # Represents a resource that can only GET
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.3.8"
2
+ VERSION = "1.3.9"
3
3
  end
@@ -78,6 +78,15 @@ def client
78
78
 
79
79
  client.config.logger.level = (ENV["LOG"] ? Logger::DEBUG : Logger::WARN)
80
80
  client.config.cache.size = 0
81
+ client.callbacks.clear
82
+
83
+ client.insert_callback do |env|
84
+ warning = env[:response_headers]["X-Zendesk-API-Warn"]
85
+
86
+ if warning && warning !~ /\["access_token"\]/ && client.config.logger
87
+ client.config.logger.warn "WARNING: #{warning}"
88
+ end
89
+ end
81
90
 
82
91
  client
83
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Davidovitz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-17 00:00:00.000000000 Z
12
+ date: 2014-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bump