tickethub 0.3.67 → 0.3.68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tickethub/channel/payment/paypal.rb +1 -1
  3. data/lib/tickethub/channel/payment/stripe.rb +1 -1
  4. data/lib/tickethub/resource.rb +13 -7
  5. data/lib/tickethub/supplier/charge.rb +3 -4
  6. data/lib/tickethub/supplier/message/email.rb +1 -1
  7. data/lib/tickethub/supplier/message/sms.rb +1 -1
  8. data/lib/tickethub/supplier/message.rb +4 -4
  9. data/lib/tickethub/supplier/order.rb +0 -2
  10. data/lib/tickethub/supplier/payment/cash.rb +1 -1
  11. data/lib/tickethub/supplier/payment/credit.rb +1 -1
  12. data/lib/tickethub/supplier/payment/direct.rb +1 -1
  13. data/lib/tickethub/supplier/payment/handpoint.rb +1 -1
  14. data/lib/tickethub/supplier/payment/paypal.rb +1 -1
  15. data/lib/tickethub/supplier/payment/spreedly.rb +1 -1
  16. data/lib/tickethub/supplier/payment/stripe.rb +1 -1
  17. data/lib/tickethub/supplier/payment.rb +0 -1
  18. data/lib/tickethub/supplier/reseller.rb +0 -2
  19. data/lib/tickethub/supplier/source/alipay.rb +1 -1
  20. data/lib/tickethub/supplier/source/bitcoin.rb +1 -1
  21. data/lib/tickethub/supplier/source/card.rb +1 -1
  22. data/lib/tickethub/supplier.rb +0 -2
  23. data/lib/tickethub/user.rb +0 -4
  24. data/lib/tickethub/version.rb +1 -1
  25. data/lib/tickethub.rb +0 -2
  26. metadata +2 -41
  27. data/lib/tickethub/app/category.rb +0 -7
  28. data/lib/tickethub/app/subscription.rb +0 -11
  29. data/lib/tickethub/app.rb +0 -34
  30. data/lib/tickethub/reseller/answer.rb +0 -11
  31. data/lib/tickethub/reseller/booking.rb +0 -40
  32. data/lib/tickethub/reseller/channel.rb +0 -15
  33. data/lib/tickethub/reseller/customer.rb +0 -11
  34. data/lib/tickethub/reseller/discount.rb +0 -12
  35. data/lib/tickethub/reseller/extra.rb +0 -12
  36. data/lib/tickethub/reseller/fee.rb +0 -15
  37. data/lib/tickethub/reseller/invoice.rb +0 -7
  38. data/lib/tickethub/reseller/option.rb +0 -14
  39. data/lib/tickethub/reseller/order.rb +0 -38
  40. data/lib/tickethub/reseller/payment/credit.rb +0 -7
  41. data/lib/tickethub/reseller/payment/stripe.rb +0 -11
  42. data/lib/tickethub/reseller/payment.rb +0 -29
  43. data/lib/tickethub/reseller/product.rb +0 -35
  44. data/lib/tickethub/reseller/purchase.rb +0 -19
  45. data/lib/tickethub/reseller/question.rb +0 -11
  46. data/lib/tickethub/reseller/refund.rb +0 -16
  47. data/lib/tickethub/reseller/scan.rb +0 -15
  48. data/lib/tickethub/reseller/source/alipay.rb +0 -7
  49. data/lib/tickethub/reseller/source/bitcoin.rb +0 -7
  50. data/lib/tickethub/reseller/source/card.rb +0 -9
  51. data/lib/tickethub/reseller/source.rb +0 -11
  52. data/lib/tickethub/reseller/supplier.rb +0 -19
  53. data/lib/tickethub/reseller/tax.rb +0 -16
  54. data/lib/tickethub/reseller/ticket.rb +0 -24
  55. data/lib/tickethub/reseller/tier.rb +0 -19
  56. data/lib/tickethub/reseller/user.rb +0 -9
  57. data/lib/tickethub/reseller/variant.rb +0 -10
  58. data/lib/tickethub/reseller.rb +0 -82
  59. data/lib/tickethub/supplier/app.rb +0 -5
  60. data/lib/tickethub/supplier/charge/gateway.rb +0 -7
  61. data/lib/tickethub/supplier/charge/service.rb +0 -7
  62. data/lib/tickethub/supplier/payment/complimentary.rb +0 -7
  63. data/lib/tickethub/supplier/subscription.rb +0 -13
  64. data/lib/tickethub/user/app.rb +0 -7
  65. data/lib/tickethub/user/reseller.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8d64f4b2e07524add61874e1152faadaec42b66
