direct7 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9afbbf171b7e12d3472ed39168510562aaf97618d1df01346b8806f730267bb
4
- data.tar.gz: ebc9d5a1820c9a691810c59ab09e223ddb622497365f9586c6212e9a0858b64a
3
+ metadata.gz: 61fdb33e63e088d25da99d77b92118459a0bd2b5cc619f5196adc63cb58b714c
4
+ data.tar.gz: 53cd5530d34ce0f08f509cbf1e33dee77f44eb2c5671fda40129c94a6f49c5c3
5
5
  SHA512:
6
- metadata.gz: e6cb412caf09c09dffe941834a789ad32722fef46708b8e77d717d73992d054af8df4f3200e7fbf42707aee935866f0c579ff804982c31a3d89fc3431de173a8
7
- data.tar.gz: d8bb0be38deb0c6e9dfba4a3b674114670f0ccb6873b992f5aa74178b415ef7ecd3a2b99762bf36c83f8efe6ebb271eeaf0568a2c01407af9d242eceb94885ad
6
+ metadata.gz: b5d564a1af80f826b257091fda2b7a225ef64cd34f73ffa52d4eda8d51564be5af0fcb2b54a307592c269ad76d00427798c89efffb2132c68a472473f1a58ed8
7
+ data.tar.gz: 5c120cc6918ed365ac4639d7d777d74d0295fa9dc33428b010ad224dc8483d846346d711fa3dcaba75a8f0ff149ac84903a9e5c0de0a667ca160a872cf86cd60
Binary file
Binary file
@@ -1,7 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <module type="PYTHON_MODULE" version="4">
3
3
  <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/vendor/bundle/ruby/2.7.0/doc" />
6
+ <excludeFolder url="file://$MODULE_DIR$/vendor/bundle/ruby/3.0.0/doc" />
7
+ </content>
5
8
  <orderEntry type="inheritedJdk" />
6
9
  <orderEntry type="sourceFolder" forTests="false" />
7
10
  </component>
data/README.md CHANGED
@@ -8,7 +8,7 @@ The SDK is available on RubyGems and can be installed using two methods:
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```bash
11
- gem 'direct7', '~> 0.0.11'
11
+ gem 'direct7', '~> 0.0.12'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -35,7 +35,12 @@ require 'direct7'
35
35
 
36
36
  client = Direct7::Client.new('Your API token')
37
37
 
38
- client.sms.send_message( recipients =['+91999999XXXX'], content ='Greetings from D7 API', originator ='SignOTP', report_url ='https://the_url_to_recieve_delivery_report.com', unicode =true)
38
+ client.sms.send_message(
39
+ originator='SignOTP',
40
+ report_url='https://the_url_to_recieve_delivery_report.com',
41
+ schedule_time=nil,
42
+ { recipients: ['+919999XXXXXX'], content: 'Greetings from D7 API', unicode: false }
43
+ )
39
44
  ```
40
45
 
41
46
  ### Send SMS (Unicode)
@@ -45,7 +50,12 @@ require 'direct7'
45
50
 
46
51
  client = Direct7::Client.new('Your API token')
47
52
 
