africansms 0.1.6 → 0.1.7

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: c0037113780c55ec7c02643af02be2f0dec24c4b463be3d5c232b3cf8a7dd7fe
4
- data.tar.gz: dd05389799d56be4f27ed0b142a44e61da12f8cbc7f81b1bfb98795206c614b5
3
+ metadata.gz: f5b35bc11b8fe1a17e77a9538de7cd819e6dc54b630b4668137963751807a58e
4
+ data.tar.gz: 99316ba7ec6bfa458cac519022e66e7a86d8febef68e09aa5ab9d179007a7461
5
5
  SHA512:
6
- metadata.gz: 2293ed57aa78eedd2c824baf4ec6ad49754f3aba39cb084b9ec3a13530577682fc038da5949d0464f46e5296bd8c7ba433573c11a8093eccbd755d5ee65f5998
7
- data.tar.gz: 265ecb3907e4e5eb7a49560ad0764e0046b25351924eccecbc5bc522409a4f344766e47e62bca60bd7e67b31a95f73de3ae4740d8e6f8b815bbfd40b8dfb74ed
6
+ metadata.gz: '0924a357882b883ef67b853d3b7427139560a4e771ef3a4ae5e62e39f51d3203821cfc03b1324cd779fa72fc591e7eb5cff4542ec187c7ebcbdb00e5c6d2acd6'
7
+ data.tar.gz: 88d1cb291535da63e93767d7eba775b52b18c43b2921c2a34207e106726082281ccc8e86e1e050bf9eb7af2503473ea6e9a064ce4393d57ffcf265b8be6c2460
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5.0
3
+ NewCops: enable
4
+
5
+ Style/FrozenStringLiteralComment:
6
+ Enabled: false
7
+
8
+ Metrics/ClassLength:
9
+ Max: 300
10
+
11
+ Layout/LineLength:
12
+ Max: 120
13
+
14
+ Style/ClassAndModuleChildren:
15
+ Enabled: false
16
+
17
+ Style/Documentation:
18
+ Enabled: false
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in africansms.gemspec
4
4
  gemspec
