africansms 0.1.5 → 0.2.2

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: 59a614038234ea1d68582630a7b3996a372e6bcfae5b62fe2915ce6ee89ff532
4
- data.tar.gz: f1c2f065145ee580e4040d194c4ac8b9a4dee0013ce3fa5c3e77e8525b9ca0fc
3
+ metadata.gz: 70e252de83e0b8a6e9363c14ba8735315283704df1d1a07eebbc3190ee9f36dd
4
+ data.tar.gz: e6cb844773a7eb9b0a4b9c2b36353de836d2dbc979ea722df859c3e4fbef300e
5
5
  SHA512:
6
- metadata.gz: 49d0ecc4955dbc39f032e3a2d2daea7f37080b6fdf45b01231336197b77e9a5817d363e5fc52b4893ce5a9113d514a68f2e3613d71ea2c782f8a836620e0258f
7
- data.tar.gz: 0006f5775ffae2c6bf2cbd4607d755db2aea65b88fb668f2ad6090c66c173e0794df7c32b6bc58887fea0bcd6c73e875afd3fcd5379d815b335fc0320172ea92
6
+ metadata.gz: 450212ce5876e8b425619f0a030377da502f292d86af7724557ba5ee455e6e749c5c1fa7bb27a168521d9bce080bad0ff828c958fdc4a3988491ab123093fcea
7
+ data.tar.gz: 39c8689099cc513d4e6fef7bfdf31866937443649d84732b96c0ff87ad2cf49e007650a50b8a1fd28a482bc61dea17fd54e8b79dad701f7631c2250f3dc8d868
@@ -0,0 +1,64 @@
1
+ version: 2.1
2
+
3
+ environment: &environment
4
+ LOG_LEVEL: WARN
5
+
6
+ jobs:
7
+ run_cops:
8
+ working_directory: ~/repos/africansms
9
+
10
+ docker:
11
+ - image: circleci/ruby:2.6.4-buster-node
12
+ environment:
13
+ <<: *environment
14
+
15
+ steps:
16
+ - checkout
17
+
18
+ - run:
19
+ name: check dependencies
20
+ command: |
21
+ gem install bundler:2.2.23
22
+ bundle -v
23
+ bundle exec ruby -v
24
+
25
+ - run:
26
+ name: install gems
27
+ command: bundle install && bundle clean
28
+
29
+ - run:
30
+ name: run rubocop
31
+ command: bundle exec rubocop
32
+
33
+ publish_to_rubygems:
34
+ working_directory: ~/repos/africansms
35
+
36
+ docker:
37
+ - image: circleci/ruby:2.6.4-buster-node
38
+ environment:
39
+ <<: *environment
40
+
41
+ steps:
42
+ - checkout
43
+
44
+ - run:
45
+ name: setup Rubygems
46
+ command: bash .circleci/setup-rubygems.sh
47
+
48
+ - run:
49
+ name: publish to Rubygems
50
+ command: |
51
+ gem build africansms.gemspec
52
+ gem push "africansms-$(git describe --tags).gem"
53
+
54
+ workflows:
55
+ version: 2
56
+ build_and_test:
57
+ jobs:
58
+ - run_cops
59
+ - publish_to_rubygems:
60
+ filters:
61
+ tags:
62
+ only: /.*/
63
+ branches:
64
+ ignore: /.*/
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
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.0)
4
+ africansms (0.1.8)
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
- shortcode: 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.5"
2
+ VERSION = '0.2.2'.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.5
4
+ version: 0.2.2
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-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -60,7 +60,10 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".circleci/config.yml"
64
+ - ".circleci/setup-rubygems.sh"
63
65
  - ".gitignore"
66
+ - ".rubocop.yml"
64
67
  - CODE_OF_CONDUCT.md
65
68
  - Gemfile
66
69
  - Gemfile.lock
@@ -86,15 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
89
  requirements:
87
90
  - - ">="
88
91
  - !ruby/object:Gem::Version
89
- version: 2.3.0
92
+ version: 2.5.0
90
93
  required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  requirements:
92
95
  - - ">="
93
96
  - !ruby/object:Gem::Version
94
97
  version: '0'
95
98
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.7.7
99
+ rubygems_version: 3.0.3
98
100
  signing_key:
99
101
  specification_version: 4
100
102
  summary: AfricasTalking SMS service integration