Module: Cpaas

Defined in:
lib/cpaas-sdk.rb,
lib/cpaas-sdk/api.rb,
lib/cpaas-sdk/config.rb,
lib/cpaas-sdk/version.rb,
lib/cpaas-sdk/resources/twofactor.rb,
lib/cpaas-sdk/resources/conversation.rb,
lib/cpaas-sdk/resources/notification.rb,
lib/cpaas-sdk/resources/notification_channel.rb

Defined Under Namespace

Classes: Conversation, Notification, Twofactor

Constant Summary collapse

VERSION =
'1.1.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api



8
9
10
# File 'lib/cpaas-sdk.rb', line 8

def api
  @api
end

.configObject

Returns the value of attribute config



8
9
10
# File 'lib/cpaas-sdk.rb', line 8

def config
  @config
end

Class Method Details

.configure {|self.config = Cpaas::Config.new| ... } ⇒ Object

Configure the SDK with client_id and client_secret.

Examples:

Cpaas.configure do |config|
  config.client_id = '<private project key>'
  config.client_secret = '<private project secret>'
  config.base_url = 'https://$KANDYFQDN$'
end

# or

Cpaas.configure do |config|
  config.client_id = '<account client ID>'
  config.email = '<account email>'
  config.password = '<account password>'
  config.base_url = 'https://$KANDYFQDN$'
end

Parameters:

  • client_id (String)

    Private project key / Account client ID. If Private project key is used then client_secret is mandatory. If account client ID is used then email and password are mandatory.

  • base_url (String)

    URL of the server to be used.

  • client_secret (String)

    +optional Private project secret

  • email (String)

    +optional Account login email

  • password (String)

    +optional Account login password

Yields:

  • (self.config = Cpaas::Config.new)


36
37
38
39
40
41
42
# File 'lib/cpaas-sdk.rb', line 36

def self.configure
  yield self.config = Cpaas::Config.new

  config.validate

  self.api = Cpaas::Api.new(config)
end