ticketevolution-ruby 0.7.26 → 0.7.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/README.markdown +4 -3
  2. data/lib/ticket_evolution.rb +17 -2
  3. data/lib/ticket_evolution/accounts/transactions.rb +11 -0
  4. data/lib/ticket_evolution/commission.rb +5 -0
  5. data/lib/ticket_evolution/commission_payment.rb +12 -0
  6. data/lib/ticket_evolution/commissions.rb +17 -0
  7. data/lib/ticket_evolution/commissions/commission_payments.rb +31 -0
  8. data/lib/ticket_evolution/core/collection.rb +4 -1
  9. data/lib/ticket_evolution/core/endpoint/request_handler.rb +5 -1
  10. data/lib/ticket_evolution/credential.rb +5 -0
  11. data/lib/ticket_evolution/credentials.rb +5 -0
  12. data/lib/ticket_evolution/credit_memo.rb +9 -0
  13. data/lib/ticket_evolution/credit_memo_payment.rb +13 -0
  14. data/lib/ticket_evolution/credit_memos.rb +20 -0
  15. data/lib/ticket_evolution/credit_memos/credit_memo_payments.rb +31 -0
  16. data/lib/ticket_evolution/modules/create.rb +9 -1
  17. data/lib/ticket_evolution/modules/create_in_background.rb +1 -1
  18. data/lib/ticket_evolution/modules/list.rb +5 -0
  19. data/lib/ticket_evolution/modules/retrieve_queued_order.rb +3 -6
  20. data/lib/ticket_evolution/order.rb +20 -0
  21. data/lib/ticket_evolution/orders.rb +54 -0
  22. data/lib/ticket_evolution/payment.rb +6 -4
  23. data/lib/ticket_evolution/payments.rb +46 -0
  24. data/lib/ticket_evolution/queued_order.rb +4 -0
  25. data/lib/ticket_evolution/queued_orders.rb +10 -0
  26. data/lib/ticket_evolution/quote.rb +5 -0
  27. data/lib/ticket_evolution/quotes.rb +31 -0
  28. data/lib/ticket_evolution/reports.rb +15 -0
  29. data/lib/ticket_evolution/searches.rb +11 -0
  30. data/lib/ticket_evolution/shipment.rb +9 -0
  31. data/lib/ticket_evolution/shipments.rb +41 -0
  32. data/lib/ticket_evolution/ticket_groups.rb +12 -1
  33. data/lib/ticket_evolution/transaction.rb +3 -0
  34. data/lib/ticket_evolution/transactions.rb +7 -0
  35. data/lib/ticket_evolution/version.rb +1 -1
  36. data/spec/lib/ticket_evolution/order_spec.rb +18 -0
  37. data/spec/lib/ticket_evolution/orders_spec.rb +31 -0
  38. data/spec/lib/ticket_evolution/{orders/payments_spec.rb → payments_spec.rb} +8 -8
  39. metadata +23 -5
  40. data/lib/ticket_evolution/orders/payments.rb +0 -42
@@ -36,7 +36,8 @@ Then
36
36
  require 'ticket_evolution'
37
37
  @connection = TicketEvolution::Connection.new({
38
38
  :token => '<YOUR TOKEN>',
39
- :secret => '<YOUR SECRET>'
39
+ :secret => '<YOUR SECRET>',
40
+ :version => 9
40
41
  })
41
42
  @connection.brokerages.list({:per_page => 1})
42
43
 
@@ -53,10 +54,10 @@ Each set of API credentials can be combined with a mode and api version to creat
53
54
  :token => '', # => (required) The API token, used to identify you
54
55
  :secret => '', # => (required) The API secret, used to sign requests
55
56
  # More info: [http://developer.ticketevolution.com/signature_tool](http://developer.ticketevolution.com/signature_tool))
57
+ :version => 9, # => (required) API version to use - the correct version
58
+ at the time of this writing is 9
56
59
  :mode => :sandbox, # => (optional) Specifies the server environment to use
57
60
  Valid options: :production or :sandbox
58
- :version => 8, # => (optional) API version to use - the only available
59
- version at the time of this writing is 8
60
61
  :logger => nil # => (optional) Object to use for logging requests and
61
62
  # responses. Any 'Logger' instance object
62
63
  # is valid. EX: Logger.new('log/te_api.log')
@@ -77,10 +77,13 @@ i.req 'brokerage'
77
77
  i.req 'category'
78
78
  i.req 'company'
79
79
  i.req 'client'
80
+ i.req 'commission'
80
81
  i.req 'configuration'
81
82
  i.req 'credit_card'
83
+ i.req 'credit_memo'
82
84
  i.req 'ticket_hold'
83
85
  i.req 'email_address'
86
+ i.req 'credential'
84
87
  i.req 'event'
85
88
  i.req 'office'
86
89
  i.req 'order'
@@ -88,6 +91,7 @@ i.req 'payment'
88
91
  i.req 'performer'
89
92
  i.req 'phone_number'
90
93
  i.req 'promotion_code'
94
+ i.req 'queued_order'
91
95
  i.req 'quote'
92
96
  i.req 'rate_option'
93
97
  i.req 'service_fee'
