tickethub 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/lib/tickethub/address.rb +5 -0
- data/lib/tickethub/app/package.rb +9 -0
- data/lib/tickethub/app/subscription.rb +11 -0
- data/lib/tickethub/app.rb +36 -0
- data/lib/tickethub/category.rb +7 -0
- data/lib/tickethub/collection.rb +150 -0
- data/lib/tickethub/connection.rb +140 -0
- data/lib/tickethub/contact.rb +5 -0
- data/lib/tickethub/endpoint.rb +36 -0
- data/lib/tickethub/errors.rb +34 -0
- data/lib/tickethub/exceptions.rb +73 -0
- data/lib/tickethub/formats/form_format.rb +17 -0
- data/lib/tickethub/formats/json_format.rb +25 -0
- data/lib/tickethub/formats.rb +35 -0
- data/lib/tickethub/helpers.rb +108 -0
- data/lib/tickethub/request.rb +130 -0
- data/lib/tickethub/resource.rb +279 -0
- data/lib/tickethub/response/headers.rb +31 -0
- data/lib/tickethub/response.rb +49 -0
- data/lib/tickethub/supplier/answer.rb +11 -0
- data/lib/tickethub/supplier/app.rb +9 -0
- data/lib/tickethub/supplier/bill.rb +11 -0
- data/lib/tickethub/supplier/booking.rb +39 -0
- data/lib/tickethub/supplier/card.rb +11 -0
- data/lib/tickethub/supplier/coupon.rb +14 -0
- data/lib/tickethub/supplier/customer.rb +15 -0
- data/lib/tickethub/supplier/element.rb +11 -0
- data/lib/tickethub/supplier/fee.rb +15 -0
- data/lib/tickethub/supplier/gateway/handpoint.rb +8 -0
- data/lib/tickethub/supplier/gateway/ideal.rb +8 -0
- data/lib/tickethub/supplier/gateway/paypal.rb +8 -0
- data/lib/tickethub/supplier/gateway/stripe.rb +8 -0
- data/lib/tickethub/supplier/gateway.rb +16 -0
- data/lib/tickethub/supplier/invoice.rb +7 -0
- data/lib/tickethub/supplier/message/email.rb +8 -0
- data/lib/tickethub/supplier/message/sms.rb +8 -0
- data/lib/tickethub/supplier/message.rb +20 -0
- data/lib/tickethub/supplier/option.rb +18 -0
- data/lib/tickethub/supplier/order.rb +51 -0
- data/lib/tickethub/supplier/package.rb +9 -0
- data/lib/tickethub/supplier/payment/card.rb +18 -0
- data/lib/tickethub/supplier/payment/cash.rb +8 -0
- data/lib/tickethub/supplier/payment/credit.rb +8 -0
- data/lib/tickethub/supplier/payment/direct.rb +8 -0
- data/lib/tickethub/supplier/payment/gratuity.rb +8 -0
- data/lib/tickethub/supplier/payment.rb +34 -0
- data/lib/tickethub/supplier/product.rb +54 -0
- data/lib/tickethub/supplier/question.rb +11 -0
- data/lib/tickethub/supplier/rate.rb +16 -0
- data/lib/tickethub/supplier/receipt.rb +11 -0
- data/lib/tickethub/supplier/reseller.rb +36 -0
- data/lib/tickethub/supplier/scan.rb +17 -0
- data/lib/tickethub/supplier/season.rb +16 -0
- data/lib/tickethub/supplier/subscription.rb +11 -0
- data/lib/tickethub/supplier/tax.rb +16 -0
- data/lib/tickethub/supplier/template.rb +11 -0
- data/lib/tickethub/supplier/ticket.rb +25 -0
- data/lib/tickethub/supplier/tier.rb +20 -0
- data/lib/tickethub/supplier/user.rb +9 -0
- data/lib/tickethub/supplier/variant.rb +10 -0
- data/lib/tickethub/supplier/voucher.rb +23 -0
- data/lib/tickethub/supplier.rb +86 -0
- data/lib/tickethub/token.rb +9 -0
- data/lib/tickethub/user/app.rb +5 -0
- data/lib/tickethub/user/supplier.rb +5 -0
- data/lib/tickethub/user.rb +38 -0
- data/lib/tickethub/version.rb +3 -0
- data/lib/tickethub.rb +26 -0
- data/tickethub.gemspec +25 -0
- metadata +209 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Customer < Resource
|
5
|
+
path '/supplier/customers'
|
6
|
+
|
7
|
+
require_relative 'booking'
|
8
|
+
require_relative 'ticket'
|
9
|
+
require_relative 'message'
|
10
|
+
|
11
|
+
collection :bookings, Supplier::Booking
|
12
|
+
collection :tickets, Supplier::Ticket
|
13
|
+
collection :messages, Supplier::Message
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Fee < Resource
|
5
|
+
path '/supplier/fees'
|
6
|
+
|
7
|
+
require_relative 'tax'
|
8
|
+
require_relative 'booking'
|
9
|
+
|
10
|
+
association :tax, Supplier::Tax
|
11
|
+
association :booking, Supplier::Booking
|
12
|
+
|
13
|
+
attribute :amount, type: :money
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Gateway < Resource
|
5
|
+
path '/supplier/gateways'
|
6
|
+
|
7
|
+
require_relative 'gateway/stripe'
|
8
|
+
require_relative 'gateway/paypal'
|
9
|
+
require_relative 'gateway/handpoint'
|
10
|
+
require_relative 'gateway/ideal'
|
11
|
+
|
12
|
+
require_relative 'payment'
|
13
|
+
|
14
|
+
collection :payments, Supplier::Payment
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Message < Resource
|
5
|
+
path '/supplier/messages'
|
6
|
+
|
7
|
+
require_relative 'user'
|
8
|
+
require_relative 'message/email'
|
9
|
+
require_relative 'message/sms'
|
10
|
+
|
11
|
+
association :user, Supplier::User
|
12
|
+
|
13
|
+
attribute :created_at, type: :datetime
|
14
|
+
attribute :updated_at, type: :datetime
|
15
|
+
|
16
|
+
def replies
|
17
|
+
@replies ||= Tickethub::Collection.new @endpoint[:replies].get
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Option < Resource
|
5
|
+
path '/supplier/options'
|
6
|
+
|
7
|
+
scope :dates, -> (params) { @endpoint[:dates, params: params].get.decoded }
|
8
|
+
scope :active
|
9
|
+
|
10
|
+
require_relative 'season'
|
11
|
+
|
12
|
+
association :season, Supplier::Season
|
13
|
+
|
14
|
+
attribute :time, type: :time
|
15
|
+
attribute :total, type: :money
|
16
|
+
attribute :currency, type: :currency
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Order < Resource
|
5
|
+
path '/supplier/orders'
|
6
|
+
|
7
|
+
require_relative 'customer'
|
8
|
+
require_relative 'booking'
|
9
|
+
require_relative 'payment'
|
10
|
+
|
11
|
+
require_relative 'reseller'
|
12
|
+
require_relative 'customer'
|
13
|
+
|
14
|
+
require_relative 'app'
|
15
|
+
require_relative 'user'
|
16
|
+
require_relative 'answer'
|
17
|
+
require_relative 'message'
|
18
|
+
|
19
|
+
require_relative '../address'
|
20
|
+
|
21
|
+
collection :bookings, Supplier::Booking
|
22
|
+
collection :payments, Supplier::Payment
|
23
|
+
collection :messages, Supplier::Message
|
24
|
+
collection :answers, Supplier::Answer
|
25
|
+
|
26
|
+
association :reseller, Supplier::Reseller
|
27
|
+
association :customer, Supplier::Customer
|
28
|
+
|
29
|
+
association :app, Supplier::App
|
30
|
+
association :user, Supplier::User
|
31
|
+
|
32
|
+
association :address, Tickethub::Address
|
33
|
+
|
34
|
+
attribute :total, type: :money
|
35
|
+
attribute :balance, type: :money
|
36
|
+
attribute :currency, type: :currency
|
37
|
+
|
38
|
+
attribute :expires_at, type: :datetime
|
39
|
+
attribute :confirmed_at, type: :datetime
|
40
|
+
attribute :created_at, type: :datetime
|
41
|
+
attribute :updated_at, type: :datetime
|
42
|
+
|
43
|
+
def restore
|
44
|
+
self.load @endpoint[:restore].post
|
45
|
+
end
|
46
|
+
|
47
|
+
def confirm
|
48
|
+
self.load @endpoint[:confirm].post
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative '../payment'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Payment::Card < Supplier::Payment
|
5
|
+
polymorphic 'card', attribute: :type
|
6
|
+
path '/supplier/payments/card'
|
7
|
+
|
8
|
+
require_relative '../card'
|
9
|
+
require_relative '../gateway'
|
10
|
+
|
11
|
+
require_relative '../../address'
|
12
|
+
|
13
|
+
association :card, Supplier::Card
|
14
|
+
association :gateway, Supplier::Gateway
|
15
|
+
|
16
|
+
association :address, Tickethub::Address
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Payment < Resource
|
5
|
+
path '/supplier/payments'
|
6
|
+
|
7
|
+
require_relative 'payment/card'
|
8
|
+
require_relative 'payment/cash'
|
9
|
+
require_relative 'payment/credit'
|
10
|
+
require_relative 'payment/direct'
|
11
|
+
require_relative 'payment/gratuity'
|
12
|
+
|
13
|
+
require_relative 'order'
|
14
|
+
require_relative 'user'
|
15
|
+
|
16
|
+
association :order, Supplier::Order
|
17
|
+
association :user, Supplier::User
|
18
|
+
|
19
|
+
attribute :amount, type: :money
|
20
|
+
attribute :refunded, type: :money
|
21
|
+
attribute :currency, type: :currency
|
22
|
+
attribute :refunded_at, type: :datetime
|
23
|
+
attribute :created_at, type: :datetime
|
24
|
+
attribute :updated_at, type: :datetime
|
25
|
+
|
26
|
+
def refund(attributes)
|
27
|
+
self.load @endpoint[:refund].post(attributes).decoded
|
28
|
+
return true
|
29
|
+
rescue Tickethub::ResourceInvalid => err
|
30
|
+
self.load Tickethub::Response.new(err.response).decoded
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'date'
|
2
|
+
require_relative '../resource'
|
3
|
+
require_relative '../collection'
|
4
|
+
|
5
|
+
module Tickethub
|
6
|
+
class Supplier::Product < Resource
|
7
|
+
path '/supplier/products'
|
8
|
+
|
9
|
+
require_relative '../contact'
|
10
|
+
require_relative '../address'
|
11
|
+
|
12
|
+
require_relative 'booking'
|
13
|
+
require_relative 'voucher'
|
14
|
+
require_relative 'ticket'
|
15
|
+
require_relative 'option'
|
16
|
+
require_relative 'tier'
|
17
|
+
require_relative 'variant'
|
18
|
+
require_relative 'season'
|
19
|
+
require_relative 'rate'
|
20
|
+
require_relative 'coupon'
|
21
|
+
require_relative 'reseller'
|
22
|
+
require_relative 'question'
|
23
|
+
require_relative 'answer'
|
24
|
+
require_relative 'tax'
|
25
|
+
|
26
|
+
collection :bookings, Supplier::Booking
|
27
|
+
collection :vouchers, Supplier::Voucher
|
28
|
+
collection :tickets, Supplier::Ticket
|
29
|
+
collection :tiers, Supplier::Tier
|
30
|
+
collection :variants, Supplier::Variant
|
31
|
+
collection :seasons, Supplier::Season
|
32
|
+
collection :coupons, Supplier::Coupon
|
33
|
+
collection :rates, Supplier::Rate
|
34
|
+
collection :questions, Supplier::Question
|
35
|
+
collection :answers, Supplier::Answer
|
36
|
+
collection :taxes, Supplier::Tax
|
37
|
+
|
38
|
+
collection :options, Supplier::Option do
|
39
|
+
def dates(from, to, booking = {})
|
40
|
+
@endpoint[:dates].get(from: from, to: to, booking: booking).decoded
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
association :contact, Tickethub::Contact
|
45
|
+
association :address, Tickethub::Address
|
46
|
+
|
47
|
+
attribute :time_zone, type: :timezone
|
48
|
+
attribute :currency, type: :currency
|
49
|
+
|
50
|
+
def resellers
|
51
|
+
Collection.new @endpoint['/supplier/resellers'], Supplier::Reseller, filters: { products: [id] }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Rate < Resource
|
5
|
+
path '/supplier/rates'
|
6
|
+
|
7
|
+
require_relative 'product'
|
8
|
+
require_relative 'reseller'
|
9
|
+
require_relative 'voucher'
|
10
|
+
|
11
|
+
collection :resellers, Supplier::Reseller
|
12
|
+
collection :vouchers, Supplier::Voucher
|
13
|
+
|
14
|
+
association :product, Supplier::Product
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Reseller < Resource
|
5
|
+
path '/supplier/resellers'
|
6
|
+
|
7
|
+
require_relative 'invoice'
|
8
|
+
require_relative 'voucher'
|
9
|
+
require_relative 'product'
|
10
|
+
require_relative 'message'
|
11
|
+
require_relative 'rate'
|
12
|
+
|
13
|
+
require_relative '../contact'
|
14
|
+
require_relative '../address'
|
15
|
+
|
16
|
+
collection :invoices, Supplier::Invoice
|
17
|
+
collection :vouchers, Supplier::Voucher
|
18
|
+
collection :products, Supplier::Product
|
19
|
+
collection :messages, Supplier::Message
|
20
|
+
collection :rates, Supplier::Rate
|
21
|
+
|
22
|
+
association :contact, Tickethub::Contact
|
23
|
+
association :address, Tickethub::Address
|
24
|
+
|
25
|
+
attribute :period, type: :duration
|
26
|
+
attribute :notice, type: :duration
|
27
|
+
attribute :currency, type: :currency
|
28
|
+
|
29
|
+
attribute :limit, type: :money
|
30
|
+
attribute :balance, type: :money
|
31
|
+
attribute :overdue, type: :money
|
32
|
+
|
33
|
+
attribute :next_invoice_date, type: :date
|
34
|
+
attribute :first_invoice_date, type: :date
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Scan < Resource
|
5
|
+
path '/supplier/scans'
|
6
|
+
|
7
|
+
require_relative 'scan'
|
8
|
+
require_relative 'user'
|
9
|
+
|
10
|
+
association :scan, Supplier::Scan
|
11
|
+
association :user, Supplier::User
|
12
|
+
|
13
|
+
attribute :at, type: :datetime
|
14
|
+
attribute :updated_at, type: :datetime
|
15
|
+
attribute :created_at, type: :datetime
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Season < Resource
|
5
|
+
path '/supplier/seasons'
|
6
|
+
|
7
|
+
require_relative 'option'
|
8
|
+
require_relative 'product'
|
9
|
+
|
10
|
+
collection :options, Supplier::Option
|
11
|
+
association :product, Supplier::Product
|
12
|
+
|
13
|
+
attribute :starts_on, type: :date
|
14
|
+
attribute :ends_on, type: :date
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Tax < Resource
|
5
|
+
path '/supplier/taxes'
|
6
|
+
|
7
|
+
require_relative 'fee'
|
8
|
+
require_relative 'product'
|
9
|
+
|
10
|
+
association :product, Supplier::Product
|
11
|
+
collection :fees, Supplier::Fee
|
12
|
+
|
13
|
+
attribute :updated_at, type: :datetime
|
14
|
+
attribute :created_at, type: :datetime
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'date'
|
2
|
+
require_relative '../resource'
|
3
|
+
|
4
|
+
module Tickethub
|
5
|
+
class Supplier::Ticket < Resource
|
6
|
+
path '/supplier/tickets'
|
7
|
+
|
8
|
+
require_relative 'booking'
|
9
|
+
require_relative 'tier'
|
10
|
+
require_relative 'voucher'
|
11
|
+
require_relative 'scan'
|
12
|
+
|
13
|
+
association :booking, Supplier::Booking
|
14
|
+
association :tier, Supplier::Tier
|
15
|
+
association :voucher, Supplier::Voucher
|
16
|
+
|
17
|
+
collection :scans, Supplier::Scan
|
18
|
+
|
19
|
+
attribute :price, type: :money
|
20
|
+
attribute :interval, type: :duration
|
21
|
+
attribute :expires_at, type: :datetime
|
22
|
+
attribute :updated_at, type: :datetime
|
23
|
+
attribute :created_at, type: :datetime
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Tier < Resource
|
5
|
+
path '/supplier/tiers'
|
6
|
+
|
7
|
+
require_relative 'product'
|
8
|
+
|
9
|
+
association :product, Supplier::Product
|
10
|
+
|
11
|
+
attribute :price, type: :money
|
12
|
+
attribute :currency, type: :currency
|
13
|
+
|
14
|
+
attribute :notice, type: :duration
|
15
|
+
attribute :period, type: :duration
|
16
|
+
|
17
|
+
attribute :interval, type: :duration
|
18
|
+
attribute :duration, type: :duration
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../resource'
|
2
|
+
|
3
|
+
module Tickethub
|
4
|
+
class Supplier::Voucher < Resource
|
5
|
+
path '/supplier/vouchers'
|
6
|
+
|
7
|
+
require_relative 'reseller'
|
8
|
+
require_relative 'ticket'
|
9
|
+
require_relative 'tier'
|
10
|
+
require_relative 'rate'
|
11
|
+
|
12
|
+
association :reseller, Supplier::Reseller
|
13
|
+
association :ticket, Supplier::Ticket
|
14
|
+
association :tier, Supplier::Tier
|
15
|
+
association :rate, Supplier::Rate
|
16
|
+
|
17
|
+
attribute :valid_from, type: :date
|
18
|
+
attribute :expires_on, type: :date
|
19
|
+
|
20
|
+
attribute :created_at, type: :datetime
|
21
|
+
attribute :updated_at, type: :datetime
|
22
|
+
end
|
23
|
+
end
|