Class: Tito::Admin::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/tito/admin/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token: nil, account: nil, event: nil) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
15
# File 'lib/tito/admin/client.rb', line 6

def initialize(token: nil, account: nil, event: nil)
  @token   = token   || Tito.configuration.token
  @account =  || Tito.configuration.
  @event   = event

  raise Tito::Errors::ConfigurationError, "token is required" unless @token
  raise Tito::Errors::ConfigurationError, "account is required" unless @account

  @connection = Tito::Connection.new(token: @token)
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



4
5
6
# File 'lib/tito/admin/client.rb', line 4

def 
  @account
end

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/tito/admin/client.rb', line 4

def connection
  @connection
end

#eventObject (readonly)

Returns the value of attribute event.



4
5
6
# File 'lib/tito/admin/client.rb', line 4

def event
  @event
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/tito/admin/client.rb', line 4

def token
  @token
end

Instance Method Details

#activities(event: self.event) ⇒ Object



45
46
47
# File 'lib/tito/admin/client.rb', line 45

def activities(event: self.event)
  collection_for(Resources::Activity, event: event)
end

#archived_eventsObject



27
28
29
# File 'lib/tito/admin/client.rb', line 27

def archived_events
  collection_for(Resources::Event, path_suffix: "/archived")
end

#checkin_lists(event: self.event) ⇒ Object



57
58
59
# File 'lib/tito/admin/client.rb', line 57

def checkin_lists(event: self.event)
  collection_for(Resources::CheckinList, event: event)
end

#discount_codes(event: self.event) ⇒ Object



53
54
55
# File 'lib/tito/admin/client.rb', line 53

def discount_codes(event: self.event)
  collection_for(Resources::DiscountCode, event: event)
end

#eventsObject

– Account-scoped resources –



19
20
21
# File 'lib/tito/admin/client.rb', line 19

def events
  collection_for(Resources::Event)
end

#interested_users(event: self.event) ⇒ Object



65
66
67
# File 'lib/tito/admin/client.rb', line 65

def interested_users(event: self.event)
  collection_for(Resources::InterestedUser, event: event)
end

#opt_ins(event: self.event) ⇒ Object



61
62
63
# File 'lib/tito/admin/client.rb', line 61

def opt_ins(event: self.event)
  collection_for(Resources::OptIn, event: event)
end

#past_eventsObject



23
24
25
# File 'lib/tito/admin/client.rb', line 23

def past_events
  collection_for(Resources::Event, path_suffix: "/past")
end

#questions(event: self.event) ⇒ Object



49
50
51
# File 'lib/tito/admin/client.rb', line 49

def questions(event: self.event)
  collection_for(Resources::Question, event: event)
end

#registrations(event: self.event) ⇒ Object



41
42
43
# File 'lib/tito/admin/client.rb', line 41

def registrations(event: self.event)
  collection_for(Resources::Registration, event: event)
end

#releases(event: self.event) ⇒ Object



37
38
39
# File 'lib/tito/admin/client.rb', line 37

def releases(event: self.event)
  collection_for(Resources::Release, event: event)
end

#rsvp_lists(event: self.event) ⇒ Object



69
70
71
# File 'lib/tito/admin/client.rb', line 69

def rsvp_lists(event: self.event)
  collection_for(Resources::RsvpList, event: event)
end

#tickets(event: self.event) ⇒ Object

– Event-scoped resources –



33
34
35
# File 'lib/tito/admin/client.rb', line 33

def tickets(event: self.event)
  collection_for(Resources::Ticket, event: event)
end

#venues(event: self.event) ⇒ Object



77
78
79
# File 'lib/tito/admin/client.rb', line 77

def venues(event: self.event)
  collection_for(Resources::Venue, event: event)
end

#waitlisted_people(event: self.event) ⇒ Object



73
74
75
# File 'lib/tito/admin/client.rb', line 73

def waitlisted_people(event: self.event)
  collection_for(Resources::WaitlistedPerson, event: event)
end

#webhook_endpoints(event: self.event) ⇒ Object



81
82
83
# File 'lib/tito/admin/client.rb', line 81

def webhook_endpoints(event: self.event)
  collection_for(Resources::WebhookEndpoint, event: event)
end