@@ -107,12 +111,19 @@ i.req 'brokerages'
107
111
  i.req 'categories'
108
112
  i.req 'companies'
109
113
  i.req 'clients'
114
+ i.req 'commissions'
115
+ i.req 'commission_payment'
110
116
  i.req 'configurations'
117
+ i.req 'credit_memos'
118
+ i.req 'credit_memo_payment'
119
+ i.req 'credentials'
111
120
  i.req 'events'
112
121
  i.req 'offices'
113
122
  i.req 'orders'
123
+ i.req 'payments'
114
124
  i.req 'performers'
115
125
  i.req 'promotion_codes'
126
+ i.req 'queued_orders'
116
127
  i.req 'quotes'
117
128
  i.req 'rate_options'
118
129
  i.req 'settings'
@@ -120,9 +131,12 @@ i.req 'shipments'
120
131
  i.req 'filtered_tickets'
121
132
  i.req 'ticket_groups'
122
133
  i.req 'track_details'
134
+ i.req 'transactions'
123
135
  i.req 'users'
124
136
  i.req 'venues'
125
137
  i.req 'search'
138
+ i.req 'searches'
139
+ i.req 'reports'
126
140
 
127
141
  i.req 'clients', 'addresses'
128
142
  i.req 'clients', 'credit_cards'
@@ -131,8 +145,9 @@ i.req 'clients', 'phone_numbers'
131
145
 
132
146
  i.req 'accounts', 'transactions'
133
147
 
134
- i.req 'offices', 'credit_cards'
148
+ i.req 'credit_memos', 'credit_memo_payments'
149
+ i.req 'commissions', 'commission_payments'
135
150
 
136
- i.req 'orders', 'payments'
151
+ i.req 'offices', 'credit_cards'
137
152
 
138
153
  i.req 'ticket_groups', 'ticket_holds'
@@ -1,8 +1,19 @@
1
1
  module TicketEvolution
2
2
  class Accounts
3
3
  class Transactions < TicketEvolution::Endpoint
4
+ include TicketEvolution::Modules::Create
4
5
  include TicketEvolution::Modules::List
5
6
  include TicketEvolution::Modules::Show
7
+
8
+ def balances(params = nil)
9
+ request(:GET, "/balances", params) do |response|
10
+ singular_class.new(response.body.merge({
11
+ :status_code => response.response_code,
12
+ :server_message => response.server_message,
13
+ :connection => response.body[:connection]
14
+ }))
15
+ end
16
+ end
6
17
  end
7
18
  end
8
19
  end
@@ -0,0 +1,5 @@
1
+ module TicketEvolution
2
+ class Commission < Model
3
+ include Model::ParentalBehavior
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module TicketEvolution
2
+ class CommissionPayment < Model
3
+
4
+ def apply(params = {})
5
+ plural_class.new(:parent => self.endpoint.parent, :id => self.id).apply(params)
6
+ end
7
+
8
+ def cancel(params = {})
9
+ plural_class.new(:parent => self.endpoint.parent, :id => self.id).cancel
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module TicketEvolution
2
+ class Commissions < Endpoint
3
+ include TicketEvolution::Modules::List
4
+ include TicketEvolution::Modules::Show
5
+
6
+ def pay(params = nil)
7
+ request(:POST, "/pay", params) do |response|
8
+ singular_class.new(response.body.merge({
9
+ :status_code => response.response_code,
10
+ :server_message => response.server_message,
11
+ :connection => response.body[:connection]
12
+ }))
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ module TicketEvolution
2
+ class Commissions
3
+ class CommissionPayments < TicketEvolution::Endpoint
4
+ include TicketEvolution::Modules::List
5
+ include TicketEvolution::Modules::Show
6
+
7
+ def apply(params = {})
8
+ ensure_id
9
+ request(:GET, '/apply', params) do |response|
10
+ singular_class.new(response.body.merge({
11
+ :status_code => response.response_code,
12
+ :server_message => response.server_message,
13
+ :connection => response.body[:connection]
14
+ }))
15
+ end
16
+ end
17
+
18
+ def cancel(params = nil)
19
+ ensure_id
20
+ request(:GET, "/cancel", nil) do |response|
21
+ singular_class.new(response.body.merge({
22
+ :status_code => response.response_code,
23
+ :server_message => response.server_message,
24
+ :connection => response.body[:connection]
25
+ }))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -1,6 +1,7 @@
1
1
  module TicketEvolution
2
2
  class Collection
3
- attr_accessor :total_entries, :per_page, :current_page, :entries, :status_code, :unique_categories
3
+ attr_accessor :total_entries, :per_page, :current_page, :entries, :status_code,
4
+ :unique_categories, :balance_sum, :total_sum
4
5
 
5
6
  include Enumerable
6
7
 
@@ -25,6 +26,8 @@ module TicketEvolution
25
26
  end
26
27
  }
27
28
  values[:unique_categories] = response.body['unique_categories'] if response.body['unique_categories']
29
+ values[:balance_sum] = response.body['balance_sum'] if response.body['balance_sum']
30
+ values[:total_sum] = response.body['total_sum'] if response.body['total_sum']
28
31
  new(values)