4
- data.tar.gz: 9f7726beb59ce660b00f8d890fd03dd867deecc5
3
+ metadata.gz: 433a02361c6c852967e3faa7796fc0e920df5bd8
4
+ data.tar.gz: a998a97a94c7b25b938a8ab0394c476ec836df76
5
5
  SHA512:
6
- metadata.gz: e9c450d835279f9e79c99e41fc3cdf3e63193d4532b937433b3bcfaa9523d680c5f40128062829e605a5d978bb308d82f78021b909acb8d9fa415500f4092f71
7
- data.tar.gz: 4d08e6d2ea3f01b4aac9d866013459e0f54d61dd2e711d6d92024c13658c85933dca8e8cee0a959946ec8b81832ccdf05cb03210e17690d3bc432cd524129228
6
+ metadata.gz: d52ac5a9afb737fa1cda4c34d08f16466caf14636672e328be99e88fae7d29623e31b891f6acf0c23363180f1650fee0cc122882bacd7d3ac0c43b462a1526cd
7
+ data.tar.gz: cb530e1d9235c209222e9f27532c620ab4ebd453ee0f57498759b401f00eac489df20a26f6de16d8d3542c124b34551ac9e6b721eb64e5cd2580ee3120680e99
@@ -3,6 +3,6 @@ require_relative '../payment'
3
3
  module Tickethub
4
4
  class Channel::Payment::Paypal < Channel::Payment
5
5
  path '/channel/payments/paypal'
6
- polymorphic 'paypal'
6
+ polymorphic 'PaypalPayment', :paypal
7
7
  end
8
8
  end
@@ -3,6 +3,6 @@ require_relative '../payment'
3
3
  module Tickethub
4
4
  class Channel::Payment::Stripe < Channel::Payment
5
5
  path '/channel/payments/stripe'
6
- polymorphic 'stripe'
6
+ polymorphic 'StripePayment', :stripe
7
7
  end
8
8
  end
@@ -55,12 +55,12 @@ module Tickethub
55
55
  Tickethub::Collection.new Tickethub.endpoint[self.path], self, params
56
56
  end
57
57
 
58
- def self.polymorphic(type, attribute = :type)
59
- self.superclass.register_type type, self, attribute
58
+ def self.polymorphic(type, method, attribute = :type)
59
+ self.superclass.register_type type, method, self, attribute
60
60
  end
61
61
 
62
- def self.register_type(type, klass, attribute = :type) # klass, attribute
63
- self.registered_types[type] = { klass: klass, attribute: attribute }
62
+ def self.register_type(type, method, klass, attribute = :type) # klass, attribute
63
+ self.registered_types[method] = { type: type, klass: klass, attribute: attribute }
64
64
  end
65
65
 
66
66
  def self.attribute(key, options)
@@ -158,7 +158,7 @@ module Tickethub
158
158
  attributes ||= endpoint.get params
159
159
 
160
160
  klass = registered_types.find do |type, options|
161
- attributes[options[:attribute].to_s] == type
161
+ attributes[options[:attribute].to_s] == options[:type]
162
162
  end
163
163
 
164
164
  klass = klass ? klass[1][:klass] : self
@@ -186,8 +186,14 @@ module Tickethub
186
186
 
187
187
  def self.collection(key, klass, options = {}, &block)
188
188
  define_method key do |params = {}|
189
- Tickethub::Collection.new(@endpoint[key], klass, params, options).tap do |collection|
190
- collection.instance_eval &block if block
189
+ if @attributes[key.to_sym].is_a? Array
190
+ @attributes[key.to_sym].collect do |attrs|
191
+ klass.call(@endpoint[key], attrs, options)
192
+ end
193
+ else
194
+ Tickethub::Collection.new(@endpoint[key], klass, params, options).tap do |collection|
195
+ collection.instance_eval &block if block
196
+ end
191
197
  end
192
198
  end
193
199
  end
@@ -10,12 +10,11 @@ module Tickethub
10
10
  require_relative 'partner'
11
11
 
12
12
  association :partner, Supplier::Partner
13
-
14
13
  association :context, -> (endpoint, attributes) {
15
14
  case attributes['object']
16
- when 'refund' then Supplier::Refund.call(endpoint, attributes)
17
- when 'payment' then Supplier::Payment.call(endpoint, attributes)
18
- when 'adjustment' then Supplier::Adjustment.call(endpoint, attributes)
15
+ when 'Refund' then Supplier::Refund.call(endpoint, attributes)
16
+ when 'Payment' then Supplier::Payment.call(endpoint, attributes)
17
+ when 'Adjustment' then Supplier::Adjustment.call(endpoint, attributes)
19
18
  end
20
19
  }
