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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1cad8b3510af6aeb27b8782c5575ce376173c81607dacc549c690891e8ee59e
4
- data.tar.gz: 732b903c8d644022cdeb2f4c5a51c578451302636ae21525f3491157fc9360f5
3
+ metadata.gz: 68f4ace5adcfbc2bdca43d56d66d6c2edb63852afc004bc9f6a24756b9a7fc2b
4
+ data.tar.gz: 2ad036d76702540ac5f12a2afd59f9be97e17422f2c724932fe4685292a1002b
5
5
  SHA512:
6
- metadata.gz: 3406c38d009d811e70d849cab590c5ea4d23aa33a4a71803fb809bafd8e8823e30c9e7369caa15fdccd8b11cb1617bd6982e9deadb43247f665c739de22c02eb
7
- data.tar.gz: e49d925c8b8610ca31c8b38bdd4bad25b5c6b0df35e235ac97c5f44481ebedc6ba3b5acd1df9ea3a59ba00f8a42400c1a903abaa655754eed1b9c00ac5833519
6
+ metadata.gz: 11913fdd2e7c178c104ee5b20684435a649744640c08733226261b350208015cb1246a9bfed8248a4e4ef8958280b8e0adb2f6265802850f09b3f0ef9fbfc416
7
+ data.tar.gz: f03b6c592e9550d6ea51c165cdbf6c6d1571cfd15d4f67cd42e2ee2b8e1e28a7859c083ef9a97c89bfe36cbf9ae656d0a3634e41e0d9a270bac01d2995914921
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
-
2
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
3
  # Specify your gem's dependencies in orangemali_sms.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orange_sms_api (0.1.0)
4
+ orange_sms_api (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # OrangeSms
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/orangemali_sms`. To experiment with that code, run `bin/console` for an interactive prompt.
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 'orangemali_sms'
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 orangemali_sms
21
+ $ gem install orange_sms_api
22
22
 
23
23
  ## Usage
24
24
 
@@ -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
- #requirements
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.recipient_phone_number = recipient_phone_number
13
- message.body = body
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,5 +1,4 @@
1
1
  module OrangeSmsApi
2
2
  class OrangeSmsApiError < StandardError; end
3
3
  class OrangeSmsApiNotConfiguredError < OrangeSmsApiError; end
4
- class OrangeSmsApiError < OrangeSmsApiError; end
5
4
  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.token = response_body.access_token
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
- get_token
66
- else
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!"
@@ -1,3 +1,3 @@
1
1
  module OrangeSmsApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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 gateway.}
13
- spec.description = %q{This gem provide a gateway to send SMS through Orange operator network.}
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.0
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-22 00:00:00.000000000 Z
11
+ date: 2019-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
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: '2.0'
26
+ version: 0.15.4
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
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: '10.0'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.15.4
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.15.4
55
- description: This gem provide a gateway to send SMS through Orange operator network.
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 gateway.
104
+ summary: Orange SMS API HTTP client.
105
105
  test_files: []