aliyun-dysms 0.0.1 → 0.0.2
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 +4 -4
- data/.rubocop.yml +218 -0
- data/Gemfile +3 -1
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/aliyun-dysms.gemspec +3 -2
- data/bin/console +1 -0
- data/lib/aliyun/dysms.rb +6 -4
- data/lib/aliyun/dysms/version.rb +3 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de6093b9783e0f0d02983f70594642cd986d978dc684a522698c8b961b1114c5
|
4
|
+
data.tar.gz: 5c9e9f49c5fc9ac53bb700901fa8ab8f1fe5a9d2d6df27f93d8c5b577799abfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccc22eace9f207017b142516bcd528112e52ad53a992796f97bd6f09f9b09d72ce688f66e1042dab64c6f78d18388aace65ea52b53ee2ae847fb4e8bedd26c5b
|
7
|
+
data.tar.gz: 15a6e0d8826168124b8a95e43e5f1bf2b441e7495e3a97238a446e12ff3717a7a1c7ee4afd20b7593d25a1240afe0a1e2074ebd6c3cd3da52dfa0ed7bf92809a
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.6
|
5
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
6
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
7
|
+
DisabledByDefault: true
|
8
|
+
|
9
|
+
Performance:
|
10
|
+
Exclude:
|
11
|
+
- '**/test/**/*'
|
12
|
+
|
13
|
+
# Prefer &&/|| over and/or.
|
14
|
+
Style/AndOr:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
# Do not use braces for hash literals when they are the last argument of a
|
18
|
+
# method call.
|
19
|
+
Style/BracesAroundHashParameters:
|
20
|
+
Enabled: true
|
21
|
+
EnforcedStyle: context_dependent
|
22
|
+
|
23
|
+
# Align `when` with `case`.
|
24
|
+
Layout/CaseIndentation:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
# Align comments with method definitions.
|
28
|
+
Layout/CommentIndentation:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
Layout/ElseAlignment:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# Align `end` with the matching keyword or starting expression except for
|
35
|
+
# assignments, where it should be aligned with the LHS.
|
36
|
+
Layout/EndAlignment:
|
37
|
+
Enabled: true
|
38
|
+
EnforcedStyleAlignWith: variable
|
39
|
+
AutoCorrect: true
|
40
|
+
|
41
|
+
Layout/EmptyLineAfterMagicComment:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Layout/EmptyLinesAroundBlockBody:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# In a regular class definition, no empty lines around the body.
|
48
|
+
Layout/EmptyLinesAroundClassBody:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
# In a regular method definition, no empty lines around the body.
|
52
|
+
Layout/EmptyLinesAroundMethodBody:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
# In a regular module definition, no empty lines around the body.
|
56
|
+
Layout/EmptyLinesAroundModuleBody:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
60
|
+
Style/HashSyntax:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
64
|
+
# extra level of indentation.
|
65
|
+
Layout/IndentationConsistency:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
# Two spaces, no tabs (for indentation).
|
69
|
+
Layout/IndentationWidth:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Layout/LeadingCommentSpace:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Layout/SpaceAfterColon:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Layout/SpaceAfterComma:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Layout/SpaceAfterSemicolon:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Layout/SpaceAroundKeyword:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Layout/SpaceAroundOperators:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Layout/SpaceBeforeComma:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Layout/SpaceBeforeFirstArg:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Style/DefWithParentheses:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
# Defining a method with parameters needs parentheses.
|
103
|
+
Style/MethodDefParentheses:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
Style/FrozenStringLiteralComment:
|
107
|
+
Enabled: true
|
108
|
+
EnforcedStyle: always
|
109
|
+
|
110
|
+
Style/RedundantFreeze:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
# Use `foo {}` not `foo{}`.
|
114
|
+
Layout/SpaceBeforeBlockBraces:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
# Use `foo { bar }` not `foo {bar}`.
|
118
|
+
Layout/SpaceInsideBlockBraces:
|
119
|
+
Enabled: true
|
120
|
+
EnforcedStyleForEmptyBraces: space
|
121
|
+
|
122
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
123
|
+
Layout/SpaceInsideHashLiteralBraces:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Layout/SpaceInsideParens:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
# Check quotes usage according to lint rule below.
|
130
|
+
Style/StringLiterals:
|
131
|
+
Enabled: true
|
132
|
+
EnforcedStyle: double_quotes
|
133
|
+
|
134
|
+
# Detect hard tabs, no hard tabs.
|
135
|
+
Layout/Tab:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
# Blank lines should not have any spaces.
|
139
|
+
Layout/TrailingBlankLines:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
# No trailing whitespace.
|
143
|
+
Layout/TrailingWhitespace:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
# Use quotes for string literals when they are enough.
|
147
|
+
Style/UnneededPercentQ:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
Lint/AmbiguousOperator:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
Lint/AmbiguousRegexpLiteral:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Lint/ErbNewArguments:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
160
|
+
Lint/RequireParentheses:
|
161
|
+
Enabled: true
|
162
|
+
|
163
|
+
Lint/ShadowingOuterLocalVariable:
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
Lint/StringConversionInInterpolation:
|
167
|
+
Enabled: true
|
168
|
+
|
169
|
+
Lint/UriEscapeUnescape:
|
170
|
+
Enabled: true
|
171
|
+
|
172
|
+
Lint/UselessAssignment:
|
173
|
+
Enabled: true
|
174
|
+
|
175
|
+
Lint/DeprecatedClassMethods:
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Style/ParenthesesAroundCondition:
|
179
|
+
Enabled: true
|
180
|
+
|
181
|
+
Style/RedundantBegin:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
Style/RedundantReturn:
|
185
|
+
Enabled: true
|
186
|
+
AllowMultipleReturnValues: true
|
187
|
+
|
188
|
+
Style/Semicolon:
|
189
|
+
Enabled: true
|
190
|
+
AllowAsExpressionSeparator: true
|
191
|
+
|
192
|
+
# Prefer Foo.method over Foo::method
|
193
|
+
Style/ColonMethodCall:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
Style/TrivialAccessors:
|
197
|
+
Enabled: true
|
198
|
+
|
199
|
+
Performance/FlatMap:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Performance/RedundantMerge:
|
203
|
+
Enabled: true
|
204
|
+
|
205
|
+
Performance/StartWith:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
Performance/EndWith:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Performance/RegexpMatch:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Performance/ReverseEach:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Performance/UnfreezeString:
|
218
|
+
Enabled: true
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in aliyun-dysms.gemspec
|
6
8
|
gemspec
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ require 'aliyun/dysms'
|
|
60
60
|
可以改为 Github 安装源,例如 Rails Gemfile 文件引用可以改为下面格式,即可正确安装。
|
61
61
|
|
62
62
|
```ruby
|
63
|
-
gem 'aliyun-dysms', '0.0.
|
63
|
+
gem 'aliyun-dysms', '0.0.2', git: 'https://github.com/kejincan0527/aliyun-dysms.git'
|
64
64
|
```
|
65
65
|
|
66
66
|
## Usage 使用
|
data/Rakefile
CHANGED
data/aliyun-dysms.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.authors = ["Wells Muker"]
|
10
11
|
spec.email = ["wellsmuker@gmail.com"]
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
13
|
+
spec.summary = "A Ruby Gem for using aliyun dysms service."
|
14
|
+
spec.description = "适用于阿里云官方提供的短信服务。"
|
14
15
|
spec.homepage = "https://github.com/kejincan0527/aliyun-dysms"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
data/bin/console
CHANGED
data/lib/aliyun/dysms.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "aliyun/dysms/version"
|
2
4
|
require "aliyunsdkcore"
|
3
5
|
|
4
6
|
module Aliyun
|
5
7
|
module Dysms
|
6
8
|
class Configuration
|
7
|
-
attr_accessor :access_key_id, :access_key_secret, :action,
|
9
|
+
attr_accessor :access_key_id, :access_key_secret, :action,
|
8
10
|
:region_id, :sign_name, :api_version
|
9
11
|
|
10
12
|
def initialize
|
@@ -43,6 +45,8 @@ module Aliyun
|
|
43
45
|
method: "POST"
|
44
46
|
}
|
45
47
|
)
|
48
|
+
rescue StandardError => e
|
49
|
+
{ Code: "BadRequest", Message: "Request failed: #<#{e.class}: #{e.message}>" }
|
46
50
|
end
|
47
51
|
|
48
52
|
def client
|
@@ -54,9 +58,7 @@ module Aliyun
|
|
54
58
|
)
|
55
59
|
end
|
56
60
|
|
57
|
-
|
58
|
-
@response
|
59
|
-
end
|
61
|
+
attr_reader :response
|
60
62
|
end # class << self
|
61
63
|
end # module Dysms
|
62
64
|
end # module Aliyun
|
data/lib/aliyun/dysms/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun-dysms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wells Muker
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
+
- ".rubocop.yml"
|
78
79
|
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|