21
20
 
@@ -2,6 +2,6 @@ require_relative '../message'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Message::Email < Supplier::Message
5
- polymorphic 'email'
5
+ polymorphic 'EmailMessage', :email
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../message'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Message::SMS < Supplier::Message
5
- polymorphic 'sms'
5
+ polymorphic 'SmsMessage', :sms
6
6
  end
7
7
  end
@@ -15,10 +15,10 @@ module Tickethub
15
15
 
16
16
  association :context, -> (endpoint, attributes, options = {}, params = {}) {
17
17
  case attributes['object']
18
- when 'booking' then Supplier::Booking.call(endpoint, attributes, options, params)
19
- when 'customer' then Supplier::Customer.call(endpoint, attributes, options, params)
20
- when 'order' then Supplier::Order.call(endpoint, attributes, options, params)
21
- when 'reseller' then Supplier::Reseller.call(endpoint, attributes, options, params)
18
+ when 'Booking' then Supplier::Booking.call(endpoint, attributes, options, params)
19
+ when 'Customer' then Supplier::Customer.call(endpoint, attributes, options, params)
20
+ when 'Order' then Supplier::Order.call(endpoint, attributes, options, params)
21
+ when 'Reseller' then Supplier::Reseller.call(endpoint, attributes, options, params)
22
22
  end
23
23
  }
24
24
 
@@ -11,7 +11,6 @@ module Tickethub
11
11
  require_relative 'reseller'
12
12
  require_relative 'customer'
13
13
 
14
- require_relative 'app'
15
14
  require_relative 'user'
16
15
  require_relative 'answer'
17
16
  require_relative 'message'
@@ -32,7 +31,6 @@ module Tickethub
32
31
  association :reseller, Supplier::Reseller
33
32
  association :customer, Supplier::Customer
34
33
 
35
- association :app, Supplier::App
36
34
  association :user, Supplier::User
37
35
  association :session, Supplier::Session
38
36
  association :address, Tickethub::Address
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Cash < Supplier::Payment
5
- polymorphic 'cash'
5
+ polymorphic 'CashPayment', :cash
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Credit < Supplier::Payment
5
- polymorphic 'credit'
5
+ polymorphic 'CreditPayment', :credit
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Direct < Supplier::Payment
5
- polymorphic 'direct'
5
+ polymorphic 'DirectPayment', :direct
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Handpoint < Supplier::Payment
5
- polymorphic 'handpoint'
5
+ polymorphic 'HandpointPayment', :handpoint
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Paypal < Supplier::Payment
5
- polymorphic 'paypal'
5
+ polymorphic 'PaypalPayment', :paypal
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Spreedly < Supplier::Payment
5
- polymorphic 'spreedly'
5
+ polymorphic 'SpreedlyPayment', :spreedly
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@ require_relative '../payment'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Payment::Stripe < Supplier::Payment
5
- polymorphic 'stripe'
5
+ polymorphic 'StripePayment', :stripe
6
6
 
7
7
  require_relative '../source'
8
8
  require_relative '../dispute'
@@ -14,7 +14,6 @@ module Tickethub
14
14
  require_relative 'payment/paypal'
15
15
  require_relative 'payment/spreedly'
16
16
  require_relative 'payment/handpoint'
17
- require_relative 'payment/complimentary'
18
17
 
19
18
  require_relative 'partner'
20
19
  require_relative 'order'
@@ -4,7 +4,6 @@ module Tickethub
4
4
  class Supplier::Reseller < Resource
5
5
  path '/supplier/resellers'
6
6
 
7
- require_relative 'user'
8
7
  require_relative 'invoice'
9
8
  require_relative 'product'
10
9
  require_relative 'message'
@@ -22,7 +21,6 @@ module Tickethub
22
21
  collection :products, Supplier::Product
23
22
  collection :messages, Supplier::Message
24
23
  collection :rates, Supplier::Rate
25
- collection :users, Supplier::User, shallow: false
26
24
 
27
25
  association :contact, Tickethub::Contact
28
26
  association :address, Tickethub::Address
@@ -2,6 +2,6 @@ require_relative '../source'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Source::Alipay < Supplier::Source
5
- polymorphic 'alipay'
5
+ polymorphic 'AlipaySource', :alipay
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ require_relative '../source'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Source::Bitcoin < Supplier::Source
5
- polymorphic 'bitcoin'
5
+ polymorphic 'BitcoinSource', :bitcoin
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@ require_relative '../source'
2
2
 
3
3
  module Tickethub
4
4
  class Supplier::Source::Card < Supplier::Source
