tww 0.5.0 → 0.6.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: 3f8d42f8c0f5cd4deee9843234dfca2b0814337f
4
- data.tar.gz: 945c7086ec1f0c48850e1bd4468229cc2e72122d
2
+ SHA256:
3
+ metadata.gz: fb739b84f7271b67be53ffd188a7a9d3940833fad4a17d22d92e6ad0ed732804
4
+ data.tar.gz: 9c85631b32e75edfb3d6c2b01bc9b293340b6434c2c8467b5cff0e5b5c694829
5
5
  SHA512:
6
- metadata.gz: 3d271d55d68ab90224469b027bd6e88a5bfe6ea605c7026059b65fa73fbf874f244caebe0130a3c7965f63d763c7c1d913e51a3ff529e8b006e41f98f4f8eb85
7
- data.tar.gz: e1edc2b1482976a31bdebadfc95b4d87f47a39451c01cdb81d2f00f6df528a8b8bf5b1c43bf02f3ce5ccedde2e77acc68b1a5f14d67ee57db409fcb812095377
6
+ metadata.gz: cde8cc97b84d0442cd85093a6c8d2fcbbe73c926a6e3af4beff25ab9350a673bc188d591bdb026e0472e2f1d07f622170a79c845bda717bbf0ae5e089a2e4325
7
+ data.tar.gz: 3f2b6374def31e7617ad1b8fd183a52abbd972dbd7bdd75ae98d89569862be60953bc305ed47821df97f7f8c5200bcaa0fb70accd6173c7648527bcccf5b9e46
@@ -0,0 +1,17 @@
1
+ Style/Documentation:
2
+ Enabled: false
3
+
4
+ Style/HashEachMethods:
5
+ Enabled: true
6
+
7
+ Style/HashTransformKeys:
8
+ Enabled: true
9
+
10
+ Style/HashTransformValues:
11
+ Enabled: true
12
+
13
+ Lint/RaiseException:
14
+ Enabled: true
15
+
16
+ Lint/StructNewOverride:
17
+ Enabled: true
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.10
5
- - 2.2.5
6
- - 2.3.1
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
7
 
8
8
  before_install:
9
9
  - gem update --system
data/lib/tww.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tww/version'
2
4
  require 'tww/config'
3
5
  require 'tww/client'
@@ -8,26 +10,20 @@ module TWW
8
10
  class << self
9
11
  def config
10
12
  @config ||= Config.new
11
- @config.tap { |config| yield(config) if block_given? }
13
+ @config.tap { |config| yield(config) if block_given? }
12
14
  end
13
15
 
14
- def client
15
- @client ||= @factory.new
16
+ def client(options = {})
17
+ @factory.new(@config.merge(options))
16
18
  end
17
19
 
18
20
  def enable_testing!
19
- reset_client
20
21
  @factory = TWW::Testing
21
22
  end
22
23
 
23
24
  def disable_testing!
24
- reset_client
25
25
  @factory = TWW::REST
26
26
  end
27
-
28
- def reset_client
29
- @client = nil
30
- end
31
27
  end
32
28
 
33
29
  disable_testing!
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tww/response'
2
4
 
3
5
  module TWW
4
6
  class Client
5
7
  attr_reader :config, :sent
6
8
 
7
- def initialize
8
- @config, @sent = TWW.config, []
9
+ def initialize(config)
10
+ @config = config
11
+ @sent = []
9
12
  end
10
13
 
11
14
  def clear!
@@ -16,11 +19,11 @@ module TWW
16
19
  sent.size
17
20
  end
18
21
 
19
- def deliver(phone, message, extras = {})
22
+ def deliver(_phone, _message, _extras = {})
20
23
  raise 'Need to be implemented'
21
24
  end
22
25
 
23
- def call(phone, message, extras = {})
26
+ def call(_phone, _message, _extras = {})
24
27
  raise 'Need to be implemented'
25
28
  end
26
29
  end
@@ -1,3 +1,13 @@
1
- class TWW::Config
2
- attr_accessor :username, :password, :from, :layout
1
+ # frozen_string_literal: true
2
+
3
+ module TWW
4
+ Config = Struct.new(:username, :password, :from, :layout) do
5
+ def merge(attributes = {})
6
+ attributes.empty? ? self : dup.copy(attributes)
7
+ end
8
+
9
+ def copy(attributes)
10
+ tap { attributes.each { |k, v| self[k] = v } }
11
+ end
12
+ end
3
13
  end
@@ -1,3 +1,3 @@
1
1
  module TWW
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -19,12 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.required_ruby_version = '>= 2.1.0'
22
- spec.add_dependency 'rest-client', '~> 1.0'
22
+ spec.add_dependency 'rest-client', '~> 2.0'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.11'
25
- spec.add_development_dependency 'rake', '~> 10.0'
26
- spec.add_development_dependency 'rspec', '~> 3.0'
27
- spec.add_development_dependency 'cucumber', '~> 2.0'
24
+ spec.add_development_dependency 'bundler', '~> 2.1'
25
+ spec.add_development_dependency 'rake', '~> 13.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.9'
27
+ spec.add_development_dependency 'cucumber', '~> 3.1'
28
28
  spec.add_development_dependency 'coveralls', '~> 0.8.0'
29
- spec.add_development_dependency 'webmock', '~> 1.0'
29
+ spec.add_development_dependency 'webmock', '~> 3.8'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tww
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Libanori
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,70 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
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: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.11'
33
+ version: '2.1'
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: '1.11'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.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: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '3.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '3.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '3.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '3.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.0'
103
+ version: '3.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.0'
110
+ version: '3.8'
111
111
  description:
112
112
  email:
113
113
  - daniellibanori@gmail.com
@@ -117,6 +117,7 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
+ - ".rubocop.yml"
120
121
  - ".travis.yml"
121
122
  - Gemfile
122
123
  - LICENSE.txt
@@ -151,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  - !ruby/object:Gem::Version
152
153
  version: '0'
153
154
  requirements: []
154
- rubyforge_project:
155
- rubygems_version: 2.5.1
155
+ rubygems_version: 3.0.3
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Send SMS from TWW provider