29
32
  end
30
33
  end
@@ -53,7 +53,7 @@ module TicketEvolution
53
53
  OpenStruct.new.tap do |resp|
54
54
  resp.header = response.headers
55
55
  resp.response_code = response.status
56
- resp.body = MultiJson.decode(response.body).merge({:connection => self.connection})
56
+ resp.body = (MultiJson.decode(response.body) rescue {"error" => "Internal Server Error"}).merge({:connection => self.connection})
57
57
  resp.server_message = (CODES[resp.response_code] || ['Unknown Error']).last
58
58
  end
59
59
  end
@@ -61,6 +61,10 @@ module TicketEvolution
61
61
  def collection_handler(response)
62
62
  TicketEvolution::Collection.build_from_response(response, self.class.name.demodulize.underscore, singular_class)
63
63
  end
64
+
65
+ def raw_handler(response)
66
+ response
67
+ end
64
68
  end
65
69
  end
66
70
  end
@@ -0,0 +1,5 @@
1
+ module TicketEvolution
2
+ class Credential < Model
3
+ end
4
+ end
5
+
@@ -0,0 +1,5 @@
1
+ module TicketEvolution
2
+ class Credentials < Endpoint
3
+ include TicketEvolution::Modules::List
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ module TicketEvolution
2
+ class CreditMemo < Model
3
+ include Model::ParentalBehavior
4
+
5
+ def cards(params = nil)
6
+ plural_class.new(:parent => @connection,:id => self.id).cards(params)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module TicketEvolution
2
+ class CreditMemoPayment < Model
3
+
4
+ def apply(params = {})
5
+ plural_class.new(:parent => self.endpoint.parent, :id => self.id).apply(params)
6
+ end
7
+
8
+ def cancel(params = {})
9
+ plural_class.new(:parent => self.endpoint.parent, :id => self.id).cancel
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,20 @@
1
+ module TicketEvolution
2
+ class CreditMemos < Endpoint
3
+ include TicketEvolution::Modules::List
4
+ include TicketEvolution::Modules::Show
5
+ include TicketEvolution::Modules::Update
6
+
7
+ def cards(params = nil)
8
+ ensure_id
9
+ request(:GET, "/cards", params) do |response|
10
+ singular_class.new(response.body.merge({
11
+ :status_code => response.response_code,
12
+ :server_message => response.server_message,
13
+ :connection => response.body[:connection]
14
+ }))
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+
@@ -0,0 +1,31 @@
1
+ module TicketEvolution
2
+ class CreditMemos
3
+ class CreditMemoPayments < TicketEvolution::Endpoint
4
+ include TicketEvolution::Modules::List
5
+ include TicketEvolution::Modules::Show
6
+ include TicketEvolution::Modules::Create
7
+
8
+ def apply(params = {})
9
+ ensure_id
10
+ request(:GET, '/apply', params) do |response|
11
+ singular_class.new(response.body.merge({
12
+ :status_code => response.response_code,
13
+ :server_message => response.server_message,
14
+ :connection => response.body[:connection]
15
+ }))
16
+ end
17
+ end
18
+
19
+ def cancel(params = nil)
20
+ ensure_id
21
+ request(:GET, "/cancel", nil) do |response|
22
+ singular_class.new(response.body.merge({
23
+ :status_code => response.response_code,
24
+ :server_message => response.server_message,
25
+ :connection => response.body[:connection]
26
+ }))
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -3,7 +3,15 @@ module TicketEvolution
3
3
  module Create
4
4
  def create(params = nil, &handler)
5
5
  handler ||= method(:build_for_create)
6
- params = { endpoint_name.to_sym => [params] } if params.present?
6
+ if params.present?
7
+ if params.is_a?(Array)
8
+ params = { endpoint_name.to_sym => params }
9
+ else
10
+ if !params[endpoint_name.to_sym].present?
11
+ params = { endpoint_name.to_sym => [params] }
12
+ end
13
+ end
14
+ end
7
15
  request(:POST, nil, params, &handler)
8
16
  end
9
17
 
@@ -4,7 +4,7 @@ module TicketEvolution
4
4
  def create_in_background(params = nil, &handler)
5
5
  handler ||= method(:build_for_create_in_background)
6
6
  params = { endpoint_name.to_sym => [params] } if params.present?
7
- request(:POST, '/create_in_background', params, &handler)
7
+ request(:POST, '/background', params, &handler)
8
8
  end
9
9
 
10
10
  def build_for_create_in_background(response)
@@ -6,6 +6,11 @@ module TicketEvolution
6
6
  request(:GET, nil, params, &handler)
7
7
  end
8
8
 
9
+ def raw(params = nil, &handler)
10
+ handler ||= method(:raw_handler)
11
+ request(:GET, nil, params, &handler)
12
+ end
13
+
9
14
  alias :all :list
10
15
  end
11
16
  end
@@ -1,14 +1,11 @@
1
1
  module TicketEvolution
2
2
  module Modules
3
3
  module RetrieveQueuedOrder
