zendesk_api 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "simplecov", :platforms => :ruby_19, :group => :development
4
4
  gem "jruby-openssl", :platforms => :jruby
5
- gem "hashie", :git => "https://github.com/steved555/hashie.git"
5
+ gem "hashie", :git => "git://github.com/intridea/hashie.git"
6
6
 
7
7
  gemspec
@@ -1,13 +1,13 @@
1
1
  GIT
2
- remote: https://github.com/steved555/hashie.git
3
- revision: 2fa400b58956f3ae4c4eaaaa196084ffc659072f
2
+ remote: git://github.com/intridea/hashie.git
3
+ revision: f7adbf6b6e29bfcd3efbc33695fe0e018d62e66e
4
4
  specs:
5
5
  hashie (2.0.0.beta)
6
6
 
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- zendesk_api (0.1.8)
10
+ zendesk_api (0.1.9)
11
11
  faraday (>= 0.8.0)
12
12
  faraday_middleware (>= 0.8.7)
13
13
  hashie
@@ -67,16 +67,16 @@ module ZendeskAPI
67
67
  # Either grab association from child_id field on resource or parent_id on child resource
68
68
  if resource.key?(key)
69
69
  id = resource.send(key)
70
- key = options.include_key
70
+ include_key = options.include_key
71
71
  else
72
72
  id = resource.id
73
- key = "#{resource.class.singular_resource_name}_id"
73
+ include_key = "#{resource.class.singular_resource_name}_id"
74
74
  end
75
75
 
76
76
  next unless id
77
77
 
78
78
  side_load = side_loads.detect do |side_load|
79
- id == side_load[key]
79
+ id == side_load[include_key]
80
80
  end
81
81
 
82
82
  resource.send("#{options.name}=", side_load) if side_load
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -429,6 +429,45 @@ describe ZendeskAPI::Collection do
429
429
  end
430
430
  end
431
431
 
432
+
433
+ context "multiple resources" do
434
+ before(:each) do
435
+ ZendeskAPI::TestResource.has ZendeskAPI::NilResource
436
+
437
+ stub_json_request(:get, %r{test_resources\?include=nil_resources}, json(
438
+ :test_resources => [{ :id => 1, :nil_resource_id => 4 }, { :id => 2, :nil_resource_id => 1 }],
439
+ :nil_resources => [{ :id => 1, :name => :bye }, { :id => 4, :name => :hi }]
440
+ ))
441
+
442
+ subject.fetch(true)
443
+
444
+ end
445
+
446
+ context "first resource" do
447
+ before(:each) { @resource = subject.detect {|res| res.id == 1} }
448
+
449
+ it "should side load nil_resources" do
450
+ @resource.nil_resource.should_not be_nil
451
+ end
452
+
453
+ it "should side load the correct nil_resource" do
454
+ @resource.nil_resource.name.should == "hi"
455
+ end
456
+ end
457
+
458
+ context "second resource" do
459
+ before(:each) { @resource = subject.detect {|res| res.id == 2} }
460
+
461
+ it "should side load nil_resources" do
462
+ @resource.nil_resource.should_not be_nil
463
+ end
464
+
465
+ it "should side load the correct nil_resource" do
466
+ @resource.nil_resource.name.should == "bye"
467
+ end
468
+ end
469
+ end
470
+
432
471
  context "plural ids on resource" do
433
472
  before(:each) do
434
473
  ZendeskAPI::TestResource.has_many ZendeskAPI::NilResource
@@ -112,7 +112,7 @@ end
112
112
 
113
113
  VCR.configure do |c|
114
114
  c.cassette_library_dir = File.join(File.dirname(__FILE__), "fixtures", "cassettes")
115
- c.default_cassette_options = { :record => :new_episodes, :decode_compressed_response => true }
115
+ c.default_cassette_options = { :record => :new_episodes, :decode_compressed_response => true, :serialize_with => :json, :preserve_exact_body_bytes => true }
116
116
  c.hook_into :webmock
117
117
  end
118
118
 
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: 0.1.8
4
+ version: 0.1.9
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: 2012-10-26 00:00:00.000000000 Z
13
+ date: 2012-10-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bump