clicksend_client 5.1.3 → 5.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46661792c98f877ec6fedfc72ef57198d90aa65b749d07da7bffdac4b301a231
4
- data.tar.gz: 6b79b5ba3a60e1dc28b04d61e72535aaee8518f180d8ba10016c590e305cd526
3
+ metadata.gz: 22defa57f778797619ad88acb3642e162ce37459b07e41d1b9ba39ca75c0023e
4
+ data.tar.gz: 4d03fb206d074cf54d15a77a52a267d72bd51dd0c5d4f1cb352977360ab0119e
5
5
  SHA512:
6
- metadata.gz: f3c3d84dd89b08bd01d276f630c54f49b620d3ae37f45a5811f693e67089a44ad88eb5d26d58db14ae8775fb2d45a4e93fafadc019ad6bac64d88e1f514c43f6
7
- data.tar.gz: 35704385a3fc2b317d94aad9c00d68ec44ce3c64a5aa4048c325acce75e6f4b4bf4553157f653176abd015b1a2f23d26e020f82aa63fb0e9b4acd8a009d21d9d
6
+ metadata.gz: c4a0db93e40289f1cfee124d854c9face1276d8fdf76251d99cc5ce54301130339785510d167a559d5d811c5bac8a66ef76cae95dede4c1bde71d26feebbbaf7
7
+ data.tar.gz: a3a811465409e3079087bf6e7210a879054f227dfb5f192e6428f392c5d1b3f85381c87699e7c6343b866dbe450773a7a87d63fda47568e61637d0deae32375e
data/README.md CHANGED
@@ -1,84 +1,137 @@
1
- # The official ruby library for ClickSend v3 API
1
+ # The official Ruby SDK for ClickSend v3 API
2
2
 