5
- polymorphic 'card'
5
+ polymorphic 'CardSource', :card
6
6
 
7
7
  attribute :country, type: :country
8
8
  end
@@ -10,7 +10,6 @@ module Tickethub
10
10
  require_relative 'supplier/ticket'
11
11
  require_relative 'supplier/extra'
12
12
  require_relative 'supplier/product'
13
- require_relative 'supplier/subscription'
14
13
  require_relative 'supplier/season'
15
14
  require_relative 'supplier/option'
16
15
  require_relative 'supplier/variant'
@@ -45,7 +44,6 @@ module Tickethub
45
44
  collection :tickets, Ticket
46
45
  collection :extras, Extra
47
46
  collection :products, Product
48
- collection :subscriptions, Subscription
49
47
  collection :seasons, Season
50
48
  collection :options, Option
51
49
  collection :variants, Variant
@@ -2,12 +2,8 @@ module Tickethub
2
2
  class User < Resource
3
3
  path '/user', singleton: true
4
4
 
5
- require_relative 'user/app'
6
- require_relative 'user/reseller'
7
5
  require_relative 'user/supplier'
8
6
 
9
- collection :apps, User::App
10
- collection :resellers, User::Reseller
11
7
  collection :suppliers, User::Supplier
12
8
 
13
9
  association :token, Tickethub::Token
@@ -1,3 +1,3 @@
1
1
  module Tickethub
2
- VERSION = '0.3.67'
2
+ VERSION = '0.3.68'
3
3
  end
data/lib/tickethub.rb CHANGED
@@ -25,7 +25,5 @@ module Tickethub
25
25
  require_relative 'tickethub/token'
26
26
  require_relative 'tickethub/supplier'
27
27
  require_relative 'tickethub/channel'
28
- require_relative 'tickethub/reseller'
29
- require_relative 'tickethub/app'
30
28
  require_relative 'tickethub/user'
31
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tickethub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.67
4
+ version: 0.3.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,9 +92,6 @@ files:
92
92
  - lib/tickethub.rb
93
93
  - lib/tickethub/address.rb
94
94
  - lib/tickethub/aggregate.rb
95
- - lib/tickethub/app.rb
96
- - lib/tickethub/app/category.rb
97
- - lib/tickethub/app/subscription.rb
98
95
  - lib/tickethub/channel.rb
99
96
  - lib/tickethub/channel/answer.rb
100
97
  - lib/tickethub/channel/booking.rb
@@ -129,48 +126,16 @@ files:
129
126
  - lib/tickethub/formats/json_format.rb
130
127
  - lib/tickethub/helpers.rb
131
128
  - lib/tickethub/request.rb
132
- - lib/tickethub/reseller.rb
133
- - lib/tickethub/reseller/answer.rb
134
- - lib/tickethub/reseller/booking.rb
135
- - lib/tickethub/reseller/channel.rb
136
- - lib/tickethub/reseller/customer.rb
137
- - lib/tickethub/reseller/discount.rb
138
- - lib/tickethub/reseller/extra.rb
139
- - lib/tickethub/reseller/fee.rb
140
- - lib/tickethub/reseller/invoice.rb
141
- - lib/tickethub/reseller/option.rb
142
- - lib/tickethub/reseller/order.rb
143
- - lib/tickethub/reseller/payment.rb
144
- - lib/tickethub/reseller/payment/credit.rb
145
- - lib/tickethub/reseller/payment/stripe.rb
146
- - lib/tickethub/reseller/product.rb
147
- - lib/tickethub/reseller/purchase.rb
148
- - lib/tickethub/reseller/question.rb
149
- - lib/tickethub/reseller/refund.rb
150
- - lib/tickethub/reseller/scan.rb
151
- - lib/tickethub/reseller/source.rb
152
- - lib/tickethub/reseller/source/alipay.rb
153
- - lib/tickethub/reseller/source/bitcoin.rb
154
- - lib/tickethub/reseller/source/card.rb
155
- - lib/tickethub/reseller/supplier.rb
156
- - lib/tickethub/reseller/tax.rb
157
- - lib/tickethub/reseller/ticket.rb
158
- - lib/tickethub/reseller/tier.rb
159
- - lib/tickethub/reseller/user.rb
160
- - lib/tickethub/reseller/variant.rb
161
129
  - lib/tickethub/resource.rb
162
130
  - lib/tickethub/response.rb
163
131
  - lib/tickethub/response/headers.rb
164
132
  - lib/tickethub/supplier.rb
165
133
  - lib/tickethub/supplier/adjustment.rb
166
134
  - lib/tickethub/supplier/answer.rb
