locasms 0.3.0 → 1.0.0

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
- SHA1:
3
- metadata.gz: 4e825f5f5729560432aadb5e7874521af3d24219
4
- data.tar.gz: 483c62ac2142f95a4b71ee203ad347a496df7920
2
+ SHA256:
3
+ metadata.gz: 5a896107539a5ae0494a02442c4792ac2da61b58956f4961fdf2472547843ff4
4
+ data.tar.gz: '0618f45850fe8085139fc79d34fae365c33cf39c0435773da59ff8cd21f470c4'
5
5
  SHA512:
6
- metadata.gz: a313fd05ed21ec051f30aec10e71fd9b028372745676c06e22327154622fff0a6cb06a1726ddbf9120cdeadf831f30d3c51bd68fb88b59d70721dccf2b13a2e3
7
- data.tar.gz: 459409d3696a33b69ff0f5f35aa6a73d9a7a62e9f8be27a031a043511c2a778d23e7dfa11f52f3f498cd13a2c5caa921d5324379b3281648254d868573439170
6
+ metadata.gz: 9ea9b109f0a76a9b76fc0e8fa3d9387bf2e2eca0a2c6ed20fdfc501c7ec6d216b78797e09ae00d66a1ff8069eef41d8b88b574a6c0a72960f076b313da0988fe
7
+ data.tar.gz: 355ef466313280c2f6f6c234c3c712f8dd0967a861dbe719de44c68e48cb2b4ee191ee1d1e07e4663a712b8578a502381b5cf47064d1f806ec2bff9bbc16b6cb
@@ -0,0 +1,27 @@
1
+ name: test
2
+ on: [pull_request]
3
+
4
+ jobs:
5
+ lint:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v2
9
+ - uses: ruby/setup-ruby@v1
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - run: bundle exec rubocop
14
+
15
+ test:
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [2.5, 2.6, 2.7, '3.0', jruby, jruby-head]
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ - run: bundle exec rspec
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
8
+ AllCops:
9
+ TargetRubyVersion: 2.5
10
+ NewCops: enable
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,30 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-10-15 23:34:33 UTC using RuboCop version 0.93.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 8
10
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
11
+ # ExcludedMethods: refine
12
+ Metrics/BlockLength:
13
+ Max: 171
14
+
15
+ # Offense count: 1
16
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
17
+ Metrics/MethodLength:
18
+ Max: 27
19
+
20
+ # Offense count: 1
21
+ # Configuration parameters: CountKeywordArgs.
22
+ Metrics/ParameterLists:
23
+ Max: 13
24
+
25
+ # Offense count: 1
26
+ # Cop supports --auto-correct.
27
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
28
+ # URISchemes: http, https
29
+ Layout/LineLength:
30
+ Max: 179
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in locasms.gemspec
data/Guardfile CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard 'rspec' do
2
4
  watch(%r{^spec/.+_spec\.rb})
3
5
  watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { "spec" }