4
- def retrieve_queued_order(id, params = nil, &handler)
5
- handler ||= method(:build_for_retrieve_queued_order)
6
- request(:GET, "/retrieve_queued_order/#{id}", params, &handler)
4
+ def retrieve_queued_orders(&handler)
5
+ handler ||= method(:collection_handler)
6
+ request(:GET, "/queued_orders", &handler)
7
7
  end
8
8
 
9
- def build_for_retrieve_queued_order(response)
10
- response.body
11
- end
12
9
  end
13
10
  end
14
11
  end
@@ -6,6 +6,10 @@ module TicketEvolution
6
6
  plural_class.new(:parent => @connection,:id => self.id).accept_order(params)
7
7
  end
8
8
 
9
+ def return(params)
10
+ plural_class.new(:parent => @connection,:id => self.id).return_order(params)
11
+ end
12
+
9
13
  def complete
10
14
  plural_class.new(:parent => @connection,:id => self.id).complete_order
11
15
  end
@@ -14,6 +18,10 @@ module TicketEvolution
14
18
  plural_class.new(:parent => @connection,:id => self.id).reject_order(params)
15
19
  end
16
20
 
21
+ def cancel(params)
22
+ plural_class.new(:parent => @connection,:id => self.id).cancel_order(params)
23
+ end
24
+
17
25
  def email(params)
18
26
  plural_class.new(:parent => @connection,:id => self.id).email_order(params)
19
27
  end
@@ -37,5 +45,17 @@ module TicketEvolution
37
45
  def print(params = nil)
38
46
  plural_class.new(:parent => @connection,:id => self.id).print_order(params)
39
47
  end
48
+
49
+ def get_ticket_costs(params = nil)
50
+ plural_class.new(:parent => @connection,:id => self.id).get_ticket_costs(params)
51
+ end
52
+
53
+ def update_ticket_costs(params)
54
+ plural_class.new(:parent => @connection,:id => self.id).update_ticket_costs(params)
55
+ end
56
+
57
+ def update_spec_tickets(params)
58
+ plural_class.new(:parent => @connection,:id => self.id).update_spec_tickets(params)
59
+ end
40
60
  end
41
61
  end
@@ -24,6 +24,17 @@ module TicketEvolution
24
24
  end
25
25
  end
26
26
 
27
+ def return_order(params = nil)
28
+ ensure_id
29
+ request(:POST, "/return", params) do |response|
30
+ singular_class.new(response.body.merge({
31
+ :status_code => response.response_code,
32
+ :server_message => response.server_message,
33
+ :connection => response.body[:connection]
34
+ }))
35
+ end
36
+ end
37
+
27
38
  def pend_to_seller(params)
28
39
  request(:POST, "/#{params[:id]}/pend_to_seller", params, &method(:build_for_show))
29
40
  end
@@ -43,6 +54,17 @@ module TicketEvolution
43
54
  end
44
55
  end
45
56
 
57
+ def cancel_order(params = nil)
58
+ ensure_id
59
+ request(:POST, "/cancel", params) do |response|
60
+ singular_class.new(response.body.merge({
61
+ :status_code => response.response_code,
62
+ :server_message => response.server_message,
63
+ :connection => response.body[:connection]
64
+ }))
65
+ end
66
+ end
67
+
46
68
  def complete_order
47
69
  ensure_id
48
70
  request(:POST, "/complete", nil, &method(:build_for_create))
@@ -107,5 +129,37 @@ module TicketEvolution
107
129
  end
108
130
  end
109
131
 
132
+ def get_ticket_costs(params = nil)
133
+ ensure_id
134
+ request(:GET, "/get_ticket_costs", params) do |response|
135
+ singular_class.new(response.body.merge({
136
+ :status_code => response.response_code,
137
+ :server_message => response.server_message,
138
+ :connection => response.body[:connection]
139
+ }))
140
+ end
141
+ end
142
+
143
+ def update_ticket_costs(params = nil)
144
+ ensure_id
145
+ request(:POST, "/update_ticket_costs", params) do |response|
146
+ singular_class.new(response.body.merge({
147
+ :status_code => response.response_code,
148
+ :server_message => response.server_message,
149
+ :connection => response.body[:connection]
150
+ }))
151
+ end
152
+ end
153
+
154
+ def update_spec_tickets(params = nil)
155
+ ensure_id
156
+ request(:POST, "/update_spec_tickets", params) do |response|
157
+ singular_class.new(response.body.merge({
158
+ :status_code => response.response_code,
159
+ :server_message => response.server_message,
160
+ :connection => response.body[:connection]
161
+ }))
162
+ end
163
+ end
110
164
  end
111
165
  end
@@ -1,15 +1,17 @@
1
1
  module TicketEvolution
2
2
  class Payment < Model
3
- def apply
4
- plural_class.new(:parent => @connection,:id => self.id).apply
3
+ include Model::ParentalBehavior
4
+
5
+ def apply(params=nil)
6
+ plural_class.new(:parent => @connection,:id => self.id).apply(params)
5
7
  end
6
8
 
7
9
  def cancel
8
10
  plural_class.new(:parent => @connection,:id => self.id).cancel
9
11
  end
10
12
 
