ticketevolution-ruby 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ The gem follows an instance based approach to the Restful API. This way multiple
6
6
 
7
7
  All API documentation can be found at [http://developer.ticketevolution.com](http://developer.ticketevolution.com/).
8
8
 
9
- _WARNING: This gem is not ready for prime time. The transactions endpoint has not been added and a few implementation details have yet to be worked out. Known issues and missing functionality are documented in the [Github Issues](https://github.com/ticketevolution/ticketevolution-ruby/issues)._
9
+ _NOTE: Known issues and missing functionality are documented in the [Github Issues](https://github.com/ticketevolution/ticketevolution-ruby/issues)._
10
10
 
11
11
  **Rubies supported**
12
12
 
@@ -260,7 +260,7 @@ Click on the links next to each endpoint for more detail.
260
260
  @venue = @connection.venues.show(id)
261
261
 
262
262
 
263
- ######ticketevolution-ruby v0.7.2
263
+ ######ticketevolution-ruby v0.7.3
264
264
 
265
265
  License
266
266
  -------
@@ -6,7 +6,7 @@ The gem follows an instance based approach to the Restful API. This way multiple
6
6
 
7
7
  All API documentation can be found at [http://developer.ticketevolution.com](http://developer.ticketevolution.com/).
8
8
 
9
- _WARNING: This gem is not ready for prime time. The transactions endpoint has not been added and a few implementation details have yet to be worked out. Known issues and missing functionality are documented in the [Github Issues](https://github.com/ticketevolution/ticketevolution-ruby/issues)._
9
+ _NOTE: Known issues and missing functionality are documented in the [Github Issues](https://github.com/ticketevolution/ticketevolution-ruby/issues)._
10
10
 
11
11
  **Rubies supported**
12
12
 
@@ -11,5 +11,11 @@ module Faraday
11
11
  faradays_build_nested_query(value, prefix)
12
12
  end
13
13
  end
14
+
15
+ class ParamsHash
16
+ def to_query
17
+ Utils.build_nested_query(self)
18
+ end
19
+ end
14
20
  end
15
21
  end
@@ -1,9 +1,10 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module Create
4
- def create(params = nil)
4
+ def create(params = nil, &handler)
5
+ handler ||= method(:build_for_create)
5
6
  params = { endpoint_name.to_sym => [params] } if params.present?
6
- request(:POST, nil, params, &method(:build_for_create))
7
+ request(:POST, nil, params, &handler)
7
8
  end
8
9
 
9
10
  def build_for_create(response)
@@ -1,8 +1,9 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module Deleted
4
- def deleted(params = nil)
5
- request(:GET, '/deleted', params, &method(:build_for_deleted))
4
+ def deleted(params = nil, &handler)
5
+ handler ||= method(:build_for_deleted)
6
+ request(:GET, '/deleted', params, &handler)
6
7
  end
7
8
 
8
9
  def build_for_deleted(response)
@@ -1,8 +1,9 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module List
4
- def list(params = nil)
5
- request(:GET, nil, params, &method(:build_for_list))
4
+ def list(params = nil, &handler)
5
+ handler ||= method(:build_for_list)
6
+ request(:GET, nil, params, &handler)
6
7
  end
7
8
 
8
9
  alias :all :list
@@ -1,8 +1,9 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module Search
4
- def search(params = nil)
5
- request(:GET, '/search', params, &method(:build_for_search))
4
+ def search(params = nil, &handler)
5
+ handler ||= method(:build_for_search)
6
+ request(:GET, '/search', params, &handler)
6
7
  end
7
8
 
8
9
  def build_for_search(response)
@@ -1,8 +1,9 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module Show
4
- def show(id)
5
- request(:GET, "/#{id}", &method(:build_for_show))
4
+ def show(id, &handler)
5
+ handler ||= method(:build_for_show)
6
+ request(:GET, "/#{id}", &handler)
6
7
  end
7
8
 
8
9
  alias :find :show
@@ -21,9 +21,10 @@ module TicketEvolution
21
21
  })
22
22
  end
23
23
 
24
- def update(params = nil)
24
+ def update(params = nil, &handler)
25
25
  ensure_id
26
- request(:PUT, nil, params, &method(:build_for_update))
26
+ handler ||= method(:build_for_update)
27
+ request(:PUT, nil, params, &handler)
27
28
  end
28
29
 
29
30
  def build_for_update(response)
@@ -1,3 +1,3 @@
1
1
  module TicketEvolution
2
- VERSION = '0.7.2'
2
+ VERSION = '0.7.3'
3
3
  end
@@ -15,6 +15,10 @@ class Fake
15
15
  "called fake handler"
16
16
  end
17
17
 
18
+ def self.response_alt
19
+ proc {|response| "A response was handled"}
20
+ end
21
+
18
22
  def self.response
19
23
  OpenStruct.new.tap do |resp|
20
24
  resp.header = 'fake header string (we don\'t currently process this)'
@@ -23,6 +23,17 @@ shared_examples_for "a create endpoint" do
23
23
  instance.create
24
24
  end
25
25
  end
26
+
27
+ context "when passed a block" do
28
+ let(:block) { Fake.response_alt }
29
+ let(:response) { Fake.create_response }
30
+
31
+ it "should process the response through the block" do
32
+ instance.should_receive(:naturalize_response).and_return(response)
33
+
34
+ instance.create({}, &block).should == block.call(response)
35
+ end
36
+ end
26
37
  end
27
38
 
28
39
  describe "#build_for_create" do
@@ -22,6 +22,17 @@ shared_examples_for "a deleted endpoint" do
22
22
  instance.deleted
23
23
  end
24
24
  end
25
+
26
+ context "when passed a block" do
27
+ let(:block) { Fake.response_alt }
28
+ let(:response) { Fake.list_response }
29
+
30
+ it "should process the response through the block" do
31
+ instance.should_receive(:naturalize_response).and_return(response)
32
+
33
+ instance.deleted({}, &block).should == block.call(response)
34
+ end
35
+ end
25
36
  end
26
37
 
27
38
  context "#build_for_deleted" do
@@ -22,6 +22,17 @@ shared_examples_for "a list endpoint" do
22
22
  instance.list
23
23
  end
24
24
  end
25
+
26
+ context "when passed a block" do
27
+ let(:block) { Fake.response_alt }
28
+ let(:response) { Fake.list_response }
29
+
30
+ it "should process the response through the block" do
31
+ instance.should_receive(:naturalize_response).and_return(response)
32
+
33
+ instance.list({}, &block).should == block.call(response)
34
+ end
35
+ end
25
36
  end
26
37
 
27
38
  context "#build_for_list" do
@@ -22,6 +22,17 @@ shared_examples_for "a search endpoint" do
22
22
  instance.search
23
23
  end
24
24
  end
25
+
26
+ context "when passed a block" do
27
+ let(:block) { Fake.response_alt }
28
+ let(:response) { Fake.list_response }
29
+
30
+ it "should process the response through the block" do
31
+ instance.should_receive(:naturalize_response).and_return(response)
32
+
33
+ instance.search({}, &block).should == block.call(response)
34
+ end
35
+ end
25
36
  end
26
37
 
27
38
  context "#build_for_search" do
@@ -21,6 +21,17 @@ shared_examples_for "a show endpoint" do
21
21
  expect { instance.show }.to raise_error ArgumentError
22
22
  end
23
23
  end
24
+
25
+ context "when passed a block" do
26
+ let(:block) { Fake.response_alt }
27
+ let(:response) { Fake.show_response }
28
+
29
+ it "should process the response through the block" do
30
+ instance.should_receive(:naturalize_response).and_return(response)
31
+
32
+ instance.show(1, &block).should == block.call(response)
33
+ end
34
+ end
24
35
  end
25
36
 
26
37
  describe "#build_for_show" do
@@ -25,6 +25,17 @@ shared_examples_for "an update endpoint" do
25
25
  instance.update
26
26
  end
27
27
  end
28
+
29
+ context "when passed a block" do
30
+ let(:block) { Fake.response_alt }
31
+ let(:response) { Fake.show_response }
32
+
33
+ it "should process the response through the block" do
34
+ instance.should_receive(:naturalize_response).and_return(response)
35
+
36
+ instance.update({}, &block).should == block.call(response)
37
+ end
38
+ end
28
39
  end
29
40
 
30
41
  context "without an id" do
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.2
4
+ version: 0.7.3
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-24 00:00:00.000000000Z
12
+ date: 2012-02-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70213479646800 !ruby/object:Gem::Requirement
16
+ requirement: &70364621391220 !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: *70213479646800
24
+ version_requirements: *70364621391220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &70213480049520 !ruby/object:Gem::Requirement
27
+ requirement: &70364621793840 !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: *70213480049520
35
+ version_requirements: *70364621793840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yajl-ruby
38
- requirement: &70213480475740 !ruby/object:Gem::Requirement
38
+ requirement: &70364622219220 !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: *70213480475740
46
+ version_requirements: *70364622219220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &70213480492200 !ruby/object:Gem::Requirement
49
+ requirement: &70364622236380 !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: *70213480492200
57
+ version_requirements: *70364622236380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &70213481183520 !ruby/object:Gem::Requirement
60
+ requirement: &70364622927980 !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: *70213481183520
68
+ version_requirements: *70364622927980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70213481182940 !ruby/object:Gem::Requirement
71
+ requirement: &70364622927280 !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: *70213481182940
79
+ version_requirements: *70364622927280
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: vcr
82
- requirement: &70213481182200 !ruby/object:Gem::Requirement
82
+ requirement: &70364622926500 !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: *70213481182200
90
+ version_requirements: *70364622926500
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: webmock
93
- requirement: &70213481181120 !ruby/object:Gem::Requirement
93
+ requirement: &70364622925480 !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: *70213481181120
104
+ version_requirements: *70364622925480
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: awesome_print
107
- requirement: &70213481179880 !ruby/object:Gem::Requirement
107
+ requirement: &70364622924240 !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: *70213481179880
115
+ version_requirements: *70364622924240
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rake
118
- requirement: &70213481179020 !ruby/object:Gem::Requirement
118
+ requirement: &70364622923360 !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: *70213481179020
126
+ version_requirements: *70364622923360
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:
@@ -305,7 +305,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
305
  version: '0'
306
306
  segments:
307
307
  - 0
308
- hash: -2898500470310488560
308
+ hash: 980979113044765798
309
309
  required_rubygems_version: !ruby/object:Gem::Requirement
310
310
  none: false
311
311
  requirements: