Class: Bloodbath::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/bloodbath/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wait_for_response: true) ⇒ Event

Returns a new instance of Event.



108
109
110
111
112
# File 'lib/bloodbath/event.rb', line 108

def initialize(wait_for_response: true)
  @options = {
    wait_for_response: wait_for_response,
  }
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



106
107
108
# File 'lib/bloodbath/event.rb', line 106

def options
  @options
end

Class Method Details

.method_missing(method_name, args = {}, &block) ⇒ Object



95
96
97
98
99
# File 'lib/bloodbath/event.rb', line 95

def method_missing(method_name, args = {}, &block)
  return new.send(method_name, &block) if args == {}

  new.send(method_name, args, &block)
end

.respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/bloodbath/event.rb', line 101

def respond_to_missing?(method_name, include_private = false)
  super
end

Instance Method Details

#cancel(id) ⇒ Object



126
127
128
# File 'lib/bloodbath/event.rb', line 126

def cancel(id)
  adapter.new(method: :delete, endpoint: "/events/#{id}", options: options).perform
end

#find(id) ⇒ Object



122
123
124
# File 'lib/bloodbath/event.rb', line 122

def find(id)
  adapter.new(method: :get, endpoint: "/events/#{id}", options: options).perform
end

#listObject



118
119
120
# File 'lib/bloodbath/event.rb', line 118

def list
  adapter.new(method: :get, endpoint: "/events", options: options).perform
end

#schedule(args) ⇒ Object



114
115
116
# File 'lib/bloodbath/event.rb', line 114

def schedule(args)
  adapter.new(method: :post, endpoint: "/events", body: args, options: options).perform
end