11
- def refund
12
- plural_class.new(:parent => @connection,:id => self.id).refund
13
+ def refund(params=nil)
14
+ plural_class.new(:parent => @connection,:id => self.id).refund(params)
13
15
  end
14
16
  end
15
17
  end
@@ -0,0 +1,46 @@
1
+ module TicketEvolution
2
+ class Payments < Endpoint
3
+ include TicketEvolution::Modules::Create
4
+ include TicketEvolution::Modules::List
5
+ include TicketEvolution::Modules::Show
6
+ include TicketEvolution::Modules::Update
7
+
8
+ def status(params = {})
9
+ handler ||= method(:collection_handler)
10
+ request(:GET, '/status', params, &handler)
11
+ end
12
+
13
+ def apply(params = {})
14
+ ensure_id
15
+ request(:GET, "/apply", params) do |response|
16
+ singular_class.new(response.body.merge({
17
+ :status_code => response.response_code,
18
+ :server_message => response.server_message,
19
+ :connection => response.body[:connection]
20
+ }))
21
+ end
22
+ end
23
+
24
+ def cancel(params = nil)
25
+ ensure_id
26
+ request(:GET, "/cancel", nil) do |response|
27
+ singular_class.new(response.body.merge({
28
+ :status_code => response.response_code,
29
+ :server_message => response.server_message,
30
+ :connection => response.body[:connection]
31
+ }))
32
+ end
33
+ end
34
+
35
+ def refund(params = nil)
36
+ ensure_id
37
+ request(:POST, "/refund", 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
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,4 @@
1
+ module TicketEvolution
2
+ class QueuedOrder < Model
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module TicketEvolution
2
+ class QueuedOrders < Endpoint
3
+ include TicketEvolution::Modules::List
4
+ include TicketEvolution::Modules::Show
5
+
6
+ def list_recent
7
+ request(:GET, '/recent', &method(:collection_handler))
8
+ end
9
+ end
10
+ end
@@ -1,4 +1,9 @@
1
1
  module TicketEvolution
2
2
  class Quote < Model
3
+
4
+ def resend
5
+ plural_class.new(:parent => @connection,:id => self.id).resend
6
+ end
7
+
3
8
  end
4
9
  end
@@ -3,5 +3,36 @@ module TicketEvolution
3
3
  include TicketEvolution::Modules::List
4
4
  include TicketEvolution::Modules::Search
5
5
  include TicketEvolution::Modules::Show
6
+ include TicketEvolution::Modules::Create
7
+ include TicketEvolution::Modules::Update
8
+
9
+ def autocomplete(params = {})
10
+ request(:GET, "/autocomplete", params, &method(:build_for_search))
11
+ end
12
+
13
+ def resend
14
+ ensure_id
15
+ request(:GET, "/resend", nil) do |response|
16
+ singular_class.new(response.body.merge({
17
+ :status_code => response.response_code,
18
+ :server_message => response.server_message,
19
+ :connection => response.body[:connection]
20
+ }))
21
+ end
22
+ end
23
+
24
+ def build_for_search(response)
25
+ collection = TicketEvolution::Collection.new(
26
+ :total_entries => response.body['total_entries'],
27
+ :per_page => response.body['per_page'],
28
+ :current_page => response.body['current_page']
29
+ )
30
+
31
+ response.body['results'].each do |result|
32
+ collection.entries << result
33
+ end
34
+
35
+ collection
36
+ end
6
37
  end
7
38
  end
@@ -0,0 +1,15 @@
1
+ module TicketEvolution
2
+ class Reports < Endpoint
3
+ def sales(params = {})
4
+ request(:GET, '/sales', params, &method(:build_for_reports))
5
+ end
6
+
7
+ def inventory(params = {})
8
+ request(:GET, '/inventory', params, &method(:build_for_reports))
9
+ end
10
+
11
+ def build_for_reports(response)
12
+ response.body
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module TicketEvolution
2
+ class Searches < Endpoint
3
+ def suggestions(params = {})
4
+ request(:GET, '/suggestions', params, &method(:build_for_search))
5
+ end
6
+
7
+ def build_for_search(response)
8
+ response.body['suggestions']
9
+ end
10
+ end
11
+ end
@@ -3,11 +3,20 @@ module TicketEvolution
3
3
  def generate_airbill
4
4
  plural_class.new(:parent => @connection, :id => self.id).generate_airbill
5
5
  end
6
+ def get_airbill
7
+ plural_class.new(:parent => @connection, :id => self.id).get_airbill
8
+ end
6
9
  def email_airbill(params)
7
10
  plural_class.new(:parent => @connection, :id => self.id).email_airbill(params)
8
11
  end
9
12
  def cancel
10
13
  plural_class.new(:parent => @connection, :id => self.id).cancel_shipment
11
14
  end
15
+ def deliver
16
+ plural_class.new(:parent => @connection, :id => self.id).deliver_shipment
17
+ end
18
+ def pend
19
+ plural_class.new(:parent => @connection, :id => self.id).pend_shipment
20
+ end
12
21
  end
13
22
  end
@@ -5,6 +5,23 @@ module TicketEvolution
5
5
  include TicketEvolution::Modules::Show
6
6
  include TicketEvolution::Modules::Update
7
7
 
8
+ def status(params = {})
9
+ handler ||= method(:collection_handler)
10
+ request(:GET, '/status', params, &handler)
11
+ end
12
+
13
+ def get_airbill(params = {})
14
+ ensure_id
15
+
16
+ request(:GET, "/get_airbill", nil) do |response|
17
+ singular_class.new(response.body.merge({
18
+ :status_code => response.response_code,
19
+ :server_message => response.server_message,
20
+ :connection => response.body[:connection]
21
+ }))
22
+ end
23
+ end
24
+
8
25
  def generate_airbill(params = nil)
9
26
  ensure_id
10
27
  request(:POST, "/airbill", nil) do |response|
@@ -39,5 +56,29 @@ module TicketEvolution
39
56
  }))