5
- end
6
+ watch('spec/spec_helper.rb') { 'spec' }
7
+ end
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # locasms
2
- [![Gem Version](https://badge.fury.io/rb/locasms.svg)](http://badge.fury.io/rb/locasms) [![Build Status](https://travis-ci.org/mcorp/locasms.png?branch=master)](https://travis-ci.org/mcorp/locasms) [![Dependency Status](https://gemnasium.com/mcorp/locasms.png)](https://gemnasium.com/mcorp/locasms) [![Code Climate](https://codeclimate.com/github/mcorp/locasms.png)](https://codeclimate.com/github/mcorp/locasms) [![Inline docs](http://inch-ci.org/github/mcorp/locasms.svg?branch=master)](http://inch-ci.org/github/mcorp/locasms)
2
+ [![Gem Version](https://badge.fury.io/rb/locasms.svg)](http://badge.fury.io/rb/locasms) [![Code Climate](https://api.codeclimate.com/v1/badges/4187ea939aabd3b66bf7/maintainability)](https://codeclimate.com/github/mcorp/locasms) [![CC Coverage](https://api.codeclimate.com/v1/badges/4187ea939aabd3b66bf7/test_coverage)](https://codeclimate.com/github/mcorp/locasms/test_coverage) [![Inline docs](http://inch-ci.org/github/mcorp/locasms.svg?branch=master)](http://inch-ci.org/github/mcorp/locasms)
3
3
 
4
- > :warning: After `March 29, 2016` the base IP of the service will change as noticed on this [issue](https://github.com/mcorp/locasms/issues/6). If you don't upgrade to version `0.1.7` your app will stop delivering SMS
4
+ > :warning: After `February, 10, 2018` the base IP of the service will change as noticed on this [issue](https://github.com/mcorp/locasms/issues/21). If you don't upgrade to version `0.3.1` your app will stop delivering SMS.
5
5
 
6
6
  Client to consume API's from [LocaSMS][0] and its Short Code SMS version [SMS Plataforma][1].
7
7
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
 
@@ -14,4 +16,4 @@ task :console do
14
16
  sh 'bundle exec irb -rubygems -I lib -r locasms.rb'
15
17
  end
16
18
 
17
- task :default => (ENV['TRAVIS'] ? :spec : :console)
19
+ task default: (ENV['TRAVIS'] ? :spec : :console)
data/bin/console CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # frozen_string_literal: true
4
+
3
5
  require 'bundler/setup'
4
6
  require 'locasms'
5
7
 
@@ -1,13 +1,14 @@
1
- module LocaSMS
1
+ # frozen_string_literal: true
2
2
 
3
+ module LocaSMS
3
4
  # Client to interact with LocaSMS API
4
5
  class Client
5
6
  # Default API "domain"
6
- DOMAIN = '54.173.24.177'.freeze
7
+ DOMAIN = 'app.locasms.com.br'
7
8
 
8
9
  # Default API address
9
10
  ENDPOINT = {
10
- default: "http://#{DOMAIN}/painel/api.ashx",
11
+ default: "http://#{DOMAIN}/painel/api.ashx",
11
12
  shortcode: "http://#{DOMAIN}/shortcode/api.ashx"
12
13
  }.freeze
13
14
 
@@ -17,7 +18,7 @@ module LocaSMS
17
18
  # @param [String] password access password
18
19
  # @param [Hash] opts
19
20
  # @option opts :rest_client (RestClient) client to be used to handle http requests
20
- def initialize(login, password, opts={})
21
+ def initialize(login, password, opts = {})
21
22
  @login = login
22
23
  @password = password
23
24
  @type = opts[:type] || :default
@@ -65,20 +66,24 @@ module LocaSMS
65
66
 
66
67
  # Gets the current status of the given campaign
67
68
  # @param [String] id campaign id
68
- # @return [Array<Hash>] {campaign_id: id, delivery_id: delivery_id, enqueue_time: enqueue_time, delivery_time: delivery_time, status: status, carrier: carrier, mobile_number: mobile_number, message: message }
69
+ # @return [Array<Hash>]
70
+ # { campaign_id: id, delivery_id: delivery_id, enqueue_time: enqueue_time,
71
+ # delivery_time: delivery_time, status: status, carrier: carrier,
72
+ # mobile_number: mobile_number, message: message }
69
73
  def campaign_status(id)
70
74
  response = rest.get(:getstatus, id: id)
71
75
  begin
72
76
  CSV.new(response['data'] || '', col_sep: ';', quote_char: '"').map do |delivery_id, _, enqueue_time, _, delivery_time, _, status, _, _, carrier, mobile_number, _, message|
73
- status = if status =~ /aguardando envio/i
74
- :waiting
75
- elsif status =~ /sucesso/i
76
- :success
77
- elsif status =~ /numero invalido|nao cadastrado/i
78
- :invalid
79
- else
80
- :unknown
81
- end
77
+ status = case status
78
+ when /aguardando envio/i
79
+ waiting
80
+ when /sucesso/i
81
+ success
82
+ when /numero invalido|nao cadastrado/i
83
+ invalid
84
+ else
85
+ unknown
86
+ end
82
87
 
83
88
  {
84
89
  campaign_id: id,
@@ -91,8 +96,8 @@ module LocaSMS
91
96
  message: message
92
97
  }
93
98
  end
94
- rescue
95
- raise Exception.new 'Invalid delivery response data'
99
+ rescue StandardError
100
+ raise LocaSMS::Exception.new(message: 'Invalid delivery response data')
96
101
  end
97
102
  end
98
103
 
@@ -128,7 +133,7 @@ module LocaSMS
128
133
  numbers = Numbers.new mobiles
129
134
  return numbers.to_s unless numbers.bad?
130
135
 
131
- raise Exception("Bad numbers were given: #{numbers.bad.join(',')}")
136
+ raise LocaSMS::Exception.new(message: "Bad numbers were given: #{numbers.bad.join(',')}")
132
137
  end
133
138
  end
134
139
  end
@@ -1,7 +1,8 @@
1
- module LocaSMS
1
+ # frozen_string_literal: true
2
2
 
3
+ module LocaSMS
3
4
  # Common base exception
4
- class Exception < ::Exception
5
+ class Exception < RuntimeError
5
6
  attr_reader :raw, :action
6
7
 
7
8
  def initialize(data = {})
@@ -11,7 +12,7 @@ module LocaSMS
11
12
  super data[:message] || default_message
12
13
  end
13
14
 
14
- private
15
+ private
15
16
 
16
17
  def default_message
17
18
  nil
@@ -20,17 +21,16 @@ module LocaSMS
20
21
 
21
22
  # Raised when asked for an invalid operation
22
23
  # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio#lista-das-a%C3%A7%C3%B5es-dispon%C3%ADveis
23
- class InvalidOperation < Exception
24
+ class InvalidOperation < RuntimeError
24
25
  def default_message
25
26
  'Invalid Operation'
26
27
  end
27
28
  end
28
29
 
29
30
  # Raised when the given credentials are invalid
30
- class InvalidLogin < Exception
31
+ class InvalidLogin < RuntimeError
31
32
  def default_message
32
33
  'Invalid Login'
33
34
  end
34
35
  end
35
-
36
- end
36
+ end
@@ -1,74 +1,43 @@
1
- module LocaSMS
2
- module Helpers
3
-
4
- # Helper class to handle with time parsing
5
- class DateTimeHelper
6
- # Parse a value into a time
7
- # @param [Fixnum,String,DateTime,Time,#to_time] date
8
- # @result [Time] return a parsed time
9
- #
10
- # @example
11
- #
12
- # DateTimeHelper.parse '1977-03-14 14:12:00'
13
- # # => 1977-03-14 14:12:00 -0300
14
- #
15
- # DateTimeHelper.split 227207520
16
- # # => 1977-03-14 14:12:00 -0300
17
- #
18
- def self.parse(date)
19
- date = Time.at(date) if date.is_a? Fixnum
20
- date = Time.parse(date) if date.is_a? String
21
- date = date.to_time if date.respond_to? :to_time
22
- end
23
-
24
- # Breaks a given date in date and time
25
- # @param [Fixnum,String,DateTime,Time,#to_time] date
26
- # @result [Array<String>] an array containing respectively DD/MM/YYYY and HH:MM
27
- #
28
- # @example
29
- #
30
- # DateTimeHelper.split Time.now
31
- # # => ['14/03/1977', '14:12']
32
- #
33
- # DateTimeHelper.split 227207520
34
- # # => ['14/03/1977', '14:12']
35
- #
36
- def self.split(date)
37
- parse(date).strftime('%d/%m/%Y %H:%M').split(' ')
38
- end
1
+ # frozen_string_literal: true
39
2
 
40
- # Parse a value into a time
41
- # @param [Fixnum,String,DateTime,Time,#to_time] date
42
- # @result [Time] return a parsed time
43
- #
44
- # @example
45
- #
46
- # DateTimeHelper.parse '1977-03-14 14:12:00'
47
- # # => 1977-03-14 14:12:00 -0300
48
- #
49
- # DateTimeHelper.split 227207520
50
- # # => 1977-03-14 14:12:00 -0300
51
- #
52
- def parse(date)
53
- DateTimeHelper.parse date
54
- end
3
+ module LocaSMS
4
+ module Helpers
5
+ # Helper class to handle with time parsing
6
+ class DateTimeHelper
7
+ # Parse a value into a time
8
+ # @param [Fixnum,String,DateTime,Time,#to_time] date
9
+ # @result [Time] return a parsed time
10
+ #
11
+ # @example
12
+ #
13
+ # DateTimeHelper.parse '1977-03-14 14:12:00'
14
+ # # => 1977-03-14 14:12:00 -0300
15
+ #
16
+ # DateTimeHelper.split 227207520
17
+ # # => 1977-03-14 14:12:00 -0300
18
+ #
19
+ def self.parse(date)
20
+ date = Time.at(date) if date.is_a? Integer
21
+ date = Time.parse(date) if date.is_a? String
22
+ date = date.to_time if date.respond_to? :to_time
23
+ date
24
+ end
55
25
 
56
- # Breaks a given date in date and time
57
- # @param [Fixnum,String,DateTime,Time,#to_time] date
58
- # @result [Array<String>] an array containing respectively DD/MM/YYYY and HH:MM
59
- #
60
- # @example
61
- #
62
- # DateTimeHelper.split Time.now
63
- # # => ['14/03/1977', '14:12']
64
- #
65
- # DateTimeHelper.split 227207520
66
- # # => ['14/03/1977', '14:12']
67
- #
68
- def split(date)
69
- DateTimeHelper.split date
26
+ # Breaks a given date in date and time
27
+ # @param [Fixnum,String,DateTime,Time,#to_time] date
28
+ # @result [Array<String>] an array containing respectively DD/MM/YYYY and HH:MM
29
+ #
30
+ # @example
31
+ #
32
+ # DateTimeHelper.split Time.now
33
+ # # => ['14/03/1977', '14:12']
34
+ #
35
+ # DateTimeHelper.split 227207520
36
+ # # => ['14/03/1977', '14:12']
37
+ #
38
+ def self.split(date)
39
+ parse(date).strftime('%d/%m/%Y %H:%M').split
40
+ end
70
41
  end
71
42
  end
72
-
73
43
  end
74
- end
@@ -1,5 +1,6 @@
1
- module LocaSMS
1
+ # frozen_string_literal: true
2
2
 
3
+ module LocaSMS
3
4
  # Class that sanitizes and validates a list of mobile's numbers
4
5
  class Numbers
5
6
  attr_reader :good, :bad
@@ -9,15 +10,16 @@ module LocaSMS
9
10
  # @see #normalize
10
11
  # @see #evaluate
11
12
  def initialize(*numbers)
12
- evaluated = evaluate(numbers)
13
- @good, @bad = evaluated[:good], evaluated[:bad]
13
+ evaluated = evaluate(numbers)
14
+ @good = evaluated[:good]
15
+ @bad = evaluated[:bad]
14
16
  end
15
17
 
16
18
  # Checks if there are bad numbers
17
19
  # @return [TrueClass, FalseClass] true if there are bad numbers
18
20
  # @see #valid_number?
19
21
  def bad?
20
- not bad.empty?
22
+ !bad.empty?
21
23
  end
22
24
 
23
25
  # Clears all non digits from a mobile's number and converts into a normalized array
@@ -34,17 +36,19 @@ module LocaSMS
34
36
  # numbers.normalize '8888-9999', ['AA', '6666-9999', '7777-0000'], '3333-4444,555-9999'
35
37
  # # => ['88889999','AA','66669999','77770000','33334444','5559999']
36
38
  def normalize(*numbers)
37
- numbers = numbers.join(',')
39
+ numbers
40
+ .join(',')
38
41
  .split(',')
39
- .map{|number| number.gsub(/[^0-9a-zA-Z]/, '') }
40
- .delete_if{|number| number.empty? }
42
+ .map { |number| number.gsub(/[^0-9a-zA-Z]/, '') }
43
+ .delete_if(&:empty?)
41
44
  end
42
45
 
43
46
  # Validates if a mobile's number has only digits
44
47
  # @param [String] number given number to be validated
45
48
  # @return [TrueClass, FalseClass] true if the number is valid
46
49
  def valid_number?(number)
47
- return false if number.nil? or number =~ /[^0-9a-zA-Z]/
50
+ return false if number.nil? || number =~ (/[^0-9a-zA-Z]/)
51
+
48
52
  [10, 11].include? number.size
49
53
  end
50
54
 
@@ -63,10 +67,9 @@ module LocaSMS
63
67
  # Numbers.new.evaluate('4199998888','11777770000','5551212')
64
68
  # #=> {good: ['4199998888','11777770000'], bad: ['5551212']}
65
69
  def evaluate(*numbers)
66
- normalize(numbers).reduce({good: [], bad: []}) do |hash, number|
70
+ normalize(numbers).each_with_object({ good: [], bad: [] }) do |number, hash|
67
71
  bucket = valid_number?(number) ? :good : :bad
68
72
  hash[bucket] << number
69
- hash
70
73
  end
71
74
  end
72
75
 
@@ -76,5 +79,4 @@ module LocaSMS
76
79
  (good || []).join(',')
77
80
  end
78
81
  end
79
-
80
- end
82
+ end
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'net/http'
3
5
 
4
6
  module LocaSMS
5
-
6
7
  # Class that handle http calls to LocaSMS api
7
- # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio List of avaiable services
8
+ # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio
9
+ # List of avaiable services
8
10
  class RestClient
9
11
  attr_accessor :base_url, :base_params
10
12
 
11
13
  # Creates a new instance of the RestClient class
12
14
  # @param [String] base_url a well formed url
13
15
  # @param [Hash] base_params base params to send on every call
14
- def initialize(base_url, base_params={})
16
+ def initialize(base_url, base_params = {})
15
17
  @base_url = base_url
16
18
  @base_params = base_params
17
19
  end
@@ -35,11 +37,12 @@ module LocaSMS
35
37
  # client.get :holdsms, id: 345678
36
38
  # # => {"status"=>1,"data"=>nil,"msg"=>"SUCESSO"}
37
39
  #
38
- # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio#lista-das-a%C3%A7%C3%B5es-dispon%C3%ADveis List of avaiable actions
40
+ # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio#lista-das-a%C3%A7%C3%B5es-dispon%C3%ADveis
41
+ # List of avaiable actions
39
42
  # @raise [LocaSMS::InvalidOperation] when asked for an invalid operation
40
43
  # @raise [LocaSMS::InvalidLogin] when the given credentials are invalid
41
- def get(action, params={})
42
- params = params_for action, params
44
+ def get(action, params = {})
45
+ params = params_for action, params
43
46
 
44
47
  uri = URI.parse(base_url)
45
48
  uri.query = URI.encode_www_form(params)
@@ -59,9 +62,10 @@ module LocaSMS
59
62
  # client.params_for :ACTION, a: 1, b: 2
60
63
  # # => { action: :ACTION, lgn: 'LOGIN', pwd: 'PASSWORD', a: 1, b: 2 }
61
64
  #
62
- # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio#lista-das-a%C3%A7%C3%B5es-dispon%C3%ADveis List of avaiable actions
63
- def params_for(action, params={})
64
- { action: action }.merge(base_params).merge(params).select {|k, v| v }
65
+ # @see https://github.com/mcorp/locasms/wiki/A-API-de-envio#lista-das-a%C3%A7%C3%B5es-dispon%C3%ADveis
66
+ # List of avaiable actions
67
+ def params_for(action, params = {})
68
+ { action: action }.merge(base_params).merge(params).select { |_k, v| v }
65
69
  end
66
70
 
67
71
  # Parses a result trying to get it in json
@@ -71,15 +75,19 @@ module LocaSMS
71
75
  # @raise [LocaSMS::InvalidOperation] when asked for an invalid operation
72
76
  # @raise [LocaSMS::InvalidLogin] when the given credentials are invalid
73
77
  def parse_response(action, response)
74
- raise InvalidOperation.new(action: action) if response =~ /^0:OPERACAO INVALIDA$/i
78
+ raise InvalidOperation.new(action: action) if response.match?(/^0:OPERACAO INVALIDA$/i)
75
79
 
76
- j = JSON.parse(response) rescue { 'status' => 1, 'data' => response, 'msg' => nil }
80
+ j = begin
81
+ MultiJson.load(response)
82
+ rescue StandardError
83
+ { 'status' => 1, 'data' => response, 'msg' => nil }
84
+ end
77
85
 
78
- return j if j['status'] == 1 or action == :getstatus
86
+ return j if (j['status'] == 1) || (action == :getstatus)
79
87
 
80
- raise InvalidLogin.new(action: action) if j['msg'] =~ /^falha ao realizar login$/i
81
- raise Exception.new(message: j['msg'], raw: response, action: action)
88
+ raise InvalidLogin.new(action: action) if j['msg'].match?(/^falha ao realizar login$/i)
89
+
90
+ raise LocaSMS::Exception.new(message: j['msg'], raw: response, action: action)
82
91
  end
83
92
  end
84
-
85
93
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LocaSMS
2
- VERSION = '0.3.0'
4
+ VERSION = '1.0.0'
3
5
  end
data/lib/locasms.rb CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'locasms/version'
2
4
 
3
- autoload :CSV, 'csv'
4
- autoload :JSON, 'json'
5
- autoload :Logger, 'logger'
5
+ autoload :CSV, 'csv'
6
+ autoload :MultiJson, 'multi_json'
6
7
 
8
+ # Module to encapsulate implementation
7
9
  module LocaSMS
8
10
  autoload :Client, 'locasms/client'
9
11
  autoload :Exception, 'locasms/exception'
@@ -12,6 +14,7 @@ module LocaSMS
12
14
  autoload :Numbers, 'locasms/numbers'
13
15
  autoload :RestClient, 'locasms/rest_client'
14
16
 
17
+ # Module to encapsulate helpers
15
18
  module Helpers
16
19
  autoload :DateTimeHelper, 'locasms/helpers/date_time_helper'
17
20
  end
data/locasms.gemspec CHANGED
@@ -1,37 +1,45 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'locasms/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "locasms"
8
+ spec.name = 'locasms'
8
9
  spec.version = LocaSMS::VERSION
9
- spec.authors = ["Adilson Carvalho", "Leonardo Saraiva", "Marco Carvalho"]
10
- spec.email = ["lc.adilson@gmail.com", "vyper@maneh.org", "marco.carvalho.swasthya@gmail.com"]
11
- spec.description = %q{Cliente para o serviço de disparo de SMS da LocaSMS e de sua
12
- versão para Short Code SMS (SMS Plataforma)}
13
- spec.summary = %q{Cliente para disparo de SMS, regular e Short Code, através da LocaSMS/SMS Plataforma}
14
- spec.homepage = "https://github.com/mcorp/locasms"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files`.split($/)
10
+ spec.authors = ['Adilson Carvalho', 'Leonardo Saraiva', 'Marco Carvalho']
11
+ spec.email = ['lc.adilson@gmail.com', 'vyper@maneh.org', 'marco.carvalho.swasthya@gmail.com']
12
+ spec.description = 'Cliente para o serviço de disparo de SMS da LocaSMS e de sua
13
+ versão para Short Code SMS (SMS Plataforma)'
14
+ spec.summary = 'Cliente para disparo de SMS, regular e Short Code, através da LocaSMS/SMS Plataforma'
15
+ spec.homepage = 'https://github.com/mcorp/locasms'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
21
22
 
22
- spec.required_ruby_version = '~> 2.0'
23
+ spec.required_ruby_version = '>= 2.5'
23
24
 
24
- spec.add_development_dependency 'bundler', '~> 1.15'
25
- spec.add_development_dependency 'rake', '~> 12.1'
25
+ spec.add_dependency 'multi_json', '~> 1.13'
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake', '~> 13.0'
26
29
 
27
30
  # test stuff
28
- spec.add_development_dependency 'rspec', '~> 3.6'
31
+ spec.add_development_dependency 'rspec', '~> 3.9'
29
32
  spec.add_development_dependency 'timecop', '~> 0.9'
30
33
 
31
34
  # for documentation
32
35
  spec.add_development_dependency 'yard', '~> 0.9'
33
- spec.add_development_dependency 'redcarpet', '~> 3.4'
34
36
 
35
37
  # for code coverage
36
- spec.add_development_dependency 'simplecov', '~> 0.15'
38
+ spec.add_development_dependency 'simplecov', '~> 0.18'
39
+
40
+ # for code quality
41
+ spec.add_development_dependency 'rubocop', '~> 1.22'
42
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11'
43
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
44
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.5'
37
45
  end