167
- - lib/tickethub/supplier/app.rb
168
135
  - lib/tickethub/supplier/booking.rb
169
136
  - lib/tickethub/supplier/broadcast.rb
170
137
  - lib/tickethub/supplier/channel.rb
171
138
  - lib/tickethub/supplier/charge.rb
172
- - lib/tickethub/supplier/charge/gateway.rb
173
- - lib/tickethub/supplier/charge/service.rb
174
139
  - lib/tickethub/supplier/coupon.rb
175
140
  - lib/tickethub/supplier/customer.rb
176
141
  - lib/tickethub/supplier/discount.rb
@@ -188,7 +153,6 @@ files:
188
153
  - lib/tickethub/supplier/partner.rb
189
154
  - lib/tickethub/supplier/payment.rb
190
155
  - lib/tickethub/supplier/payment/cash.rb
191
- - lib/tickethub/supplier/payment/complimentary.rb
192
156
  - lib/tickethub/supplier/payment/credit.rb
193
157
  - lib/tickethub/supplier/payment/direct.rb
194
158
  - lib/tickethub/supplier/payment/handpoint.rb
@@ -208,7 +172,6 @@ files:
208
172
  - lib/tickethub/supplier/source/alipay.rb
209
173
  - lib/tickethub/supplier/source/bitcoin.rb
210
174
  - lib/tickethub/supplier/source/card.rb
211
- - lib/tickethub/supplier/subscription.rb
212
175
  - lib/tickethub/supplier/tax.rb
213
176
  - lib/tickethub/supplier/ticket.rb
214
177
  - lib/tickethub/supplier/tier.rb
@@ -217,8 +180,6 @@ files:
217
180
  - lib/tickethub/supplier/variant.rb
218
181
  - lib/tickethub/token.rb
219
182
  - lib/tickethub/user.rb
220
- - lib/tickethub/user/app.rb
221
- - lib/tickethub/user/reseller.rb
222
183
  - lib/tickethub/user/supplier.rb
223
184
  - lib/tickethub/version.rb
224
185
  - tickethub.gemspec