40
57
  end
41
58
  end
59
+
60
+ def pend_shipment(params = nil)
61
+ ensure_id
62
+
63
+ request(:GET, "/pend", nil) do |response|
64
+ singular_class.new(response.body.merge({
65
+ :status_code => response.response_code,
66
+ :server_message => response.server_message,
67
+ :connection => response.body[:connection]
68
+ }))
69
+ end
70
+ end
71
+
72
+ def deliver_shipment(params = nil)
73
+ ensure_id
74
+
75
+ request(:GET, "/deliver", nil) do |response|
76
+ singular_class.new(response.body.merge({
77
+ :status_code => response.response_code,
78
+ :server_message => response.server_message,
79
+ :connection => response.body[:connection]
80
+ }))
81
+ end
82
+ end
42
83
  end
43
84
  end
@@ -2,6 +2,7 @@ module TicketEvolution
2
2
  class TicketGroups < Endpoint
3
3
  include TicketEvolution::Modules::List
4
4
  include TicketEvolution::Modules::Show
5
+ include TicketEvolution::Modules::Create
5
6
  include TicketEvolution::Modules::Update
6
7
 
7
8
  def hold(params = nil)
@@ -13,7 +14,7 @@ module TicketEvolution
13
14
  ensure_id
14
15
  request(:POST, "/take", params, &method(:build_for_show))
15
16
  end
16
-
17
+
17
18
  def update_hold(params = nil)
18
19
  ensure_id
19
20
  request(:POST, "/update_hold/#{params[:ticket_hold_id]}", params, &method(:build_for_show))
@@ -43,5 +44,15 @@ module TicketEvolution
43
44
  handler ||= method(:collection_handler)
44
45
  request(:GET, '/index_cart', ids, &handler)
45
46
  end
47
+
48
+ def mass_index(params = {})
49
+ handler ||= method(:collection_handler)
50
+ request(:GET, '/mass_index', params, &handler)
51
+ end
52
+
53
+ def mass_update(params = {})
54
+ handler ||= method(:collection_handler)
55
+ request(:POST, '/mass_update', params, &handler)
56
+ end
46
57
  end
47
58
  end
@@ -1,4 +1,7 @@
1
1
  module TicketEvolution
2
2
  class Transaction < Model
3
+ def balances(params = nil)
4
+ plural_class.new(:parent => @connection,:id => self.id).balances(params)
5
+ end
3
6
  end
4
7
  end
@@ -0,0 +1,7 @@
1
+ module TicketEvolution
2
+ class Transactions < Endpoint
3
+ include TicketEvolution::Modules::List
4
+ include TicketEvolution::Modules::Create
5
+ include TicketEvolution::Modules::Show
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module TicketEvolution
2
- VERSION = '0.7.26'
2
+ VERSION = '0.7.31'
3
3
  end
@@ -23,6 +23,15 @@ describe TicketEvolution::Order do
23
23
  end
24
24
  end
25
25
 
26
+ describe "#return" do
27
+ it "should pass the request to TicketEvolution::Orders#return_order" do
28
+ plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
29
+ plural_klass_instance.should_receive(:return_order).with(params).and_return(:dont_care)
30
+
31
+ instance.return(params)
32
+ end
33
+ end
34
+
26
35
  describe "#complete" do
27
36
  it "should pass the request to TicketEvolution::Orders#complete_order" do
28
37
  plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
@@ -40,5 +49,14 @@ describe TicketEvolution::Order do
40
49
  instance.reject(params)
41
50
  end
42
51
  end
52
+
53
+ describe "#cancel" do
54
+ it "should pass the request to TicketEvolution::Orders#cancel_order" do
55
+ plural_klass.should_receive(:new).with(:parent => connection, :id => instance.id).and_return(plural_klass_instance)
56
+ plural_klass_instance.should_receive(:cancel_order).with(params).and_return(:dont_care)
57
+
58
+ instance.cancel(params)
59
+ end
60
+ end
43
61
  end
44
62
  end
@@ -121,6 +121,37 @@ describe TicketEvolution::Orders do
121
121
  end
122
122
  end
123
123
 