5
+
6
+ gem 'rubocop', require: false
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- africansms (0.1.5)
4
+ africansms (0.1.7)
5
5
  rest-client (~> 2.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ ast (2.4.2)
10
11
  domain_name (0.5.20190701)
11
12
  unf (>= 0.0.5, < 1.0.0)
12
13
  http-accept (1.7.0)
@@ -16,15 +17,34 @@ GEM
16
17
  mime-types-data (~> 3.2015)
17
18
  mime-types-data (3.2021.0704)
18
19
  netrc (0.11.0)
20
+ parallel (1.20.1)
21
+ parser (3.0.2.0)
22
+ ast (~> 2.4.1)
23
+ rainbow (3.0.0)
19
24
  rake (13.0.6)
25
+ regexp_parser (2.1.1)
20
26
  rest-client (2.1.0)
21
27
  http-accept (>= 1.7.0, < 2.0)
22
28
  http-cookie (>= 1.0.2, < 2.0)
23
29
  mime-types (>= 1.16, < 4.0)
24
30
  netrc (~> 0.8)
31
+ rexml (3.2.5)
32
+ rubocop (1.18.3)
33
+ parallel (~> 1.10)
34
+ parser (>= 3.0.0.0)
35
+ rainbow (>= 2.2.2, < 4.0)
36
+ regexp_parser (>= 1.8, < 3.0)
37
+ rexml
38
+ rubocop-ast (>= 1.7.0, < 2.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (>= 1.4.0, < 3.0)
41
+ rubocop-ast (1.8.0)
42
+ parser (>= 3.0.1.1)
43
+ ruby-progressbar (1.11.0)
25
44
  unf (0.1.4)
26
45
  unf_ext
27
46
  unf_ext (0.0.7.7)
47
+ unicode-display_width (2.0.0)
28
48
 
29
49
  PLATFORMS
30
50
  x86_64-linux
@@ -33,6 +53,7 @@ DEPENDENCIES
33
53
  africansms!
34
54
  bundler (~> 2.2.23)
35
55
  rake (~> 13.0)
56
+ rubocop
36
57
 
37
58
  BUNDLED WITH
38
59
  2.2.23
data/README.md CHANGED
@@ -22,7 +22,8 @@ Or install it yourself as:
22
22
 
23
23
  ### Overview
24
24
 
25
- Africansms is a gem which is an integration of Africastalking SMS service. Before using the gem please take a look on Africastalking SMS service documentation "https://developers.africastalking.com/docs/sms/overview" to get the required configration credentials (api_key, username & shortcode)
25
+ Africansms is an integration of Africastalking SMS service. Before using the gem you should have a knowledge Africastalking SMS service. Documentation URL: https://developers.africastalking.com/docs/sms/overview
26
+ You have to create an account on AfricasTalking to get the required configration credentials (api_key, username & shortcode).
26
27
 
27
28
  ### Configuration
28
29
 
data/africansms.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.description = 'Integration of Africastalking SMS service for sending SMS in African regions'
12
12
  spec.homepage = 'https://github.com/ayushagrawal134/africansms'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = '>= 2.3.0'
14
+ spec.required_ruby_version = '>= 2.5.0'
15
15
  spec.files = `git ls-files`.split("\n")
16
16
 
17
17
  spec.add_dependency 'rest-client', '~> 2.1'
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "africansms"
3
+ require 'bundler/setup'
4
+ require 'africansms'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "africansms"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
data/lib/africansms.rb CHANGED
@@ -3,7 +3,7 @@ require 'africansms/client'
3
3
 
4
4
  module Africansms
5
5
  class AfricansmsError < StandardError; end
6
-
6
+
7
7
  class << self
8
8
  def configure
9
9
  yield configuration
@@ -10,10 +10,11 @@ module Africansms
10
10
 
11
11
  def send_message
12
12
  raise(AfricansmsError, 'The message to send should not be empty') unless valid_message?
13
+
13
14
  response = RestClient.post(base_url, request_params, request_header)
14
15
  response.body
15
- rescue StandardError => error
16
- error
16
+ rescue StandardError => e
17
+ e
17
18
  end
18
19
 
19
20
  private
@@ -21,7 +22,7 @@ module Africansms
21
22
  def request_params
22
23
  params.merge(
23
24
  username: Africansms.configuration.username!,
24
- from: Africansms.configuration.shortcode!,
25
+ from: Africansms.configuration.shortcode!
25
26
  )
26
27
  end
27
28
 
@@ -33,13 +34,15 @@ module Africansms
33
34
  end
34
35
 
35
36
  def base_url
36
- params.dig(:mode).eql?('live') ?
37
- 'https://api.africastalking.com/version1/messaging' :
37
+ if params[:mode].eql?('live')
38
+ 'https://api.africastalking.com/version1/messaging'
39
+ else
38
40
  'https://api.sandbox.africastalking.com/version1/messaging'
41
+ end
39
42
  end
40
43
 
41
- def valid_message?
42
- params[:message] && !params[:message].empty?
43
- end
44
+ def valid_message?
45
+ params[:message] && !params[:message].empty?
46
+ end
44
47
  end
45
48
  end
@@ -15,7 +15,7 @@ module Africansms
15
15
  def username!
16
16
  username || raise(AfricansmsError, 'No username specified.')
17
17
  end
18
-
18
+
19
19
  def shortcode!
20
20
  shortcode || raise(AfricansmsError, 'No shortcode specified.')
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Africansms
2
- VERSION = "0.1.6"
2
+ VERSION = '0.1.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: africansms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayush Agrawal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-16 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".rubocop.yml"
64
65
  - CODE_OF_CONDUCT.md
65
66
  - Gemfile
66
67
  - Gemfile.lock
@@ -86,14 +87,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
87
  requirements:
87
88
  - - ">="
88
89
  - !ruby/object:Gem::Version
89
- version: 2.3.0
90
+ version: 2.5.0
90
91
  required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  requirements:
92
93
  - - ">="
93
94
  - !ruby/object:Gem::Version
94
95
  version: '0'
95
96
  requirements: []
96
- rubygems_version: 3.0.8
97
+ rubyforge_project:
98
+ rubygems_version: 2.7.7
97
99
  signing_key:
98
100
  specification_version: 4
99
101
  summary: AfricasTalking SMS service integration