tickethub 0.3.46 → 0.3.47

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc018e22e67f81cdf915853457637b6d8c61f9eb
4
- data.tar.gz: 8f3f1efd35232c5869c4eae81f76d5726efa4ad2
3
+ metadata.gz: 6f9490ec675bb11e4286e8b2ed5229aa3ca2f27e
4
+ data.tar.gz: 86f8e0e5c5e6dfc423ef350c77f7830439a1e31c
5
5
  SHA512:
6
- metadata.gz: 0eac721ed4c2835eabdb395bc30ba031aba256187da910d7e54c963b1a800498a048015dea4d6e438e6083df4fe7b0487d5be3b53cd374a7ef7d78cf3c5cfee6
7
- data.tar.gz: 37b4988ddc5740e7e8fe2faf74e3463dbb6963409c7e122a12501b7dedafad1dc0148cb04b49ef0b3f8b899051082332a01a1176c220068513823a741431c37e
6
+ metadata.gz: 2d0d65df4ca0bfa01b163941a5931217e9e3dac7e6246b6b7bd28d577a1847c76a15bc40a2cf5553ad97c4a596a9b29b1c551156614998b4d9a7673fd4df0bb4
7
+ data.tar.gz: a9370faa8a6f15c064f944d05873399936f09c018e39d71eadad2d9595eef94fd815c90ff585f5e3e578b35ba980aefdb161a1ca1c5489a42e5b8bb0611263dd
@@ -0,0 +1,50 @@
1
+ module Tickethub
2
+ class Channel < Resource
3
+ path '/channel', singleton: true
4
+
5
+ require_relative 'channel/voucher'
6
+ require_relative 'channel/coupon'
7
+ require_relative 'channel/tier'
8
+ require_relative 'channel/variant'
9
+ require_relative 'channel/extra'
10
+ require_relative 'channel/question'
11
+ require_relative 'channel/booking'
12
+ require_relative 'channel/order'
13
+ require_relative 'channel/payment'
14
+ require_relative 'channel/option'
15
+
16
+ require_relative 'channel/product'
17
+ require_relative 'channel/supplier'
18
+
19
+ collection :vouchers, Voucher
20
+ collection :coupons, Coupon
21
+ collection :tiers, Tier
22
+ collection :variants, Variant
23
+ collection :extras, Extra
24
+ collection :questions, Question
25
+ collection :bookings, Booking
26
+ collection :orders, Order
27
+ collection :payments, Payment
28
+ collection :options, Option
29
+
30
+ association :product, Product
31
+ association :supplier, Supplier
32
+
33
+ def self.[](attributes)
34
+ token = attributes[:token].is_a?(String) ? attributes[:token]
35
+ : attributes[:token][:access_token]
36
+ self.call Tickethub.endpoint(auth_type: :bearer, password: token)[path]
37
+ end
38
+
39
+ def initialize(endpoint, attributes = nil)
40
+ attributes ||= endpoint.get
41
+
42
+ if attributes['token']
43
+ endpoint = Tickethub.endpoint(auth_type: :bearer,
44
+ password: attributes['token']['access_token'])[self.class.path]
45
+ end
46
+
47
+ super(endpoint, attributes)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,11 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Answer < Resource
5
+ path '/channel/answers'
6
+
7
+ require_relative 'question'
8
+
9
+ association :question, Channel::Question
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Booking < Resource
5
+ path '/channel/bookings'
6
+
7
+ require_relative 'booking/ticket'
8
+ require_relative 'booking/voucher'
9
+
10
+ require_relative 'order'
11
+ require_relative 'answer'
12
+ require_relative 'product'
13
+ require_relative 'variant'
14
+ require_relative 'purchase'
15
+ require_relative 'discount'
16
+ require_relative 'fee'
17
+ require_relative 'tier'
18
+
19
+ collection :answers, Channel::Answer
20
+ collection :purchases, Channel::Purchase
21
+ collection :fees, Channel::Fee
22
+ collection :tiers, Channel::Tier
23
+ collection :discounts, Channel::Discount
24
+
25
+ association :order, Channel::Order
26
+ association :product, Channel::Product
27
+ association :variant, Channel::Variant
28
+
29
+ attribute :amount, type: :money
30
+ attribute :discount, type: :money
31
+ attribute :tax, type: :money
32
+ attribute :total, type: :money
33
+
34
+ attribute :created_at, type: :datetime
35
+ attribute :updated_at, type: :datetime
36
+ attribute :cancelled_at, type: :datetime
37
+ end
38
+ end
@@ -0,0 +1,13 @@
1
+ require_relative '../booking'
2
+
3
+ module Tickethub
4
+ class Channel::Booking::Ticket < Channel::Booking
5
+ polymorphic 'ticket'
6
+
7
+ require_relative '../ticket'
8
+
9
+ collection :tickets, Channel::Ticket
10
+
11
+ attribute :valid_from, type: :datetime
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_relative '../booking'
2
+
3
+ module Tickethub
4
+ class Channel::Booking::Voucher < Channel::Booking
5
+ polymorphic 'voucher'
6
+
7
+ require_relative '../voucher'
8
+
9
+ collection :vouchers, Channel::Voucher
10
+
11
+ attribute :expires_on, type: :date
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Coupon < Resource
5
+ path '/channel/coupons'
6
+
7
+ require_relative 'booking'
8
+
9
+ collection :bookings, Channel::Booking
10
+
11
+ attribute :valid_from, type: :date
12
+ attribute :expires_on, type: :date
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Customer < Resource
5
+ path '/channel/customers'
6
+
7
+ require_relative '../address'
8
+
9
+ association :address, Tickethub::Address
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Discount < Resource
5
+ path '/channel/discounts'
6
+
7
+ attribute :amount, type: :money
8
+
9
+ attribute :created_at, type: :datetime
10
+ attribute :updated_at, type: :datetime
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Extra < Resource
5
+ path '/channel/extras'
6
+
7
+ attribute :price, type: :money
8
+
9
+ attribute :created_at, type: :datetime
10
+ attribute :updated_at, type: :datetime
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Fee < Resource
5
+ path '/channel/fees'
6
+
7
+ require_relative 'tax'
8
+ require_relative 'booking'
9
+
10
+ association :tax, Channel::Tax
11
+ association :booking, Channel::Booking
12
+
13
+ attribute :amount, type: :money
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Option < Resource
5
+ path '/channel/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
@@ -0,0 +1,38 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Order < Resource
5
+ path '/channel/orders'
6
+
7
+ require_relative 'customer'
8
+ require_relative 'booking'
9
+ require_relative 'payment'
10
+
11
+ require_relative 'customer'
12
+ require_relative 'session'
13
+
14
+ require_relative 'answer'
15
+ require_relative '../address'
16
+
17
+ collection :bookings, Channel::Booking
18
+ collection :payments, Channel::Payment
19
+ collection :answers, Channel::Answer
20
+
21
+ association :customer, Channel::Customer
22
+ association :session, Channel::Session
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
@@ -0,0 +1,27 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Payment < Resource
5
+ path '/channel/payments'
6
+
7
+ require_relative 'refund'
8
+
9
+ require_relative 'payment/paypal'
10
+ require_relative 'payment/stripe'
11
+
12
+ require_relative 'order'
13
+
14
+ association :order, Channel::Order
15
+
16
+ collection :refunds, Channel::Refund
17
+
18
+ attribute :amount, type: :money
19
+ attribute :refunded, type: :money
20
+ attribute :balance, type: :money
21
+ attribute :refunded_at, type: :datetime
22
+ attribute :confirmed_at, type: :datetime
23
+
24
+ attribute :created_at, type: :datetime
25
+ attribute :updated_at, type: :datetime
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ require_relative '../payment'
2
+
3
+ module Tickethub
4
+ class Channel::Payment::Paypal < Channel::Payment
5
+ path '/channel/payments/paypal'
6
+ polymorphic 'paypal'
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require_relative '../payment'
2
+
3
+ module Tickethub
4
+ class Channel::Payment::Stripe < Channel::Payment
5
+ path '/channel/payments/stripe'
6
+ polymorphic 'stripe'
7
+ end
8
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Product < Resource
5
+ path '/channel/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, Channel::Booking
22
+ collection :extras, Channel::Extra
23
+ collection :options, Channel::Option
24
+ collection :tiers, Channel::Tier
25
+ collection :variants, Channel::Variant
26
+ collection :questions, Channel::Question
27
+ collection :taxes, Channel::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
@@ -0,0 +1,18 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Purchase < Resource
5
+ path '/channel/purchases'
6
+
7
+ require_relative 'booking'
8
+ require_relative 'extra'
9
+
10
+ association :booking, Channel::Booking
11
+ association :extra, Channel::Extra
12
+
13
+ attribute :price, type: :money
14
+
15
+ attribute :updated_at, type: :datetime
16
+ attribute :created_at, type: :datetime
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Question < Resource
5
+ path '/channel/questions'
6
+
7
+ require_relative 'answer'
8
+
9
+ collection :answers, Channel::Answer
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Refund < Resource
5
+ path '/channel/refunds'
6
+
7
+ require_relative 'payment'
8
+
9
+ association :payment, Channel::Payment
10
+
11
+ attribute :amount, type: :money
12
+
13
+ attribute :created_at, type: :datetime
14
+ attribute :updated_at, type: :datetime
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Session < Resource
5
+ path '/channel/sessions'
6
+
7
+ attribute :updated_at, type: :datetime
8
+ attribute :created_at, type: :datetime
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Supplier < Resource
5
+ path '/channel/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
@@ -0,0 +1,14 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Tax < Resource
5
+ path '/channel/taxes'
6
+
7
+ require_relative 'fee'
8
+
9
+ collection :fees, Channel::Fee
10
+
11
+ attribute :updated_at, type: :datetime
12
+ attribute :created_at, type: :datetime
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Ticket < Resource
5
+ path '/channel/tickets'
6
+
7
+ require_relative 'booking'
8
+ require_relative 'tier'
9
+ require_relative 'voucher'
10
+
11
+ association :booking, Channel::Booking
12
+ association :tier, Channel::Tier
13
+ association :voucher, Channel::Voucher
14
+
15
+ attribute :price, type: :money
16
+ attribute :interval, type: :duration
17
+
18
+ attribute :last_scan_at, type: :datetime
19
+ attribute :expires_at, type: :datetime
20
+ attribute :updated_at, type: :datetime
21
+ attribute :created_at, type: :datetime
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Tier < Resource
5
+ path '/channel/tiers'
6
+
7
+ attribute :price, type: :money
8
+
9
+ attribute :notice, type: :duration
10
+ attribute :period, type: :duration
11
+
12
+ attribute :interval, type: :duration
13
+ attribute :duration, type: :duration
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Variant < Resource
5
+ path '/channel/variants'
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../resource'
2
+
3
+ module Tickethub
4
+ class Channel::Voucher < Resource
5
+ path '/channel/vouchers'
6
+
7
+ require_relative 'tier'
8
+ require_relative 'booking'
9
+
10
+ association :tier, Channel::Tier
11
+ association :booking, Channel::Booking
12
+
13
+ attribute :price, type: :money
14
+ attribute :total, type: :money
15
+
16
+ attribute :created_at, type: :datetime
17
+ attribute :updated_at, type: :datetime
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Tickethub
2
- VERSION = '0.3.46'
2
+ VERSION = '0.3.47'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tickethub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.46
4
+ version: 0.3.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Morgan
@@ -94,6 +94,32 @@ files:
94
94
  - lib/tickethub/app.rb
