tww 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +17 -0
- data/.travis.yml +3 -3
- data/lib/tww.rb +5 -9
- data/lib/tww/client.rb +7 -4
- data/lib/tww/config.rb +12 -2
- data/lib/tww/version.rb +1 -1
- data/tww.gemspec +5 -5
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a9550febce380bcdc14eba253d6920146710368ef2203074b27bdea15b60f744
|
4
|
+
data.tar.gz: cea5441f61216d759dd701d5dbbf51cb5e6d242cbf3385330f5cf8c3b60a75f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b663c9b21d83fc95a9a44fe224a2952cb0f3529e8e9b811c225f3cefc91c6a211baa9d002fad2c33544b738298dc4eb255c306261cc35e2eeb1844f39f495f6c
|
7
|
+
data.tar.gz: 6981a9d9fcf42fd8c40cc91a2e4ac500a1dd3115dfcffcc73b3e057c36d61d15bfaaaad7dd191fa5c3f10cf03b7430a00650931094f1e0773a71e277f1902ed9
|
data/.rubocop.yml
ADDED
@@ -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
|
data/.travis.yml
CHANGED
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|
|
13
|
+
@config.tap { |config| yield(config) if block_given? }
|
12
14
|
end
|
13
15
|
|
14
|
-
def client
|
15
|
-
@
|
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!
|
data/lib/tww/client.rb
CHANGED
@@ -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
|
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(
|
22
|
+
def deliver(_phone, _message, _extras = {})
|
20
23
|
raise 'Need to be implemented'
|
21
24
|
end
|
22
25
|
|
23
|
-
def call(
|
26
|
+
def call(_phone, _message, _extras = {})
|
24
27
|
raise 'Need to be implemented'
|
25
28
|
end
|
26
29
|
end
|
data/lib/tww/config.rb
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
-
|
2
|
-
|
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
|
data/lib/tww/version.rb
CHANGED
data/tww.gemspec
CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.required_ruby_version = '>= 2.1.0'
|
22
22
|
spec.add_dependency 'rest-client', '~> 2.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
27
|
-
spec.add_development_dependency 'cucumber', '~>
|
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', '~>
|
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: 1.
|
4
|
+
version: 1.1.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:
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,56 +30,56 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
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
|
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: '
|
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: '
|
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.
|
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.
|
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: '
|
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: '
|
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: '
|
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: '
|
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
|
-
|
155
|
-
rubygems_version: 2.6.11
|
155
|
+
rubygems_version: 3.0.3
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Send SMS from TWW provider
|