orange_sms_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/lib/orange_sms_api.rb +9 -0
- data/lib/orange_sms_api/client.rb +4 -6
- data/lib/orange_sms_api/exceptions.rb +0 -1
- data/lib/orange_sms_api/interceptor.rb +6 -7
- data/lib/orange_sms_api/version.rb +1 -1
- data/orange_sms_api.gemspec +3 -3
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68f4ace5adcfbc2bdca43d56d66d6c2edb63852afc004bc9f6a24756b9a7fc2b
|
4
|
+
data.tar.gz: 2ad036d76702540ac5f12a2afd59f9be97e17422f2c724932fe4685292a1002b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11913fdd2e7c178c104ee5b20684435a649744640c08733226261b350208015cb1246a9bfed8248a4e4ef8958280b8e0adb2f6265802850f09b3f0ef9fbfc416
|
7
|
+
data.tar.gz: f03b6c592e9550d6ea51c165cdbf6c6d1571cfd15d4f67cd42e2ee2b8e1e28a7859c083ef9a97c89bfe36cbf9ae656d0a3634e41e0d9a270bac01d2995914921
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# OrangeSmsApi
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/orange_sms_api`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
5
|
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
12
|
+
gem 'orange_sms_api'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -18,7 +18,7 @@ And then execute:
|
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
$ gem install
|
21
|
+
$ gem install orange_sms_api
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
data/lib/orange_sms_api.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
+
# Gems
|
2
|
+
require "faraday"
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
# Files
|
1
6
|
require "orange_sms_api/version"
|
2
7
|
require "orange_sms_api/configuration"
|
8
|
+
require "orange_sms_api/exceptions"
|
9
|
+
require "orange_sms_api/interceptor"
|
10
|
+
require "orange_sms_api/client"
|
3
11
|
|
4
12
|
module OrangeSmsApi
|
5
13
|
|
@@ -15,3 +23,4 @@ module OrangeSmsApi
|
|
15
23
|
yield(configuration)
|
16
24
|
end
|
17
25
|
end
|
26
|
+
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
require "exceptions"
|
3
|
-
require_relative "interceptor"
|
4
|
-
require_relative "message"
|
1
|
+
|
5
2
|
|
6
3
|
module OrangeSmsApi
|
7
4
|
class Client
|
@@ -9,9 +6,10 @@ module OrangeSmsApi
|
|
9
6
|
|
10
7
|
def send_sms(recipient_phone_number, body)
|
11
8
|
message = {}
|
12
|
-
message
|
13
|
-
message
|
9
|
+
message[:recipient_phone_number] = recipient_phone_number
|
10
|
+
message[:body] = body
|
14
11
|
|
12
|
+
puts "MESSAGE: #{message}"
|
15
13
|
post(OrangeSmsApi.configuration.send_sms_endpoint, message)
|
16
14
|
|
17
15
|
end
|
@@ -1,7 +1,3 @@
|
|
1
|
-
# Requirements.
|
2
|
-
|
3
|
-
require "faraday"
|
4
|
-
require "json"
|
5
1
|
|
6
2
|
module OrangeSmsApi
|
7
3
|
module HttpInterceptor
|
@@ -31,7 +27,7 @@ module OrangeSmsApi
|
|
31
27
|
|
32
28
|
if response.status == 200
|
33
29
|
response_body = response.body
|
34
|
-
OrangeSmsApi.configuration.
|
30
|
+
OrangeSmsApi.configuration.access_token = response_body.access_token
|
35
31
|
end
|
36
32
|
|
37
33
|
end
|
@@ -62,9 +58,12 @@ module OrangeSmsApi
|
|
62
58
|
|
63
59
|
|
64
60
|
if response.status == 200
|
65
|
-
|
66
|
-
|
61
|
+
puts "LA REPONSE DE LA REQUETTE EST: #{response.status}"
|
62
|
+
|
67
63
|
return response
|
64
|
+
else
|
65
|
+
puts "LA REPONSE DE LA REQUETTE EST: #{response.status}"
|
66
|
+
get_token
|
68
67
|
end
|
69
68
|
else
|
70
69
|
render text: "Invalid API Base!"
|
data/orange_sms_api.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["thkernel"]
|
10
10
|
spec.email = ["salut.amos@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Orange SMS
|
13
|
-
spec.description = %q{
|
12
|
+
spec.summary = %q{Orange SMS API HTTP client.}
|
13
|
+
spec.description = %q{Ruby client to interact with Orange SMS API.}
|
14
14
|
spec.homepage = "https://github.com/thkernel"
|
15
15
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
36
|
spec.require_paths = ["lib"]
|
37
37
|
|
38
|
+
spec.add_development_dependency 'faraday', '~> 0.15.4'
|
38
39
|
spec.add_development_dependency "bundler", "~> 2.0"
|
39
40
|
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
-
spec.add_development_dependency 'faraday', '~> 0.15.4'
|
41
41
|
|
42
42
|
end
|
metadata
CHANGED
@@ -1,58 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orange_sms_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thkernel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.15.4
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.15.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
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: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
47
|
+
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
55
|
-
description:
|
54
|
+
version: '10.0'
|
55
|
+
description: Ruby client to interact with Orange SMS API.
|
56
56
|
email:
|
57
57
|
- salut.amos@gmail.com
|
58
58
|
executables: []
|
@@ -101,5 +101,5 @@ rubyforge_project:
|
|
101
101
|
rubygems_version: 2.7.7
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
|
-
summary: Orange SMS
|
104
|
+
summary: Orange SMS API HTTP client.
|
105
105
|
test_files: []
|