zendesk_api 1.1.0 → 1.1.1

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/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- zendesk_api (1.1.0)
10
+ zendesk_api (1.1.1)
11
11
  faraday (>= 0.8.0)
12
12
  faraday_middleware (>= 0.8.7)
13
13
  hashie (>= 1.2)
@@ -385,7 +385,7 @@ module ZendeskAPI
385
385
  end
386
386
 
387
387
  # Simplified Associations#wrap_resource
388
- def wrap_resource(res, with_association = @resource_class == Tag)
388
+ def wrap_resource(res, with_association = [Tag, Setting].include?(@resource_class))
389
389
  case res
390
390
  when Array
391
391
  wrap_resource(Hash[*res])
@@ -184,7 +184,7 @@ module ZendeskAPI
184
184
  has :actor, :class => User
185
185
  end
186
186
 
187
- class Setting < DataResource
187
+ class Setting < UpdateResource
188
188
  attr_reader :on
189
189
 
190
190
  def initialize(client, attributes = {})
@@ -196,6 +196,18 @@ module ZendeskAPI
196
196
 
197
197
  super
198
198
  end
199
+
200
+ def new_record?
201
+ false
202
+ end
203
+
204
+ def path(options = {})
205
+ super(options.merge(:with_parent => true))
206
+ end
207
+
208
+ def attributes_for_save
209
+ { self.class.resource_name => { @on => attributes.changes } }
210
+ end
199
211
  end
200
212
 
201
213
  class SatisfactionRating < ReadResource
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -2,4 +2,24 @@ require 'core/spec_helper'
2
2
 
3
3
  describe ZendeskAPI::Setting do
4
4
  it_should_be_readable :settings, :path => 'account/settings'
5
+
6
+ under (user = ZendeskAPI::User.new(client, :id => 'me')) do
7
+ it_should_be_readable user, :settings
8
+
9
+ describe 'updating', :vcr do
10
+ it 'should be updatable' do
11
+ settings = user.settings
12
+ lotus = settings.detect {|set| set.on == "lotus"}
13
+
14
+ original_setting = lotus.keyboard_shortcuts_enabled
15
+ lotus.keyboard_shortcuts_enabled = !original_setting
16
+
17
+ settings.save!
18
+ settings.fetch!(true)
19
+
20
+ lotus = settings.detect {|set| set.on == "lotus"}
21
+ lotus.keyboard_shortcuts_enabled.should == !original_setting
22
+ end
23
+ end
24
+ end
5
25
  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.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-23 00:00:00.000000000 Z
13
+ date: 2013-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bump