Module: Webex::Events

Defined in:
lib/webex/events.rb,
lib/webex/events/version.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.assert_access_token!Object



88
89
90
91
# File 'lib/webex/events.rb', line 88

def self.assert_access_token!
  return unless Events::Config.access_token.nil?
  raise 'Access Token is not present. Please set your access token to use the SDK.'
end

.endpoint_urlObject



70
71
72
73
74
75
76
# File 'lib/webex/events.rb', line 70

def self.endpoint_url
  if live_token?
    'https://public.api.socio.events'
  else
    'https://public.sandbox-api.socio.events'
  end
end

.live_token?Boolean

Returns:

  • (Boolean)


78
79
80
81
# File 'lib/webex/events.rb', line 78

def self.live_token?
  assert_access_token!
  /\Ask_live_.+/.match?(Webex::Events::Config.access_token)
end

.ruby_versionObject



93
94
95
96
97
98
99
100
101
102
# File 'lib/webex/events.rb', line 93

def self.ruby_version
  case RUBY_ENGINE
  when 'ruby'
    "ruby-#{RUBY_VERSION}"
  when 'jruby'
    "jruby-#{JRUBY_VERSION}"
  else
    RUBY_DESCRIPTION
  end
end

.sandbox_token?Boolean

Returns:

  • (Boolean)


83
84
85
86
# File 'lib/webex/events.rb', line 83

def self.sandbox_token?
  assert_access_token!
  !live_token?
end

.user_agentObject



104
105
106
107
108
# File 'lib/webex/events.rb', line 104

def self.user_agent
  os = RbConfig::CONFIG['host_os']
  hostname = Socket.gethostname
  "Webex Ruby SDK(v#{Webex::Events::VERSION}) - OS(#{os}) - hostname(#{hostname}) - Ruby Version(#{ruby_version})"
end