Class: Bluevia::ServicesFactory

Inherits:
Object
  • Object
show all
Includes:
BlueviaLogger
Defined in:
lib/bluevia/bluevia_client.rb

Overview

This service factory wraps the initialization of a service

Instance Method Summary collapse

Methods included from BlueviaLogger

#create_logger, #log_level=, #logger, #logger=

Constructor Details

#initialize(rest = nil) ⇒ ServicesFactory

Returns a new instance of ServicesFactory.



96
97
98
99
100
101
# File 'lib/bluevia/bluevia_client.rb', line 96

def initialize(rest = nil)
  @directory      = Directory.new({:rest =>rest, :logger => logger})
  @sms            = Sms.new({:rest =>rest, :logger => logger})
  @advertising    = Advertising.new({:rest =>rest, :logger => logger})
  @oauth          = Oauth.new({:rest =>rest, :logger => logger})
end

Instance Method Details

#get(service) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/bluevia/bluevia_client.rb', line 103

def get(service)
  case service.to_s.downcase
    when "directory"
      return @directory
    when "sms"
      return @sms
    when "oauth"
      return @oauth
    when "advertising"
      return @advertising
    else
      raise(SyntaxError, "Service not valid")
  end
end