zendesk_api 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  This client **only** supports Zendesk's v2 API. Please see our [API documentation](http://developer.zendesk.com) for more information.
6
6
 
7
+ ## Additional Documentation
8
+
9
+ Additional documentation can be found on [rubydoc.info](http://rubydoc.info/gems/zendesk_api/frames)
10
+
7
11
  ## Important Notice
8
12
 
9
13
  Version 0.0.5 brings with it a change to the top-level namespace. All references to Zendesk should now use ZendeskAPI.
@@ -48,7 +48,7 @@ module ZendeskAPI
48
48
  @includes = Array(@options.delete(:include))
49
49
 
50
50
  # Used for Attachments, TicketComment
51
- if @resource_class.superclass == ZendeskAPI::Data
51
+ if @resource_class.is_a?(Class) && @resource_class.superclass == ZendeskAPI::Data
52
52
  @resources = []
53
53
  @fetchable = false
54
54
  end
@@ -84,6 +84,10 @@ module ZendeskAPI
84
84
  @association.generate_path(self, *args)
85
85
  end
86
86
 
87
+ def to_json(*args)
88
+ method_missing(:to_json, *args)
89
+ end
90
+
87
91
  def to_s
88
92
  "#{self.class.singular_resource_name}: #{attributes.inspect}"
89
93
  end
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -570,6 +570,17 @@ describe ZendeskAPI::Collection do
570
570
  end
571
571
  end
572
572
 
573
+ context "with a module (Search)" do
574
+ subject { ZendeskAPI::Collection.new(client, ZendeskAPI::Search, :query => "hello") }
575
+
576
+ before(:each) do
577
+ stub_json_request(:get, %r{search\?query=hello}, json(:results => []))
578
+ end
579
+
580
+ it "should not blow up" do
581
+ subject.to_a.should == []
582
+ end
583
+ end
573
584
 
574
585
  context "with different path" do
575
586
  subject do
@@ -328,6 +328,15 @@ describe ZendeskAPI::Resource do
328
328
  end
329
329
  end
330
330
 
331
+ context "#to_json" do
332
+ subject { ZendeskAPI::TestResource.new(client, :id => 1) }
333
+
334
+ it "should call #to_json on @attributes" do
335
+ subject.attributes.should_receive(:to_json)
336
+ subject.to_json
337
+ end
338
+ end
339
+
331
340
  context "#==" do
332
341
  it "is same when id is same" do
333
342
  ZendeskAPI::TestResource.new(client, :id => 1, "bar" => "baz").should == ZendeskAPI::TestResource.new(client, :id => 1, "foo" => "bar")
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.6
4
+ version: 0.1.7
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-11 00:00:00.000000000 Z
13
+ date: 2012-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec