ticketevolution-ruby 0.7.23 → 0.7.24
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/lib/ticket_evolution/core/connection.rb +2 -1
- data/lib/ticket_evolution/order.rb +3 -3
- data/lib/ticket_evolution/orders.rb +19 -3
- data/lib/ticket_evolution/version.rb +1 -1
- data/spec/lib/ticket_evolution/core/connection_spec.rb +5 -2
- data/spec/lib/ticket_evolution/order_spec.rb +3 -4
- data/spec/lib/ticket_evolution/orders_spec.rb +23 -5
- metadata +3 -3
@@ -74,7 +74,8 @@ module TicketEvolution
|
|
74
74
|
options = {
|
75
75
|
:headers => {
|
76
76
|
"X-Signature" => sign(method, self.uri(path), params),
|
77
|
-
"X-Token" => @config[:token]
|
77
|
+
"X-Token" => @config[:token],
|
78
|
+
"Content-Type" => "application/json"
|
78
79
|
},
|
79
80
|
:ssl => {
|
80
81
|
:verify => @config[:ssl_verify]
|
@@ -3,15 +3,15 @@ module TicketEvolution
|
|
3
3
|
include Model::ParentalBehavior
|
4
4
|
|
5
5
|
def accept(params)
|
6
|
-
plural_class.new(:parent => @connection).accept_order(params)
|
6
|
+
plural_class.new(:parent => @connection,:id => self.id).accept_order(params)
|
7
7
|
end
|
8
8
|
|
9
9
|
def complete
|
10
|
-
plural_class.new(:parent => @connection).complete_order
|
10
|
+
plural_class.new(:parent => @connection,:id => self.id).complete_order
|
11
11
|
end
|
12
12
|
|
13
13
|
def reject(params)
|
14
|
-
plural_class.new(:parent => @connection).reject_order(params)
|
14
|
+
plural_class.new(:parent => @connection,:id => self.id).reject_order(params)
|
15
15
|
end
|
16
16
|
|
17
17
|
def email(params)
|
@@ -15,7 +15,17 @@ module TicketEvolution
|
|
15
15
|
|
16
16
|
def accept_order(params = nil)
|
17
17
|
ensure_id
|
18
|
-
request(:POST, "
|
18
|
+
request(:POST, "/accept", params) do |response|
|
19
|
+
singular_class.new(response.body.merge({
|
20
|
+
:status_code => response.response_code,
|
21
|
+
:server_message => response.server_message,
|
22
|
+
:connection => response.body[:connection]
|
23
|
+
}))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def pend_to_seller(id)
|
28
|
+
request(:POST, "/#{id}/pend_to_seller", &method(:build_for_show))
|
19
29
|
end
|
20
30
|
|
21
31
|
def create_fulfillment_order(params = nil)
|
@@ -24,12 +34,18 @@ module TicketEvolution
|
|
24
34
|
|
25
35
|
def reject_order(params = nil)
|
26
36
|
ensure_id
|
27
|
-
request(:POST, "
|
37
|
+
request(:POST, "/reject", params) do |response|
|
38
|
+
singular_class.new(response.body.merge({
|
39
|
+
:status_code => response.response_code,
|
40
|
+
:server_message => response.server_message,
|
41
|
+
:connection => response.body[:connection]
|
42
|
+
}))
|
43
|
+
end
|
28
44
|
end
|
29
45
|
|
30
46
|
def complete_order
|
31
47
|
ensure_id
|
32
|
-
request(:POST, "
|
48
|
+
request(:POST, "/complete", nil, &method(:build_for_create))
|
33
49
|
end
|
34
50
|
|
35
51
|
def email_order(params = nil)
|
@@ -284,7 +284,9 @@ describe TicketEvolution::Connection do
|
|
284
284
|
{
|
285
285
|
"Accept" => "application/vnd.ticketevolution.api+json; version=#{valid_options[:version]}",
|
286
286
|
"X-Signature" => "8eaaqg6d4DJ2SEWkCvkdhc05dITmpNbUrcbN75UBGMA=",
|
287
|
-
"X-Token" => valid_options[:token]
|
287
|
+
"X-Token" => valid_options[:token],
|
288
|
+
"Content-Type" => "application/json"
|
289
|
+
|
288
290
|
}
|
289
291
|
end
|
290
292
|
subject { klass.new(req_options).build_request(:GET, '/test', params) }
|
@@ -296,7 +298,8 @@ describe TicketEvolution::Connection do
|
|
296
298
|
let(:headers) do
|
297
299
|
{
|
298
300
|
"X-Signature" => "YbwEmJL9P0hvpplEr2q2iL4Mpz+KevHUOjzgYh0ewh4=",
|
299
|
-
"X-Token" => valid_options[:token]
|
301
|
+
"X-Token" => valid_options[:token],
|
302
|
+
"Content-Type" => "application/json"
|
300
303
|
}
|
301
304
|
end
|
302
305
|
subject { klass.new(req_options.merge(:version => 9)).build_request(:GET, '/test', params) }
|
@@ -14,12 +14,9 @@ describe TicketEvolution::Order do
|
|
14
14
|
let(:plural_klass) { TicketEvolution::Orders }
|
15
15
|
let!(:plural_klass_instance) { plural_klass.new(:parent => connection) }
|
16
16
|
|
17
|
-
before do
|
18
|
-
plural_klass.should_receive(:new).with(:parent => connection).and_return(plural_klass_instance)
|
19
|
-
end
|
20
|
-
|
21
17
|
describe "#accept" do
|
22
18
|
it "should pass the request to TicketEvolution::Orders#accept_order" do
|
19
|
+
plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
|
23
20
|
plural_klass_instance.should_receive(:accept_order).with(params).and_return(:dont_care)
|
24
21
|
|
25
22
|
instance.accept(params)
|
@@ -28,6 +25,7 @@ describe TicketEvolution::Order do
|
|
28
25
|
|
29
26
|
describe "#complete" do
|
30
27
|
it "should pass the request to TicketEvolution::Orders#complete_order" do
|
28
|
+
plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
|
31
29
|
plural_klass_instance.should_receive(:complete_order).and_return(:dont_care)
|
32
30
|
|
33
31
|
instance.complete
|
@@ -36,6 +34,7 @@ describe TicketEvolution::Order do
|
|
36
34
|
|
37
35
|
describe "#reject" do
|
38
36
|
it "should pass the request to TicketEvolution::Orders#reject_order" do
|
37
|
+
plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
|
39
38
|
plural_klass_instance.should_receive(:reject_order).with(params).and_return(:dont_care)
|
40
39
|
|
41
40
|
instance.reject(params)
|
@@ -28,7 +28,7 @@ describe TicketEvolution::Orders do
|
|
28
28
|
let(:params) { {:reviewer_id => 1} }
|
29
29
|
|
30
30
|
it "should pass call request as a POST, passing params" do
|
31
|
-
instance.should_receive(:request).with(:POST, "
|
31
|
+
instance.should_receive(:request).with(:POST, "/accept", params)
|
32
32
|
|
33
33
|
instance.accept_order(params)
|
34
34
|
end
|
@@ -36,7 +36,7 @@ describe TicketEvolution::Orders do
|
|
36
36
|
|
37
37
|
context "without params" do
|
38
38
|
it "should pass call request as a POST, passing params" do
|
39
|
-
instance.should_receive(:request).with(:POST, "
|
39
|
+
instance.should_receive(:request).with(:POST, "/accept", nil)
|
40
40
|
|
41
41
|
instance.accept_order
|
42
42
|
end
|
@@ -51,6 +51,24 @@ describe TicketEvolution::Orders do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe "#pend_to_seller" do
|
55
|
+
context "with an id" do
|
56
|
+
let(:instance) { klass.new({:parent => Fake.connection, :id => 1}) }
|
57
|
+
|
58
|
+
it "should pass call request as a POST" do
|
59
|
+
instance.should_receive(:request).with(:POST, "/1/pend_to_seller")
|
60
|
+
|
61
|
+
instance.pend_to_seller(instance.id)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "without an id" do
|
66
|
+
it "should raise an ArgumentError if there is no id" do
|
67
|
+
expect { instance.pend_to_seller() }.to raise_error ArgumentError
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
54
72
|
describe "#create_fulfillment_order" do
|
55
73
|
context "with params" do
|
56
74
|
let(:params) { {'some' => {'order' => 'info'}} }
|
@@ -79,7 +97,7 @@ describe TicketEvolution::Orders do
|
|
79
97
|
let(:params) { {:rejection_reason => "IT'S A TRAP!!", :reviewer_id => 1} }
|
80
98
|
|
81
99
|
it "should pass call request as a POST, passing params" do
|
82
|
-
instance.should_receive(:request).with(:POST, "
|
100
|
+
instance.should_receive(:request).with(:POST, "/reject", params)
|
83
101
|
|
84
102
|
instance.reject_order(params)
|
85
103
|
end
|
@@ -87,7 +105,7 @@ describe TicketEvolution::Orders do
|
|
87
105
|
|
88
106
|
context "without params" do
|
89
107
|
it "should pass call request as a POST, passing params" do
|
90
|
-
instance.should_receive(:request).with(:POST, "
|
108
|
+
instance.should_receive(:request).with(:POST, "/reject", nil)
|
91
109
|
|
92
110
|
instance.reject_order
|
93
111
|
end
|
@@ -107,7 +125,7 @@ describe TicketEvolution::Orders do
|
|
107
125
|
let(:instance) { klass.new({:parent => Fake.connection, :id => 1}) }
|
108
126
|
|
109
127
|
it "should pass call request as a POST, passing params" do
|
110
|
-
instance.should_receive(:request).with(:POST, "
|
128
|
+
instance.should_receive(:request).with(:POST, "/complete", nil)
|
111
129
|
|
112
130
|
instance.complete_order
|
113
131
|
end
|
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.
|
4
|
+
version: 0.7.24
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -402,7 +402,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
402
402
|
version: '0'
|
403
403
|
segments:
|
404
404
|
- 0
|
405
|
-
hash:
|
405
|
+
hash: 2692934489261752987
|
406
406
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
407
407
|
none: false
|
408
408
|
requirements:
|