Class: AddEvent::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/add_event/service.rb

Constant Summary collapse

VALID_SERVICES =
%w(appleical google outlook outlookcom yahoo).freeze

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ AddEvent::Service

Parameters:

  • service (String, Symbol)

    The type of service to create the event for



14
15
16
17
# File 'lib/add_event/service.rb', line 14

def initialize(service)
  fail(ArgumentError, "service must set to #{VALID_SERVICES.join(', ')} or nil") unless valid_service?(service)
  @service = service || ''
end

Instance Method Details

#valueString

Returns a proper service value for the API either a string if a valid service was passed, or nil.

Returns:

  • (String)


26
27
28
29
# File 'lib/add_event/service.rb', line 26

def value
  return nil if @service.empty?
  @service.to_s
end