124
+ describe "#cancel_order" do
125
+ context "with an id" do
126
+ let(:instance) { klass.new({:parent => Fake.connection, :id => 1}) }
127
+
128
+ context "with params" do
129
+ let(:params) { {:cancellation_reason => "IT'S A TRAP!!", :reviewer_id => 1} }
130
+
131
+ it "should pass call request as a POST, passing params" do
132
+ instance.should_receive(:request).with(:POST, "/cancel", params)
133
+
134
+ instance.cancel_order(params)
135
+ end
136
+ end
137
+
138
+ context "without params" do
139
+ it "should pass call request as a POST, passing params" do
140
+ instance.should_receive(:request).with(:POST, "/cancel", nil)
141
+
142
+ instance.cancel_order
143
+ end
144
+ end
145
+ end
146
+
147
+ context "without an id" do
148
+ it "should raise an UnavailableMethodError if there is no id" do
149
+ message = "#{klass.to_s}#cancel_order can only be called if there is an id present on this #{klass.to_s} instance"
150
+ expect { instance.cancel_order }.to raise_error TicketEvolution::MethodUnavailableError, message
151
+ end
152
+ end
153
+ end
154
+
124
155
  describe "#complete_order" do
125
156
  context "with an id" do
126
157
  let(:instance) { klass.new({:parent => Fake.connection, :id => 1}) }
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TicketEvolution::Orders::Payments do
4
- let(:klass) { TicketEvolution::Orders::Payments }
3
+ describe TicketEvolution::Payments do
4
+ let(:klass) { TicketEvolution::Payments }
5
5
  let(:single_klass) { TicketEvolution::Payment }
6
- let(:update_base) { {'url' => '/orders/1/payments/1'} }
6
+ let(:update_base) { {'url' => '/payments/1'} }
7
7
 
8
8
  it_behaves_like 'a ticket_evolution endpoint class'
9
9
  it_behaves_like 'a create endpoint'
@@ -19,8 +19,8 @@ describe TicketEvolution::Orders::Payments do
19
19
  use_vcr_cassette 'payments/apply'
20
20
 
21
21
  it 'applies a payment' do
22
- instance.should_receive(:request).with(:POST, '/1/apply', { :order_id => 1, :id => 1 })
23
- instance.apply({ :order_id => 1, :id => 1 })
22
+ instance.should_receive(:request).with(:GET, '/apply', { :id => 1, :check_number => 12345 })
23
+ instance.apply({ :id => 1, :check_number => 12345 })
24
24
  end
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ describe TicketEvolution::Orders::Payments do
29
29
  use_vcr_cassette 'payments/cancel'
30
30
 
31
31
  it 'cancels the payment' do
32
- instance.should_receive(:request).with(:POST, '/1/cancel', { :order_id => 1, :id => 1 })
32
+ instance.should_receive(:request).with(:GET, '/cancel', nil)
33
33
  instance.cancel({ :order_id => 1, :id => 1 })
34
34
  end
35
35
  end
@@ -39,8 +39,8 @@ describe TicketEvolution::Orders::Payments do
39
39
  use_vcr_cassette 'payments/refund'
40
40
 
41
41
  it 'refunds the payment' do
42
- instance.should_receive(:request).with(:GET, '/1/refund',nil)
43
- instance.refund(1)
42
+ instance.should_receive(:request).with(:POST, '/refund', { :order_id => 1, :id => 1 })
43
+ instance.refund({ :order_id => 1, :id => 1 })
44
44
  end
45
45
  end
46
46
  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.26
4
+ version: 0.7.31
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: 2013-01-09 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -221,6 +221,10 @@ files:
221
221
  - lib/ticket_evolution/clients/credit_cards.rb
222
222
  - lib/ticket_evolution/clients/email_addresses.rb
223
223
  - lib/ticket_evolution/clients/phone_numbers.rb
224
+ - lib/ticket_evolution/commission.rb
225
+ - lib/ticket_evolution/commission_payment.rb
226
+ - lib/ticket_evolution/commissions.rb
227
+ - lib/ticket_evolution/commissions/commission_payments.rb
224
228
  - lib/ticket_evolution/companies.rb
225
229
  - lib/ticket_evolution/company.rb
226
230
  - lib/ticket_evolution/configuration.rb
@@ -237,7 +241,13 @@ files:
237
241
  - lib/ticket_evolution/core/model/parental_behavior.rb
238
242
  - lib/ticket_evolution/core/singular_class.rb
239
243
  - lib/ticket_evolution/core/time.rb
244
+ - lib/ticket_evolution/credential.rb
245
+ - lib/ticket_evolution/credentials.rb
240
246
  - lib/ticket_evolution/credit_card.rb
247
+ - lib/ticket_evolution/credit_memo.rb
248
+ - lib/ticket_evolution/credit_memo_payment.rb
249
+ - lib/ticket_evolution/credit_memos.rb
250
+ - lib/ticket_evolution/credit_memos/credit_memo_payments.rb
241
251
  - lib/ticket_evolution/email_address.rb
242
252
  - lib/ticket_evolution/errors/connection_not_found.rb
243
253
  - lib/ticket_evolution/errors/endpoint_configuration_error.rb
@@ -262,18 +272,22 @@ files:
262
272
  - lib/ticket_evolution/offices/credit_cards.rb
263
273
  - lib/ticket_evolution/order.rb
264
274
  - lib/ticket_evolution/orders.rb
