codec_fast_sms 0.1.0 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/codec_fast_sms/client.rb +21 -5
- data/lib/codec_fast_sms/core.rb +8 -2
- data/lib/codec_fast_sms/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3052087544bb565c03c91892c0cb5267002aa93eef5a7a874331dee381015ad
|
4
|
+
data.tar.gz: 7264fa017d9f089e3f706eecee93cef0f0a2e91f393e26fc965acd759a1954f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa8b9c747723bbf83c45b09dfac355586a8227f9f78a60160fc00292f9d7e84ffa6e0f6f3da0a1211bb90adf59d3b2deacbfab10067dada5ffb66a6ac752d275
|
7
|
+
data.tar.gz: cdc74afe4270e383a4c5e70e5f6f4c6717f588a41b55116108ca80f24fe52103784e01865768bfb07ecca9fb43829b7b3fa374e618969f23564d856316b81666
|
data/README.md
CHANGED
@@ -67,6 +67,29 @@ client.deliver(phone, message)
|
|
67
67
|
puts client.response
|
68
68
|
```
|
69
69
|
|
70
|
+
Use attributes to set permission parameters:
|
71
|
+
```ruby
|
72
|
+
attributes = { optionalParameters: '{ DisablePermissionFilter: true }' }
|
73
|
+
client = CodecFastSms::Client.new(attributes: attributes)
|
74
|
+
```
|
75
|
+
|
76
|
+
Use attributes to set IYS parameters:
|
77
|
+
|
78
|
+
`iys_message_type`: must take the value `TICARI` or `BILGILENDIRME`. In case the value is not given, it takes `BILGILENDIRME` value by default.
|
79
|
+
|
80
|
+
`iys_brand_code`: If `iys_message_type` is set as `TICARI`, it must be filled.
|
81
|
+
|
82
|
+
`iys_recipient_type`: If `iys_message_type` is set as `TICARI`, it must be filled.
|
83
|
+
```ruby
|
84
|
+
attributes = {
|
85
|
+
optionalParameters: '{ DisablePermissionFilter: true }',
|
86
|
+
iys_message_type: 'TICARI'
|
87
|
+
iys_brand_code: 'BC1'
|
88
|
+
iys_recipient_type: 'RT1'
|
89
|
+
}
|
90
|
+
client = CodecFastSms::Client.new(attributes: attributes)
|
91
|
+
```
|
92
|
+
|
70
93
|
We can pass the profile argument on client initialization to use different configuration.
|
71
94
|
```ruby
|
72
95
|
client = CodecFastSms::Client.new(profile: :dynamic_settings)
|
@@ -5,16 +5,25 @@ module CodecFastSms
|
|
5
5
|
class Client < Core
|
6
6
|
# Api endpoint.
|
7
7
|
def request_uri
|
8
|
-
'/
|
8
|
+
'/Soap.asmx/SendSms'
|
9
9
|
end
|
10
10
|
|
11
11
|
def params
|
12
12
|
{
|
13
|
-
userName:
|
14
|
-
password:
|
15
|
-
sender:
|
13
|
+
userName: current_config.username,
|
14
|
+
password: current_config.password,
|
15
|
+
sender: current_config.sender,
|
16
16
|
phone: to, messageContent: message, msgSpecialId: '', isOtn: 'True',
|
17
|
-
headerCode: '', responseType: '3',
|
17
|
+
headerCode: '', responseType: '3',
|
18
|
+
optionalParameters: generate_optional_parameters
|
19
|
+
}.merge(iys_params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def iys_params
|
23
|
+
{
|
24
|
+
iysMessageType: (attributes[:iys_message_type] || 'BILGILENDIRME'),
|
25
|
+
iysRecipientType: attributes[:iys_recipient_type].to_s,
|
26
|
+
iysBrandCode: attributes[:iys_brand_code].to_s
|
18
27
|
}
|
19
28
|
end
|
20
29
|
|
@@ -27,5 +36,12 @@ module CodecFastSms
|
|
27
36
|
assign_recipient_information(to, message)
|
28
37
|
perform
|
29
38
|
end
|
39
|
+
|
40
|
+
def generate_optional_parameters
|
41
|
+
attr = attributes[:optionalParameters]
|
42
|
+
return attr.to_json if attr.is_a?(Hash) && !attr.empty?
|
43
|
+
|
44
|
+
attr.to_s
|
45
|
+
end
|
30
46
|
end
|
31
47
|
end
|
data/lib/codec_fast_sms/core.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
module CodecFastSms
|
4
4
|
# Core
|
5
5
|
class Core
|
6
|
-
attr_accessor :connection, :profile, :response, :to, :message
|
7
|
-
def initialize(profile: :default)
|
6
|
+
attr_accessor :connection, :profile, :response, :to, :message, :attributes
|
7
|
+
def initialize(profile: :default, attributes: {})
|
8
8
|
self.profile = profile
|
9
|
+
self.attributes = attributes
|
9
10
|
# Firstly, create a connection object.
|
10
11
|
self.connection = Faraday.new(
|
11
12
|
url: ::CodecFastSms.configuration(profile).api_host
|
@@ -26,5 +27,10 @@ module CodecFastSms
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def params; end
|
30
|
+
|
31
|
+
# Get the configuration by profile
|
32
|
+
def current_config
|
33
|
+
::CodecFastSms.configuration(profile)
|
34
|
+
end
|
29
35
|
end
|
30
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codec_fast_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sertan Gülveren
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -120,7 +120,7 @@ licenses: []
|
|
120
120
|
metadata:
|
121
121
|
homepage_uri: https://github.com/sertangulveren/codec_fast_sms
|
122
122
|
source_code_uri: https://github.com/sertangulveren/codec_fast_sms
|
123
|
-
post_install_message:
|
123
|
+
post_install_message:
|
124
124
|
rdoc_options: []
|
125
125
|
require_paths:
|
126
126
|
- lib
|
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
139
|
-
signing_key:
|
138
|
+
rubygems_version: 3.0.8
|
139
|
+
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Codec FastSMS Library for Ruby.
|
142
142
|
test_files: []
|