@@ -1,7 +0,0 @@
1
- module Tickethub
2
- class App::Category < Resource
3
- path '/apps/categories'
4
-
5
- collection :apps, Tickethub::App
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class App::Subscription < Resource
5
- path '/app/subscriptions'
6
-
7
- require_relative '../app'
8
-
9
- association :app, Tickethub::App
10
- end
11
- end
data/lib/tickethub/app.rb DELETED
@@ -1,34 +0,0 @@
1
- module Tickethub
2
- class App < Resource
3
- path '/apps'
4
-
5
- require_relative 'contact'
6
- require_relative 'app/category'
7
- require_relative 'app/subscription'
8
-
9
- association :contact, Tickethub::Contact
10
- association :token, Tickethub::Token
11
-
12
- association :category, App::Category
13
- collection :subscriptions, App::Subscription
14
-
15
- attribute :currency, type: :currency
16
-
17
- def self.[](attributes)
18
- token = attributes[:token].is_a?(String) ? attributes[:token]
19
- : attributes[:token][:access_token]
20
- self.new Tickethub.endpoint(auth_type: :bearer, password: token)['/app']
21
- end
22
-
23
- def initialize(endpoint, attributes = nil)
24
- attributes ||= endpoint.get
25
-
26
- if attributes['token']
27
- endpoint = Tickethub.endpoint(auth_type: :bearer,
28
- password: attributes['token']['access_token'])[self.class.path]
29
- end
30
-
31
- super(endpoint, attributes)
32
- end
33
- end
34
- end
@@ -1,11 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Answer < Resource
5
- path '/reseller/answers'
6
-
7
- require_relative 'question'
8
-
9
- association :question, Reseller::Question
10
- end
11
- end
@@ -1,40 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Booking < Resource
5
- path '/reseller/bookings'
6
-
7
- require_relative 'order'
8
- require_relative 'answer'
9
- require_relative 'product'
10
- require_relative 'variant'
11
- require_relative 'purchase'
12
- require_relative 'discount'
13
- require_relative 'fee'
14
- require_relative 'tier'
15
- require_relative 'ticket'
16
-
17
- collection :answers, Reseller::Answer
18
- collection :purchases, Reseller::Purchase
19
- collection :fees, Reseller::Fee
20
- collection :tiers, Reseller::Tier
21
- collection :tickets, Reseller::Ticket
22
- collection :discounts, Reseller::Discount
23
-
24
- association :order, Reseller::Order
25
- association :product, Reseller::Product
26
- association :variant, Reseller::Variant
27
-
28
- attribute :expires_on, type: :date
29
- attribute :valid_from, type: :datetime
30
-
31
- attribute :amount, type: :money
32
- attribute :discount, type: :money
33
- attribute :tax, type: :money
34
- attribute :total, type: :money
35
-
36
- attribute :created_at, type: :datetime
37
- attribute :updated_at, type: :datetime
38
- attribute :cancelled_at, type: :datetime
39
- end
40
- end
@@ -1,15 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Channel < Resource
5
- path '/reseller/channels'
6
-
7
- require_relative 'product'
8
- require_relative '../token'
9
-
10
- association :product, Reseller::Product
11
-
12
- attribute :updated_at, type: :datetime
13
- attribute :created_at, type: :datetime
14
- end
15
- end
@@ -1,11 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Customer < Resource
5
- path '/reseller/customers'
6
-
7
- require_relative '../address'
8
-
9
- association :address, Tickethub::Address
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Discount < Resource
5
- path '/reseller/discounts'
6
-
7
- attribute :amount, type: :money
8
-
9
- attribute :created_at, type: :datetime
10
- attribute :updated_at, type: :datetime
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Extra < Resource
5
- path '/reseller/extras'
6
-
7
- attribute :price, type: :money
8
-
9
- attribute :created_at, type: :datetime
10
- attribute :updated_at, type: :datetime
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Fee < Resource
5
- path '/reseller/fees'
6
-
7
- require_relative 'tax'
8
- require_relative 'booking'
9
-
10
- association :tax, Reseller::Tax
11
- association :booking, Reseller::Booking
12
-
13
- attribute :amount, type: :money
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Invoice < Resource
5
- path '/reseller/invoices'
6
- end
7
- end
@@ -1,14 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Option < Resource
5
- path '/reseller/options'
6
-
7
- scope :dates, -> (params) { @endpoint[:dates].get(params).decoded }
8
-
9
- attribute :date_time, type: :datetime
10
-
11
- attribute :time, type: :time
12
- attribute :total, type: :money
13
- end
14
- end
@@ -1,38 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Order < Resource
5
- path '/reseller/orders'
6
-
7
- require_relative 'customer'
8
- require_relative 'booking'
9
- require_relative 'payment'
10
-
11
- require_relative 'customer'
12
- require_relative 'user'
13
-
14
- require_relative 'answer'
15
- require_relative '../address'
16
-
17
- collection :bookings, Reseller::Booking
18
- collection :payments, Reseller::Payment
19
- collection :answers, Reseller::Answer
20
-
21
- association :customer, Reseller::Customer
22
- association :user, Reseller::User
23
- association :address, Tickethub::Address
24
-
25
- attribute :total, type: :money
26
- attribute :balance, type: :money
27
- attribute :currency, type: :currency
28
-
29
- attribute :expires_at, type: :datetime
30
- attribute :confirmed_at, type: :datetime
31
- attribute :created_at, type: :datetime
32
- attribute :updated_at, type: :datetime
33
-
34
- def confirm(params = {})
35
- self.load @endpoint[:confirm].post(params)
36
- end
37
- end
38
- end
@@ -1,7 +0,0 @@
1
- require_relative '../payment'
2
-
3
- module Tickethub
4
- class Reseller::Payment::Credit < Reseller::Payment
5
- polymorphic 'credit'
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- require_relative '../payment'
2
-
3
- module Tickethub
4
- class Reseller::Payment::Stripe < Reseller::Payment
5
- polymorphic 'stripe'
6
-
7
- require_relative '../source'
8
-
9
- association :source, Reseller::Source
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Payment < Resource
5
- path '/reseller/payments'
6
-
7
- require_relative 'refund'
8
-
9
- require_relative 'payment/credit'
10
- require_relative 'payment/stripe'
11
-
12
- require_relative 'order'
13
- require_relative 'user'
14
-
15
- association :order, Reseller::Order
16
- association :user, Reseller::User
17
-
18
- collection :refunds, Reseller::Refund
19
-
20
- attribute :amount, type: :money
21
- attribute :refunded, type: :money
22
- attribute :balance, type: :money
23
- attribute :refunded_at, type: :datetime
24
- attribute :confirmed_at, type: :datetime
25
-
26
- attribute :created_at, type: :datetime
27
- attribute :updated_at, type: :datetime
28
- end
29
- end
@@ -1,35 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Product < Resource
5
- path '/reseller/products'
6
-
7
- require_relative 'booking'
8
- require_relative 'extra'
9
- require_relative 'option'
10
- require_relative 'tier'
11
- require_relative 'variant'
12
- require_relative 'question'
13
- require_relative 'tax'
14
-
15
- require_relative '../contact'
16
- require_relative '../address'
17
-
18
- association :contact, Tickethub::Contact
19
- association :address, Tickethub::Address
20
-
21
- collection :bookings, Reseller::Booking
22
- collection :extras, Reseller::Extra
23
- collection :options, Reseller::Option
24
- collection :tiers, Reseller::Tier
25
- collection :variants, Reseller::Variant
26
- collection :questions, Reseller::Question
27
- collection :taxes, Reseller::Tax
28
-
29
- attribute :time_zone, type: :timezone
30
- attribute :currency, type: :currency
31
-
32
- attribute :created_at, type: :datetime
33
- attribute :updated_at, type: :datetime
34
- end
35
- end
@@ -1,19 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Purchase < Resource
5
- path '/reseller/purchases'
6
-
7
- require_relative 'booking'
8
- require_relative 'extra'
9
-
10
- association :booking, Reseller::Booking
11
- association :extra, Reseller::Extra
12
-
13
- attribute :price, type: :money
14
- attribute :total, type: :money
15
-
16
- attribute :updated_at, type: :datetime
17
- attribute :created_at, type: :datetime
18
- end
19
- end
@@ -1,11 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Question < Resource
5
- path '/reseller/questions'
6
-
7
- require_relative 'answer'
8
-
9
- collection :answers, Reseller::Answer
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Refund < Resource
5
- path '/reseller/refunds'
6
-
7
- require_relative 'payment'
8
-
9
- association :payment, Reseller::Payment
10
-
11
- attribute :amount, type: :money
12
-
13
- attribute :created_at, type: :datetime
14
- attribute :updated_at, type: :datetime
15
- end
16
- end
@@ -1,15 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Scan < Resource
5
- path '/reseller/scans'
6
-
7
- require_relative 'ticket'
8
-
9
- collection :tickets, Reseller::Ticket
10
-
11
- attribute :at, type: :datetime
12
- attribute :updated_at, type: :datetime
13
- attribute :created_at, type: :datetime
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- require_relative '../source'
2
-
3
- module Tickethub
4
- class Reseller::Source::Alipay < Reseller::Source
5
- polymorphic 'alipay'
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- require_relative '../source'
2
-
3
- module Tickethub
4
- class Reseller::Source::Bitcoin < Reseller::Source
5
- polymorphic 'bitcoin'
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- require_relative '../source'
2
-
3
- module Tickethub
4
- class Reseller::Source::Card < Reseller::Source
5
- polymorphic 'card'
6
-
7
- attribute :country, type: :country
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Source < Resource
5
- path '/reseller/sources'
6
-
7
- require_relative 'source/alipay'
8
- require_relative 'source/bitcoin'
9
- require_relative 'source/card'
10
- end
11
- end
@@ -1,19 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Supplier < Resource
5
- path '/reseller/suppliers'
6
-
7
- require_relative '../contact'
8
- require_relative '../address'
9
-
10
- association :contact, Tickethub::Contact
11
- association :address, Tickethub::Address
12
-
13
- attribute :time_zone, type: :timezone
14
- attribute :currency, type: :currency
15
-
16
- attribute :created_at, type: :datetime
17
- attribute :updated_at, type: :datetime
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Tax < Resource
5
- path '/reseller/taxes'
6
-
7
- require_relative 'fee'
8
- require_relative 'product'
9
-
10
- association :product, Reseller::Product
11
- collection :fees, Reseller::Fee
12
-
13
- attribute :updated_at, type: :datetime
14
- attribute :created_at, type: :datetime
15
- end
16
- end
@@ -1,24 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Ticket < Resource
5
- path '/reseller/tickets'
6
-
7
- require_relative 'booking'
8
- require_relative 'tier'
9
- require_relative 'scan'
10
-
11
- association :booking, Reseller::Booking
12
- association :tier, Reseller::Tier
13
-
14
- collection :scans, Reseller::Scan
15
-
16
- attribute :price, type: :money
17
- attribute :interval, type: :duration
18
-
19
- attribute :last_scan_at, type: :datetime
20
- attribute :expires_at, type: :datetime
21
- attribute :updated_at, type: :datetime
22
- attribute :created_at, type: :datetime
23
- end
24
- end
@@ -1,19 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Tier < Resource
5
- path '/reseller/tiers'
6
-
7
- require_relative 'product'
8
-
9
- association :product, Reseller::Product
10
-
11
- attribute :price, type: :money
12
-
13
- attribute :notice, type: :duration
14
- attribute :period, type: :duration
15
-
16
- attribute :interval, type: :duration
17
- attribute :duration, type: :duration
18
- end
19
- end
@@ -1,9 +0,0 @@
1
- module Tickethub
2
- class Reseller::User < Resource
3
- path '/reseller/users'
4
-
5
- def full_name
6
- [first_name, last_name].reject(&:nil?).join ' '
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Reseller::Variant < Resource
5
- path '/reseller/variants'
6
-
7
- require_relative 'product'
8
- association :product, Reseller::Product
9
- end
10
- end
@@ -1,82 +0,0 @@
1
- module Tickethub
2
- class Reseller < Resource
3
- path '/resellers'
4
-
5
- require_relative 'reseller/customer'
6
- require_relative 'reseller/order'
7
- require_relative 'reseller/booking'
8
- require_relative 'reseller/ticket'
9
- require_relative 'reseller/extra'
10
- require_relative 'reseller/product'
11
- require_relative 'reseller/option'
12
- require_relative 'reseller/variant'
13
- require_relative 'reseller/tier'
14
-
15
- require_relative 'reseller/invoice'
16
- require_relative 'reseller/payment'
17
- require_relative 'reseller/user'
18
- require_relative 'reseller/question'
19
- require_relative 'reseller/answer'
20
- require_relative 'reseller/tax'
21
- require_relative 'reseller/fee'
22
- require_relative 'reseller/source'
23
- require_relative 'reseller/discount'
24
-
25
- require_relative 'contact'
26
- require_relative 'address'
27
- require_relative 'token'
28
- require_relative 'supplier'
29
-
30
- collection :customers, Customer
31
- collection :orders, Order
32
- collection :bookings, Booking
33
- collection :tickets, Ticket
34
- collection :extras, Extra
35
- collection :products, Product
36
- collection :options, Option
37
- collection :variants, Variant
38
- collection :tiers, Tier
39
- collection :invoices, Invoice
40
- collection :payments, Payment
41
- collection :users, User
42
- collection :questions, Question
43
- collection :answers, Answer
44
- collection :taxes, Tax
45
- collection :fees, Fee
46
- collection :sources, Source
47
- collection :discount, Discount
48
-
49
- association :contact, Tickethub::Contact
50
- association :address, Tickethub::Address
51
- association :supplier, Tickethub::Supplier
52
- association :token, Tickethub::Token
53
-
54
- attribute :period, type: :duration
55
- attribute :notice, type: :duration
56
- attribute :currency, type: :currency
57
-
58
- attribute :limit, type: :money
59
- attribute :balance, type: :money
60
- attribute :overdue, type: :money
61
-
62
- attribute :next_invoice_date, type: :date
63
- attribute :first_invoice_date, type: :date
64
-
65
- def self.[](attributes)
66
- token = attributes[:token].is_a?(String) ? attributes[:token]
67
- : attributes[:token][:access_token]
68
- self.new Tickethub.endpoint(auth_type: :bearer, password: token)['/reseller']
69
- end
70
-
71
- def initialize(endpoint, attributes = nil)
72
- attributes ||= endpoint.get
73
-
74
- if attributes['token']
75
- endpoint = Tickethub.endpoint(auth_type: :bearer,
76
- password: attributes['token']['access_token'])[self.class.path]
77
- end
78
-
79
- super(endpoint, attributes)
80
- end
81
- end
82
- end
@@ -1,5 +0,0 @@
1
- module Tickethub
2
- class Supplier::App < Resource
3
- path '/apps'
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- require_relative '../charge'
2
-
3
- module Tickethub
4
- class Supplier::Charge::Gateway < Supplier::Charge
5
- polymorphic 'gateway'
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- require_relative '../charge'
2
-
3
- module Tickethub
4
- class Supplier::Charge::Service < Supplier::Charge
5
- polymorphic 'service'
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- require_relative '../payment'
2
-
3
- module Tickethub
4
- class Supplier::Payment::Complimentary < Supplier::Payment
5
- polymorphic 'complimentary'
6
- end
7
- end
@@ -1,13 +0,0 @@
1
- require_relative '../resource'
2
-
3
- module Tickethub
4
- class Supplier::Subscription < Resource
5
- path '/supplier/subscriptions'
6
-
7
- require_relative 'app'
8
- require_relative '../token'
9
-
10
- association :app, Supplier::App
11
- association :token, Token
12
- end
13
- end
@@ -1,7 +0,0 @@
1
- require_relative '../app'
2
-
3
- module Tickethub
4
- class User::App < Tickethub::App
5
- path '/user/apps'
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- require_relative '../reseller'
2
-
3
- module Tickethub
4
- class User::Reseller < Tickethub::Reseller
5
- path '/user/resellers'
6
- end
7
- end