265
- - lib/ticket_evolution/orders/payments.rb
266
275
  - lib/ticket_evolution/payment.rb
276
+ - lib/ticket_evolution/payments.rb
267
277
  - lib/ticket_evolution/performer.rb
268
278
  - lib/ticket_evolution/performers.rb
269
279
  - lib/ticket_evolution/phone_number.rb
270
280
  - lib/ticket_evolution/promotion_code.rb
271
281
  - lib/ticket_evolution/promotion_codes.rb
282
+ - lib/ticket_evolution/queued_order.rb
283
+ - lib/ticket_evolution/queued_orders.rb
272
284
  - lib/ticket_evolution/quote.rb
273
285
  - lib/ticket_evolution/quotes.rb
274
286
  - lib/ticket_evolution/rate_option.rb
275
287
  - lib/ticket_evolution/rate_options.rb
288
+ - lib/ticket_evolution/reports.rb
276
289
  - lib/ticket_evolution/search.rb
290
+ - lib/ticket_evolution/searches.rb
277
291
  - lib/ticket_evolution/service_fee.rb
278
292
  - lib/ticket_evolution/settings.rb
279
293
  - lib/ticket_evolution/shipment.rb
@@ -286,6 +300,7 @@ files:
286
300
  - lib/ticket_evolution/track_detail.rb
287
301
  - lib/ticket_evolution/track_details.rb
288
302
  - lib/ticket_evolution/transaction.rb
303
+ - lib/ticket_evolution/transactions.rb
289
304
  - lib/ticket_evolution/user.rb
290
305
  - lib/ticket_evolution/users.rb
291
306
  - lib/ticket_evolution/venue.rb
@@ -350,9 +365,9 @@ files:
350
365
  - spec/lib/ticket_evolution/offices/credit_cards_spec.rb
351
366
  - spec/lib/ticket_evolution/offices_spec.rb
352
367
  - spec/lib/ticket_evolution/order_spec.rb
353
- - spec/lib/ticket_evolution/orders/payments_spec.rb
354
368
  - spec/lib/ticket_evolution/orders_spec.rb
355
369
  - spec/lib/ticket_evolution/payment_spec.rb
370
+ - spec/lib/ticket_evolution/payments_spec.rb
356
371
  - spec/lib/ticket_evolution/performer_spec.rb
357
372
  - spec/lib/ticket_evolution/performers_spec.rb
358
373
  - spec/lib/ticket_evolution/phone_number_spec.rb
@@ -405,6 +420,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
405
420
  - - ! '>='
406
421
  - !ruby/object:Gem::Version
407
422
  version: '0'
423
+ segments:
424
+ - 0
425
+ hash: -4363082675175179634
408
426
  required_rubygems_version: !ruby/object:Gem::Requirement
409
427
  none: false
410
428
  requirements:
@@ -477,9 +495,9 @@ test_files:
477
495
  - spec/lib/ticket_evolution/offices/credit_cards_spec.rb
478
496
  - spec/lib/ticket_evolution/offices_spec.rb
479
497
  - spec/lib/ticket_evolution/order_spec.rb
480
- - spec/lib/ticket_evolution/orders/payments_spec.rb
481
498
  - spec/lib/ticket_evolution/orders_spec.rb
482
499
  - spec/lib/ticket_evolution/payment_spec.rb
500
+ - spec/lib/ticket_evolution/payments_spec.rb
483
501
  - spec/lib/ticket_evolution/performer_spec.rb
484
502
  - spec/lib/ticket_evolution/performers_spec.rb
485
503
  - spec/lib/ticket_evolution/phone_number_spec.rb
@@ -1,42 +0,0 @@
1
- module TicketEvolution
2
- class Orders
3
- class Payments < TicketEvolution::Endpoint
4
- include TicketEvolution::Modules::List
5
- include TicketEvolution::Modules::Show
6
- include TicketEvolution::Modules::Create
7
- include TicketEvolution::Modules::Update
8
-
9
- def apply(params = nil)
10
- _ensure_id(params)
11
- request(:POST, "/#{params[:id]}/apply", params, &method(:build_for_show))
12
- end
13
-
14
- def cancel(params = nil)
15
- _ensure_id(params)
16
- request(:POST, "/#{params[:id]}/cancel", params, &method(:build_for_show))
17
- end
18
-
19
- def refund(id,params=nil, &handler)
20
- handler ||= method(:refund_handler)
21
- params = { endpoint_name.to_sym => [params] } if params.present?
22
- request(:GET, "/#{id}/refund", params, &method(:build_for_show))
23
- end
24
-
25
- def refund_handler(response)
26
- singular_class.new(response.body.merge({
27
- :status_code => response.response_code,
28
- :server_message => response.server_message,
29
- :connection => response.body[:connection]
30
- }))
31
- end
32
-
33
- private
34
-
35
- def _ensure_id(params)
36
- raise TicketEvolution::MethodUnavailableError.new \
37
- "#{self.class.to_s}##{caller.first.split('`').last.split("'").first} can only be called if there is an id present on this #{self.class.to_s} instance" \
38
- unless params && params[:id].present?
39
- end
40
- end
41
- end
42
- end