3
-
4
- This is the official [ClickSend](https://clicksend.com) SDK. Documentation can be found [here](https://developers.clicksend.com/docs/rest/v3/?ruby#introduction).
3
+ This is the official [ClickSend](https://clicksend.com) Ruby SDK. Full API documentation can be found [here](https://developers.clicksend.com/docs/rest/v3/?ruby#introduction).
5
4
 
6
5
  ## Requirements
7
6
 
8
- - [Sign Up](https://www.clicksend.com/signup) for a free ClickSend account.
9
- - Copy your API key from the [API Credentials](https://dashboard.clicksend.com/#/account/subaccount) area.
7
+ - Ruby >= 2.7 (install via [Homebrew](https://brew.sh): `brew install ruby`)
8
+ - Bundler (`gem install bundler`)
9
+ - A [ClickSend account](https://dashboard.clicksend.com/#/signup/step1/) with an API key
10
10
 
11
11
  ## Installation
12
12
 
13
- ### Build a gem
13
+ Add the gem to your `Gemfile`:
14
14
 
15
- To build the Ruby code into a gem:
15
+ ```ruby
16
+ source 'https://rubygems.org'
16
17
 
17
- ```shell
18
- gem build clicksend_client.gemspec
18
+ gem 'clicksend_client', '~> 1.0.0'
19
19
  ```
20
20
 
21
- Then either install the gem locally:
21
+ Then install:
22
22
 
23
- ```shell
24
- gem install ./clicksend_client-1.0.0.gem
23
+ ```bash
24
+ bundle install
25
25
  ```
26
- (for development, run `gem install --dev ./clicksend_client-1.0.0.gem` to install the development dependencies)
27
-
28
- or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
29
-
30
- Finally add this to the Gemfile:
31
-
32
- gem 'clicksend_client', '~> 1.0.0'
33
26
 
34
27
  ### Install from Git
35
28
 
36
- If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
37
-
38
- gem 'clicksend_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
39
-
40
- ### Include the Ruby code directly
41
-
42
- Include the Ruby code directly using `-I` as follows:
43
-
44
- ```shell
45
- ruby -Ilib script.rb
29
+ ```ruby
30
+ gem 'clicksend_client', git: 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
46
31
  ```
47
32
 
48
33
  ## Getting Started
49
34
 
50
- Please follow the [installation](#installation) procedure and then run the following code:
51
35
  ```ruby
52
- # Load the gem
36
+ #!/usr/bin/env ruby
37
+ # frozen_string_literal: true
38
+
53
39
  require 'clicksend_client'
54
40
 
55
- # Setup authorization
41
+ # Credentials ————————————————————————————————————————————————————————————————
42
+ USERNAME = 'your_username'
43
+ API_KEY = 'your_api_key'
44
+
45
+ # — Message details ————————————————————————————————————————————————————————————
46
+ FROM_NUMBER = '' # E.164 format e.g. "+61400000000", or leave empty for default sender ID
47
+ TO_NUMBER = '+61411111111' # Recipient in E.164 format
48
+ MESSAGE = 'Hello from ClickSend Ruby SDK!'
49
+
50
+ # — Configure the client ———————————————————————————————————————————————————————
56
51
  ClickSendClient.configure do |config|
57
- # Configure HTTP basic authorization: BasicAuth
58
- config.username = 'YOUR USERNAME'
59
- config.password = 'YOUR PASSWORD'
52
+ config.username = USERNAME
53
+ config.password = API_KEY
60
54
  end
61
55
 
62
- api_instance = ClickSendClient::AccountApi.new
56
+ # Build and send the SMS —————————————————————————————————————————————————————
57
+ sms_message = ClickSendClient::SmsMessage.new(
58
+ to: TO_NUMBER,
59
+ from: FROM_NUMBER,
60
+ body: MESSAGE,
61
+ source: 'ruby'
62
+ )
63
+
64
+ collection = ClickSendClient::SmsMessageCollection.new(messages: [sms_message])
63
65
 
64
66
  begin
65
- #Get account information
66
- result = api_instance.account_get
67
- p result
67
+ api = ClickSendClient::SMSApi.new
68
+ response = api.sms_send_post(collection)
69
+ puts "Success: #{response}"
68
70
  rescue ClickSendClient::ApiError => e
69
- puts "Exception when calling AccountApi->account_get: #{e}"
71
+ puts "API error: #{e.message}"
72
+ puts "Response body: #{e.response_body}" if e.respond_to?(:response_body)
70
73
  end
74
+ ```
75
+
76
+ You can find your API key in the [ClickSend Dashboard](https://dashboard.clicksend.com) under **Account > API Credentials**.
77
+
78
+ ## Usage
71
79
 
80
+ ```bash
81
+ bundle exec ruby send_sms.rb
72
82
  ```
73
83
 
84
+ A successful response looks like:
85
+
86
+ ```json
87
+ {
88
+ "http_code": 200,
89
+ "response_code": "SUCCESS",
90
+ "response_msg": "Messages queued for delivery.",
91
+ "data": {
92
+ "total_price": 0.891,
93
+ "total_count": 1,
94
+ "queued_count": 1,
95
+ "messages": [
96
+ {
97
+ "status": "SUCCESS",
98
+ "to": "+61411111111",
99
+ "from": "ClickSend",
100
+ "body": "Hello from ClickSend Ruby SDK!",
101
+ "message_price": "0.8910",
102
+ "carrier": "Telstra",
103
+ "country": "AU"
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ ```
109
+
110
+ ## Upgrading the SDK
111
+
112
+ Update the version in your `Gemfile`, then run:
113
+
114
+ ```bash
115
+ bundle update clicksend_client
116
+ ```
117
+
118
+ Available versions are listed on [RubyGems](https://rubygems.org/gems/clicksend_client/versions).
119
+
74
120
  ## Documentation
75
121
 
76
- Documentation for our SDK and REST API can be found [here](https://developers.clicksend.com/docs/rest/v3/?ruby#introduction).
122
+ Full SDK and REST API documentation: [developers.clicksend.com](https://developers.clicksend.com/docs/rest/v3/?ruby#introduction)
77
123
 
78
- ## Documentation for Authorization
124
+ ## Authorization
79
125
 
80
126
 
81
127
  ### BasicAuth
82
128
 
83
- - **Type**: HTTP basic authentication
129
+ - **Type**: HTTP basic authentication — pass your ClickSend username and API key as `config.username` / `config.password`
130
+
131
+
132
+ ## Resources
84
133
 
134
+ - [ClickSend Ruby SDK on RubyGems](https://rubygems.org/gems/clicksend_client)
135
+ - [ClickSend REST API v3 Docs](https://developers.clicksend.com/docs/rest/v3/)
136
+ - [ClickSend Dashboard](https://dashboard.clicksend.com)
137
+ - [Support](https://help.clicksend.com)
@@ -11,5 +11,5 @@ ClickSend Codegen version: 2.4.53-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module ClickSendClient
14
- VERSION = '5.1.3'
14
+ VERSION = '5.1.4'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clicksend_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.3
4
+ version: 5.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ClickSend-Codegen