cpaas-sdk 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Cpaas
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  # Two-Factor Authentication
2
- $KANDY$ provides [Authentication API](/developer/references/ruby/1.0.0#twofactor-send-code) using which a two-factor authentication (2FA) flow can be implemented.
2
+ $KANDY$ provides [Authentication API](/developer/references/ruby/1.2.0#twofactor-send-code) using which a two-factor authentication (2FA) flow can be implemented.
3
3
 
4
4
  Sections below describe two sample use cases, two-factor authentication via SMS and two-factor authentication via e-mail.
5
5
 
@@ -16,7 +16,7 @@ The following diagram explains a sample use case and its logical flow for two-fa
16
16
  6. MyApp web server sends validation request to $KANDY$ with the code user entered and receives the result
17
17
  7. MyApp web page takes the action based on the result
18
18
 
19
- Your $KANDY$ admin can purchase SMS DID and assign to the MyApp project, so that the two-factor authentication SMS sent to app users always has the same originating number seen on the phone. Otherwise, the number seen on app users' phones may differ per transaction.
19
+ Your $KANDY$ admin can purchase SMS DID and assign to the project or user, so that the two-factor authentication SMS sent to app users always has the same originating number seen on the phone. Otherwise, the number seen on app users' phones may differ per transaction.
20
20
 
21
21
  First, MyApp web server sends request to send a two-factor authentication code:
22
22
 
@@ -106,5 +106,8 @@ The `code` can be:
106
106
  + Resend using the same resource, which "invalidates" the previously sent code and triggers a new SMS or email containing a new code.
107
107
  + Deleted explicitly if desired (deletion operation does not block the previously started send operation)
108
108
 
109
+ ## Example
110
+ To learn more, check the [2FA starter app](https://github.com/Kandy-IO/kandy-cpaas-ruby-sdk/tree/v1.2.0/examples/2fa).
111
+
109
112
  ## References
110
- For all two factor authentication related method details, refer to [Two Factor Authentication](/developer/references/ruby/1.0.0#twofactor-send-code).
113
+ For all two factor authentication related method details, refer to [Two Factor Authentication](/developer/references/ruby/1.2.0#twofactor-send-code).
@@ -38,10 +38,16 @@ After you've configured the SDK client, you can begin playing around with it to
38
38
 
39
39
  Before starting, you need to learn following information from your CPaaS account, specifically from Developer Portal.
40
40
 
41
- Log into your Developer Portal account and the configuration information required to be authenticated should be under:
41
+ If you want to authenticate using CPaaS account's credentials, the configuration information required should be under:
42
42
 
43
- + `Projects` -> `{your project}` -> `Project info`/`Project secret`
43
+ + `Home` -> `Personal Profile` (top right corner) -> `Details`
44
+ > + `Email` should be mapped to `email`
45
+ > + Your account password should be mapped to `password`
46
+ > + `Account client ID` should be mapped to `client_id`
47
+
48
+ Alternatively if you want to use your project's credentials, the configuration information required should be under:
44
49
 
50
+ + `Projects` -> `{your project}` -> `Project info`/`Project secret`
45
51
  > + `Private Project key` should be mapped to `client_id`
46
52
  > + `Private Project secret` should be mapped to `client_secret`
47
53
 
@@ -49,7 +55,16 @@ Log into your Developer Portal account and the configuration information require
49
55
  Cpaas.configure do |config|
50
56
  config.client_id = '<private project key>'
51
57
  config.client_secret = '<private project secret>'
52
- config.base_url = '$KANDYFQDN$'
58
+ config.base_url = 'https://$KANDYFQDN$'
59
+ end
60
+
61
+ # or
62
+
63
+ Cpaas.configure do |config|
64
+ config.client_id = '<account client ID>'
65
+ config.email = '<account email>'
66
+ config.password = '<account password>'
67
+ config.base_url = 'https://$KANDYFQDN$'
53
68
  end
54
69
  ```
55
70
 
@@ -15,7 +15,7 @@ Cpaas::Conversation.create_message({
15
15
  Before moving to how the response body looks, let's walk through the highlights on the SMS request:
16
16
 
17
17
  + `sender_address` indicates which DID number that user desires to send the SMS from. It is expected to be an E.164 formatted number.
18
- + If `sender_address` field contains `default` keyword, $KANDY$ discovers the default assigned SMS DID number for that user and utilizes it as the sender address.
18
+ + If `sender_address` field contains `default` keyword, $KANDY$ discovers the default assigned SMS DID number for that user or project and utilizes it as the sender address.
19
19
  + `destination_address` can either be an array of phone numbers or a single phone number string within the params containing the destinations that corresponding SMS message will be sent. For SDK v1, only one destination is supported on $KANDY$.
20
20
  + Address value needs to contain a phone number, ideally in E.164 format. Some valid formats are:
21
21
  - +16131234567
@@ -24,7 +24,7 @@ Before moving to how the response body looks, let's walk through the highlights
24
24
  - sip:6131234567@domain
25
25
  + `message` field contains the text message in `UTF-8` encoded format.
26
26
 
27
- > The number provided in `sender_address` field should be purchased by the account and assigned to the project, otherwise $KANDY$ replies back with a Forbidden error.
27
+ > The number provided in `sender_address` field should be purchased by the account and assigned to the project or user, otherwise $KANDY$ replies back with a Forbidden error.
28
28
 
29
29
  Now, let's check the successful response:
30
30
 
@@ -59,8 +59,8 @@ Cpaas::Conversation.subscribe({
59
59
  destination_address: '+16139998877'
60
60
  })
61
61
  ```
62
- + `destination_address` is an optional parameter to indicate which SMS DID number has been desired to receive SMS messages. Corresponding number should be one of the assigned/purchased numbers of the project, otherwise $KANDY$ replies back with Forbidden error. Also not providing this parameter triggers $KANDY$ to use the default assigned DID number against this user, in which case the response message for the subscription contains the `destination_address` field. It is highly recommended to provide `destination_address` parameter.
63
- + `webhook_url` is a webhook that is present in your application which is accessible from the public web. The sms notifications would be delivered to the webhook and the received notification can be consumed by using the `Cpaas::Notification.parse` helper method. The usage of `Cpaas::Notification.parse` is explained in Step 2.
62
+ + `destination_address` is an optional parameter to indicate which SMS DID number has been desired to receive SMS messages. Corresponding number should be one of the assigned/purchased numbers of the project or user, otherwise $KANDY$ replies back with Forbidden error. Also not providing this parameter triggers $KANDY$ to use the default assigned DID number against this project or user, in which case the response message for the subscription contains the `destination_address` field. It is highly recommended to provide `destination_address` parameter.
63
+ + `webhook_url` is a webhook endpoint that is present in your application server which is accessible from the public web. The sms notifications would be delivered to this webhook endpoint and the received notification can be consumed by using the `Cpaas::Notification.parse` helper method. The usage of `Cpaas::Notification.parse` is explained in Step 2.
64
64
 
65
65
  A successful subscription would return:
66
66
  ```ruby
@@ -72,14 +72,17 @@ A successful subscription would return:
72
72
  ```
73
73
 
74
74
  > + For every number required to receive incoming SMS, there should be an individual subscription.
75
- > + When a number has been unassigned from a project, all corresponding inbound SMS subscriptions are cancelled and `sms_subscription_cancellation_notification` notification is sent.
75
+ > + When a number has been unassigned from a project or user, all corresponding inbound SMS subscriptions are cancelled and `sms_subscription_cancellation_notification` notification is sent.
76
76
 
77
- Now, you are ready to receive inbound SMS messages via webhook, for example - 'https://myapp.com/inbound-sms/webhook'.
77
+ Now, you are ready to receive inbound SMS messages via webhook endpoint, for example - 'https://myapp.com/inbound-sms/webhook'. For more information about webhook and subscription, you can refer the [SMS starter app](https://github.com/Kandy-IO/kandy-cpaas-ruby-sdk/tree/v1.2.0/examples/sms).
78
78
 
79
79
  ### Step 2: Receiving notification
80
- An inbound SMS notification via webhook can be parsed by using the `Cpaas::Notification.parse` method:
80
+ An inbound SMS notification received by your webhook endpoint can be parsed by using the `Cpaas::Notification.parse` method:
81
81
 
82
82
  ```ruby
83
+ # This is a sample representation of the method present in your application server
84
+ # that receives request when the particular webhook endpoint (passed as webhook_url)
85
+ # is hit by the CPaaS server with a notification as the request's body.
83
86
  def webhook(inbound_notification)
84
87
  parsed_Response = Cpaas::Notification.parse(inbound_notification)
85
88
  end
@@ -102,6 +105,9 @@ The parsed response returned from the `Cpaas::Notification.parse` method can loo
102
105
  $KANDY$ provides notification for outbound SMS messages, to sync all online clients up-to-date in real time. The outbound notification received can also be parsed by using the `Cpaas::Notification.parse` method:
103
106
 
104
107
  ```ruby
108
+ # This is a sample representation of the method present in your application server
109
+ # that receives request when the particular webhook endpoint (passed as webhook_url)
110
+ # is hit by the CPaaS server with a notification as the request's body.
105
111
  def webhook(outbound_notification)
106
112
  parsed_response = Cpaas::Notification.parse(outbound_notification)
107
113
  end
@@ -126,6 +132,8 @@ With the help of this notification, clients can sync their view on sent SMS mess
126
132
 
127
133
  > For trial users, maximum number of SMS messages stored is 1000. When new messages are inserted to history, oldest ones are being removed.
128
134
 
135
+ ## Example
136
+ To learn more, check the [SMS starter app](https://github.com/Kandy-IO/kandy-cpaas-ruby-sdk/tree/v1.2.0/examples/sms).
129
137
 
130
138
  ## References
131
- For all SMS related method details, refer to [SMS](/developer/references/ruby/1.0.0#sms-send).
139
+ For all SMS related method details, refer to [SMS](/developer/references/ruby/1.2.0#sms-send).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpaas-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keepworks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +140,7 @@ files:
140
140
  - bin/console
141
141
  - bin/setup
142
142
  - cpaas-sdk.gemspec
143
+ - developer-notes.md
143
144
  - docs/Cpaas.html
144
145
  - docs/Cpaas/Conversation.html
145
146
  - docs/Cpaas/Notification.html