95
95
  - lib/tickethub/app/category.rb
96
96
  - lib/tickethub/app/subscription.rb
97
+ - lib/tickethub/channel.rb
98
+ - lib/tickethub/channel/answer.rb
99
+ - lib/tickethub/channel/booking.rb
100
+ - lib/tickethub/channel/booking/ticket.rb
101
+ - lib/tickethub/channel/booking/voucher.rb
102
+ - lib/tickethub/channel/coupon.rb
103
+ - lib/tickethub/channel/customer.rb
104
+ - lib/tickethub/channel/discount.rb
105
+ - lib/tickethub/channel/extra.rb
106
+ - lib/tickethub/channel/fee.rb
107
+ - lib/tickethub/channel/option.rb
108
+ - lib/tickethub/channel/order.rb
109
+ - lib/tickethub/channel/payment.rb
110
+ - lib/tickethub/channel/payment/paypal.rb
111
+ - lib/tickethub/channel/payment/stripe.rb
112
+ - lib/tickethub/channel/product.rb
113
+ - lib/tickethub/channel/purchase.rb
114
+ - lib/tickethub/channel/question.rb
115
+ - lib/tickethub/channel/refund.rb
116
+ - lib/tickethub/channel/session.rb
117
+ - lib/tickethub/channel/supplier.rb
118
+ - lib/tickethub/channel/tax.rb
119
+ - lib/tickethub/channel/ticket.rb
120
+ - lib/tickethub/channel/tier.rb
121
+ - lib/tickethub/channel/variant.rb
122
+ - lib/tickethub/channel/voucher.rb
97
123
  - lib/tickethub/collection.rb
98
124
  - lib/tickethub/connection.rb
99
125
  - lib/tickethub/contact.rb