ticketevolution-ruby 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -62,6 +62,10 @@ Each set of API credentials can be combined with a mode and api version to creat
62
62
  # is valid. EX: Logger.new('log/te_api.log')
63
63
  })
64
64
 
65
+ Behind the scenes we use [Faraday](https://github.com/technoweenie/faraday) with the [:net_http](https://github.com/technoweenie/faraday/blob/master/lib/faraday/adapter/net_http.rb) adapter to process connections. You can change this [adapter](https://github.com/technoweenie/faraday/tree/master/lib/faraday/adapter) by setting it on the connection class _before_ you instantiate your connection object.
66
+
67
+ TicketEvolution::Connection.adapter = :typhoeus
68
+
65
69
  **Endpoint objects**
66
70
 
67
71
  These are always (except in the case of Search) pluralized class names and match the endpoints listed at [http://developer.ticketevolution.com](http://developer.ticketevolution.com/). To instantiate an endpoint instance, create a connection object and then call the endpoints name, underscored, as a method on the connection object.
@@ -256,7 +260,7 @@ Click on the links next to each endpoint for more detail.
256
260
  @venue = @connection.venues.show(id)
257
261
 
258
262
 
259
- ######ticketevolution-ruby v0.7.0
263
+ ######ticketevolution-ruby v0.7.1
260
264
 
261
265
  License
262
266
  -------
@@ -20,6 +20,10 @@ Each set of API credentials can be combined with a mode and api version to creat
20
20
  # is valid. EX: Logger.new('log/te_api.log')
21
21
  })
22
22
 
