Class: AddEvent::Service
- Inherits:
-
Object
- Object
- AddEvent::Service
- Defined in:
- lib/add_event/service.rb
Constant Summary collapse
- VALID_SERVICES =
%w(appleical google outlook outlookcom yahoo).freeze
Instance Method Summary collapse
- #initialize(service) ⇒ AddEvent::Service constructor
-
#value ⇒ String
Returns a proper service value for the API either a string if a valid service was passed, or nil.
Constructor Details
#initialize(service) ⇒ AddEvent::Service
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
#value ⇒ String
Returns a proper service value for the API either a string if a valid service was passed, or nil.
26 27 28 29 |
# File 'lib/add_event/service.rb', line 26 def value return nil if @service.empty? @service.to_s end |