48
- client.sms.send_message(recipients = ["+97150900XXXX","+97845900XXX"], content = "مرحبا بالعالم!", originator = "SignOTP", report_url = "https://the_url_to_recieve_delivery_report.com", unicode = True)
53
+ client.sms.send_message(
54
+ originator='SignOTP',
55
+ report_url='https://the_url_to_recieve_delivery_report.com',
56
+ schedule_time=nil,
57
+ { recipients: ['+919999XXXXXX'], content: "مرحبا بالعالم!", unicode: true }
58
+ )
49
59
  ```
50
60
 
51
61
  ### Get Request Status
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
Binary file
data/direct7.gemspec CHANGED
@@ -4,7 +4,7 @@ require "direct7/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "direct7"
7
- spec.version = "0.0.11"
7
+ spec.version = "0.0.12"
8
8
  spec.authors = ["Direct7 Networks"]
9
9
  spec.email = ["support@d7networks.com"]
10
10
  spec.summary = "Ruby SDK for Direct7 Platform REST API"
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/d7networks/direct7-ruby-sdk.git"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split("\n")
16
+ spec.files = `git ls-files`.split("\n")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
data/lib/direct7/sms.rb CHANGED
@@ -8,23 +8,28 @@ module Direct7
8
8
  @client = client
9
9
  end
10
10
 
11
- def send_message(recipients, content, originator, report_url = nil, unicode = false)
12
- message = {
13
- 'channel' => 'sms',
14
- 'content' => content,
15
- 'msg_type' => 'text',
16
- 'data_coding' => unicode ? 'unicode' : 'text',
17
- 'recipients' => recipients
18
- };
11
+ def send_message(originator, report_url, schedule_time, *args)
12
+ messages = []
13
+ args.each do |message|
14
+ messages << {
15
+ 'channel' => 'sms',
16
+ 'recipients' => message[:recipients] || [],
17
+ 'content' => message[:content] || '',
18
+ 'msg_type' => 'text',
19
+ 'data_coding' => message[:unicode] ? 'unicode' : 'text'
20
+ }
21
+ end
19
22
  message_globals = {
20
23
  'originator' => originator,
21
24
  'report_url' => report_url,
25
+ 'schedule_time' => schedule_time
22
26
  };
23
- response = @client.post(@client.host, '/messages/v1/send', true, params= {
24
- 'messages' => [message],
25
- 'message_globals' => message_globals
26
- })
27
- # puts "Message sent successfully."
27
+ payload = {
28
+ 'messages' => messages,
29
+ 'message_globals' => message_globals
30
+ }
31
+ response = @client.post(@client.host, '/messages/v1/send', true, params=payload)
32
+ puts "Message sent successfully."
28
33
  response
29
34
  end
30
35
 
data/test/test.rb CHANGED
@@ -1,67 +1,66 @@
1
- require './lib/direct7/client'
2
- require './lib/direct7/errors/errors'
1
+ require '../lib/direct7/client'
2
+ require '../lib/direct7/errors/errors'
3
3
  require 'test/unit'
4
4
  require_relative '../lib/direct7/client'
5
5
 
6
6
  class TestSERVICES < Test::Unit::TestCase
7
7
  def setup
8
- @client = Direct7::Client.new('Your API token')
8
+ @client = Direct7::Client.new('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiOTM2M2FmNTUtYWRmMS00Y2YzLWJhNjEtNGRjNWIxOTE4NGUwIn0.rctBTKBUO2FERmv_j75ItWACpUDQ7NG14v1PeXlM1ks')
9
9
  end
10
10
 
11
11
  def test_send_message
12
12
  response1 = @client.sms.send_message(
13
- recipients =['+91999999XXXX'],
14
- content ='Greetings from D7 API',
15
- originator ='SignOTP',
16
- report_url ='https://the_url_to_recieve_delivery_report.com',
17
- unicode =true
13
+ originator='SignOTP',
14
+ report_url='https://the_url_to_recieve_delivery_report.com',
15
+ schedule_time=nil,
16
+ { recipients: ['+918086757074'], content: 'Greetings from D7 API', unicode: false }
18
17
  )
19
18
  puts response1
20
- response2 = @client.sms.get_status(request_id= '001a1a4e-0221-4cb7-a524-a2a5b337cbe8')
21
- puts response2
22
- end
23
- def test_slack_send_message
24
- response1 = @client.slack.send_slack_message(content="Greetings from D7 API", work_space_name="WorkSpaceName", channel_name="ChannelName", report_url="https://the_url_to_recieve_delivery_report.com" )
25
- puts response1
26
- response2 = @client.slack.get_status(request_id= '002599bf-e53d-46ad-b784-34f8fd5b6cf3')
27
- puts response2
28
- end
29
-
30
- def test_send_viber_message
31
- response1 = @client.viber.send_viber_message(recipients=["+91999999XXXX"], content="Greetings from D7 API", label="PROMOTION", originator="SignOTP", call_back_url="https://the_url_to_recieve_delivery_report.com")
32
- puts response1
33
- response2 = @client.viber.get_status(request_id= 'd1319cc5-7183-43ff-8d98-0c18c5a62f1b')
34
- puts response2
35
- end
36
-
37
- def test_search_number_details
38
- response = @client.number_lookup.search_number_details(recipients="+91999999XXXX")
39
- puts response
40
- end
41
-
42
- def test_send_otp
43
- response = @client.verify.send_otp(originator="SignOTP", recipient="+91999999XXXX", content="Greetings from D7 API, your mobile verification code is: {}", data_coding="text", expiry=600)
44
- puts response
45
- response = @client.verify.resend_otp(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446")
46
- puts response
47
- response = @client.verify.verify_otp(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446", otp_code="022089")
48
- puts response
49
- response = @client.verify.get_status(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446")
50
- puts response
51
- end
52
-
53
- def test_send_whatsapp_templated_message
54
- response = @client.whatsapp.send_whatsapp_templated_message(originator="919061525574", recipient="91999999XXXX",
55
- template_id="marketing_media_image", body_parameter_values={"0": "Customer"}, media_type="image",
56
- media_url="https://d7networks.com/static/resources/css/img/favicon.d27f70e6ebd0.png"
57
- )
58
- puts response
59
- response = @client.whatsapp.send_whatsapp_freeform_message(
60
- originator= "91906154XXXX",
61
- recipient= "+91999999XXXX",
62
- message_type="CONTACTS", first_name="Amal", last_name="Anu", display_name="Amal Anu", phone="91906152XXXX", email = "amal@gmail.com"
63
- )
64
- response = @client.whatsapp.get_status(request_id="81eca535-8131-4866-be18-b3d933604069")
65
- puts response
19
+ # response2 = @client.sms.get_status(request_id= '001a1a4e-0221-4cb7-a524-a2a5b337cbe8')
20
+ # puts response2
66
21
  end
22
+ # def test_slack_send_message
23
+ # response1 = @client.slack.send_slack_message(content="Greetings from D7 API", work_space_name="WorkSpaceName", channel_name="ChannelName", report_url="https://the_url_to_recieve_delivery_report.com" )
24
+ # puts response1
25
+ # response2 = @client.slack.get_status(request_id= '002599bf-e53d-46ad-b784-34f8fd5b6cf3')
26
+ # puts response2
27
+ # end
28
+ #
29
+ # def test_send_viber_message
30
+ # response1 = @client.viber.send_viber_message(recipients=["+91999999XXXX"], content="Greetings from D7 API", label="PROMOTION", originator="SignOTP", call_back_url="https://the_url_to_recieve_delivery_report.com")
31
+ # puts response1
32
+ # response2 = @client.viber.get_status(request_id= 'd1319cc5-7183-43ff-8d98-0c18c5a62f1b')
33
+ # puts response2
34
+ # end
35
+ #
36
+ # def test_search_number_details
37
+ # response = @client.number_lookup.search_number_details(recipients="+91999999XXXX")
38
+ # puts response
39
+ # end
40
+ #
41
+ # def test_send_otp
42
+ # response = @client.verify.send_otp(originator="SignOTP", recipient="+91999999XXXX", content="Greetings from D7 API, your mobile verification code is: {}", data_coding="text", expiry=600)
43
+ # puts response
44
+ # response = @client.verify.resend_otp(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446")
45
+ # puts response
46
+ # response = @client.verify.verify_otp(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446", otp_code="022089")
47
+ # puts response
48
+ # response = @client.verify.get_status(otp_id="bb0e35ea-b094-40c6-9dda-06e37e801446")
49
+ # puts response
50
+ # end
51
+ #
52
+ # def test_send_whatsapp_templated_message
53
+ # response = @client.whatsapp.send_whatsapp_templated_message(originator="919061525574", recipient="91999999XXXX",
54
+ # template_id="marketing_media_image", body_parameter_values={"0": "Customer"}, media_type="image",
55
+ # media_url="https://d7networks.com/static/resources/css/img/favicon.d27f70e6ebd0.png"
56
+ # )
57
+ # puts response
58
+ # response = @client.whatsapp.send_whatsapp_freeform_message(
59
+ # originator= "91906154XXXX",
60
+ # recipient= "+91999999XXXX",
61
+ # message_type="CONTACTS", first_name="Amal", last_name="Anu", display_name="Amal Anu", phone="91906152XXXX", email = "amal@gmail.com"
62
+ # )
63
+ # response = @client.whatsapp.get_status(request_id="81eca535-8131-4866-be18-b3d933604069")
64
+ # puts response
65
+ # end
67
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: direct7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Direct7 Networks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -105,6 +105,8 @@ extra_rdoc_files:
105
105
  - README.md
106
106
  files:
107
107
  - ".bundle/config"
108
+ - ".direct7.gemspec.swo"
109
+ - ".direct7.gemspec.swp"
108
110
  - ".gitignore"
109
111
  - ".idea/.gitignore"
110
112
  - ".idea/direct7-ruby-sdk.iml"
@@ -125,7 +127,7 @@ files:
125
127
  - Rakefile
126
128
  - VERSION
127
129
  - direct7-0.0.10.gem
128
- - direct7-0.0.9.gem
130
+ - direct7-0.0.11.gem
129
131
  - direct7.gemspec
130
132
  - doc/Direct7.html
131
133
  - doc/Direct7/AuthenticationError.html
data/direct7-0.0.9.gem DELETED
Binary file