23
+ Behind the scenes we use [Faraday](https://github.com/technoweenie/faraday) with the [:net_http](https://github.com/technoweenie/faraday/blob/master/lib/faraday/adapter/net_http.rb) adapter to process connections. You can change this [adapter](https://github.com/technoweenie/faraday/tree/master/lib/faraday/adapter) by setting it on the connection class _before_ you instantiate your connection object.
24
+
25
+ TicketEvolution::Connection.adapter = :typhoeus
26
+
23
27
  **Endpoint objects**
24
28
 
25
29
  These are always (except in the case of Search) pluralized class names and match the endpoints listed at [http://developer.ticketevolution.com](http://developer.ticketevolution.com/). To instantiate an endpoint instance, create a connection object and then call the endpoints name, underscored, as a method on the connection object.
@@ -4,7 +4,8 @@ module TicketEvolution
4
4
 
5
5
  include Enumerable
6
6
 
7
- delegate :all, :each, :last, :size, :[], :to => :entries
7
+ delegate :each, :last, :size, :[], :to => :entries
8
+ alias :all :entries
8
9
 
9
10
  def initialize(options = {})
10
11
  options.each {|k,v| send("#{k}=", v)}
@@ -1,7 +1,7 @@
1
1
  module TicketEvolution
2
2
  class Connection < Base
3
- cattr_reader :default_options, :expected_options, :oldest_version_in_service, :adapter
4
- cattr_accessor :protocol, :url_base
3
+ cattr_reader :default_options, :expected_options, :oldest_version_in_service
4
+ cattr_accessor :protocol, :url_base, :adapter
5
5
 
6
6
  @@oldest_version_in_service = 8
7
7
 
@@ -16,7 +16,7 @@ module TicketEvolution
16
16
  end
17
17
 
18
18
  def plural_class
19
- self.plural_class_name.constantize
19
+ self.plural_class_name.constantize rescue nil
20
20
  end
21
21
 
22
22
  def attributes
@@ -78,10 +78,9 @@ module TicketEvolution
78
78
  end
79
79
 
80
80
  def method_missing(method, *args)
81
- seek = method.to_s.camelize
82
- if seek !~ /=/ and plural_class.const_defined?(seek.to_sym)
83
- "#{plural_class_name}::#{seek}".constantize.new(:parent => plural_class.new(:parent => @connection, :id => self.id))
84
- else
81
+ begin
82
+ "#{plural_class_name}::#{method.to_s.camelize}".constantize.new(:parent => plural_class.new(:parent => @connection, :id => self.id))
83
+ rescue
85
84
  super
86
85
  end
87
86
  end
@@ -1,3 +1,3 @@
1
1
  module TicketEvolution
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -17,4 +17,10 @@ describe TicketEvolution::ApiError do
17
17
  end
18
18
 
19
19
  it { should be_frozen }
20
+
21
+ it "should not raise if a missing method is called" do
22
+ expect {
23
+ subject.not_a_method
24
+ }.to_not raise_error
25
+ end
20
26
  end
@@ -30,10 +30,8 @@ describe TicketEvolution::Collection do
30
30
  end
31
31
 
32
32
  describe "#all" do
33
- it "should pass the request to the @entries array" do
34
- subject.entries.should_receive(:all)
35
-
36
- subject.all
33
+ it "should alias entries" do
34
+ subject.all.should == subject.entries
37
35
  end
38
36
  end
39
37
 
@@ -47,6 +47,10 @@ describe TicketEvolution::Connection do
47
47
  it "should be an available Faraday adapter" do
48
48
  Faraday::Adapter.constants.collect{|a| a.to_s.underscore.to_sym}.should include subject
49
49
  end
50
+
51
+ it "should be settable at a class level" do
52
+ klass.should respond_to :adapter=
53
+ end
50
54
  end
51
55
 
52
56
  describe "#initialize" do
@@ -137,16 +137,9 @@ describe TicketEvolution::Model do
137
137
  end
138
138
 
139
139
  describe "#method_missing" do
140
- context "when the method ends in 's'" do
141
- it "should attempt to find a class which matches the missing method, scoped to it's plural namespace" do
142
- instance.plural_class.should_receive(:const_defined?).with(:NoObjects)
143
- instance.no_objects
144
- end
145
- end
146
-
147
- context "when the method does not end in 's'" do
140
+ context "when the missing class is not found" do
148
141
  it "should fall back on the default functionality" do
149
- expect { instance.no_object=('') }.to_not raise_error
142
+ expect { instance.no_objects }.to_not raise_error
150
143
  end
151
144
  end
152
145
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Ticket Evolution']
9
9
  s.email = ['dev@ticketevolution.com']
10
- s.homepage = 'https://github.com/ticket_evolution/ticketevolution-ruby'
10
+ s.homepage = 'https://github.com/ticketevolution/ticketevolution-ruby'
11
11
  s.summary = 'Integration gem for Ticket Evolution\'s API'
12
12
  s.description = 'Provides Ruby wrappers for the Ticket Evolution API (http://developer.ticketevolution.com). Ticket Evolution is the industry leader in software for the Ticket Broker industry.'
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketevolution-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000Z
12
+ date: 2012-02-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70237160533160 !ruby/object:Gem::Requirement
16
+ requirement: &70181057522720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70237160533160
24
+ version_requirements: *70181057522720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &70237160532300 !ruby/object:Gem::Requirement
27
+ requirement: &70181057521780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70237160532300
35
+ version_requirements: *70181057521780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yajl-ruby
38
- requirement: &70237160531400 !ruby/object:Gem::Requirement
38
+ requirement: &70181057540900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.7.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70237160531400
46
+ version_requirements: *70181057540900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &70237160554020 !ruby/object:Gem::Requirement
49
+ requirement: &70181057545340 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.0.4
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70237160554020
57
+ version_requirements: *70181057545340
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &70237160558360 !ruby/object:Gem::Requirement
60
+ requirement: &70181057549480 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.4.3
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70237160558360
68
+ version_requirements: *70181057549480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70237160562360 !ruby/object:Gem::Requirement
71
+ requirement: &70181057553060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.7.1
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70237160562360
79
+ version_requirements: *70181057553060
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: vcr
82
- requirement: &70237160565180 !ruby/object:Gem::Requirement
82
+ requirement: &70181057556000 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70237160565180
90
+ version_requirements: *70181057556000
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: webmock
93
- requirement: &70237164781380 !ruby/object:Gem::Requirement
93
+ requirement: &70181061812160 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: 1.8.0
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *70237164781380
104
+ version_requirements: *70181061812160
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: awesome_print
107
- requirement: &70237165260260 !ruby/object:Gem::Requirement
107
+ requirement: &70181062357560 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ! '>='
@@ -112,10 +112,10 @@ dependencies:
112
112
  version: '0'
113
113
  type: :development
114
114
  prerelease: false
115
- version_requirements: *70237165260260
115
+ version_requirements: *70181062357560
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rake
118
- requirement: &70237165715720 !ruby/object:Gem::Requirement
118
+ requirement: &70181062709940 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ! '>='
@@ -123,7 +123,7 @@ dependencies:
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
- version_requirements: *70237165715720
126
+ version_requirements: *70181062709940
127
127
  description: Provides Ruby wrappers for the Ticket Evolution API (http://developer.ticketevolution.com).
128
128
  Ticket Evolution is the industry leader in software for the Ticket Broker industry.
129
129
  email:
@@ -288,7 +288,7 @@ files:
288
288
  - spec/support/connection.rb
289
289
  - spec/support/vcr.rb
290
290
  - ticketevolution-ruby.gemspec
291
- homepage: https://github.com/ticket_evolution/ticketevolution-ruby
291
+ homepage: https://github.com/ticketevolution/ticketevolution-ruby
292
292
  licenses: []
293
293
  post_install_message:
294
294
  rdoc_options: []
@@ -302,7 +302,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
302
302
  version: '0'
303
303
  segments:
304
304
  - 0
305
- hash: -1170424389658558163
305
+ hash: 3800414316783008053
306
306
  required_rubygems_version: !ruby/object:Gem::Requirement
307
307
  none: false
308
308
  requirements: