zerobounce 0.1.2 → 0.2.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
2
  SHA256:
3
- metadata.gz: b86320438c8998ba2d2de06f9740aad7434809777a4b7aa9dd84a2e8c4d4055c
4
- data.tar.gz: 30bc99c33fab17f8bc2a486ca89e0e90431af0e426e7d0f6b4d397dbc5501467
3
+ metadata.gz: f4bfc224ce092b8c62648cec52d26f94a80b501f75dad50dd035b91e3a46cbab
4
+ data.tar.gz: d9d93f3ac83d697f45676abd22b4281971229e0756d3e287e3e9150a67d4b13e
5
5
  SHA512:
6
- metadata.gz: 60ed318a3bd571bc33d2b012c8eec8c0524d6322c6c76e5f3b1883fec12f98bd75a4cddd3e7a957cde2bacae87d51b6d7c4ce602383d1277b5e5f7be04e6346e
7
- data.tar.gz: fcee7056d2d19d4f1a2c508ab867d720df6378dbeaf642cd7d902b28dc9b3cd437f6024d127c0b4a8786f18b24832c6c0c1eb6318b08381d000feb25eb57e7bb
6
+ metadata.gz: 70876ead4ecad57b9fa09812c04ebb6bf6dee39d32c699a84e8735bd519b611fc8dc8a3e3c94b1483ae8bf407f6e2f665022fb9014bdb7424c06345af813c8db
7
+ data.tar.gz: a2a0a495b3fa207556427caed2ee411a1af9ead813ea4b68d9ff4d390f8ca77629bbbe9a89602c495a02f81b57a2b519fe466e21310a9eac610b1e65672c154e
@@ -0,0 +1,43 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby 2.6
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+
22
+ - name: Publish to GPR
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
32
+ OWNER: ${{ github.repository_owner }}
33
+
34
+ - name: Publish to RubyGems
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
40
+ gem build *.gemspec
41
+ gem push *.gem
42
+ env:
43
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+ name: Ruby
8
+
9
+ on:
10
+ push:
11
+ branches: [ master ]
12
+ pull_request:
13
+ branches: [ master ]
14
+
15
+ jobs:
16
+ test:
17
+
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby
26
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
27
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
28
+ # uses: ruby/setup-ruby@v1
29
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
30
+ with:
31
+ ruby-version: ${{ matrix.ruby-version }}
32
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
33
+ - name: Run tests
34
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.5
5
+ NewCops: enable
5
6
 
6
7
  Exclude:
7
8
  - 'bin/*'
@@ -16,7 +17,7 @@ Style/Documentation:
16
17
  Metrics/AbcSize:
17
18
  Max: 18
18
19
 
19
- Metrics/LineLength:
20
+ Layout/LineLength:
20
21
  Max: 120
21
22
  Exclude:
22
23
  - 'spec/**/*'
@@ -36,3 +37,6 @@ Style/SymbolArray:
36
37
 
37
38
  RSpec/NestedGroups:
38
39
  Max: 5
40
+
41
+ Style/AccessorGrouping:
42
+ EnforcedStyle: separated
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.4.3
1
+ ruby-2.7.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.2.0
2
+
3
+ * Update faraday and faraday_middleware dependency requirements.
4
+ * Update rubocop dev dependencies and fixed failures.
5
+ * Updated minimum ruby version to 2.5.
6
+
1
7
  # 0.1.2
2
8
 
3
9
  * Removed the double quote from the body check since it appears a space is added after the colon.
@@ -7,28 +7,26 @@ module Zerobounce
7
7
  #
8
8
  # @author Aaron Frase
9
9
  class Error < StandardError
10
+ attr_reader :env
11
+
10
12
  def initialize(env={})
11
13
  @env = env
12
- end
13
-
14
- # Message for the error.
15
- #
16
- # @return [String]
17
- def message
18
- @env[:body]
14
+ super(env[:body])
19
15
  end
20
16
 
21
17
  class << self
22
18
  # Parse the response for errors.
23
19
  #
24
20
  # @param [Hash] env
25
- # @return [Error]
21
+ # @return [Error, nil]
26
22
  def from_response(env)
27
23
  case env[:status]
28
24
  when 500
29
- parse_500(env)
25
+ parse500(env)
30
26
  when 200
31
- parse_200(env)
27
+ parse200(env)
28
+ else
29
+ UnknownError.new(env)
32
30
  end
33
31
  end
34
32
 
@@ -36,7 +34,7 @@ module Zerobounce
36
34
 
37
35
  # @param [Hash] env
38
36
  # @return [Error]
39
- def parse_500(env)
37
+ def parse500(env)
40
38
  if env[:body].to_s.start_with?('Missing parameter')
41
39
  MissingParameter.new(env)
42
40
  else
@@ -46,7 +44,7 @@ module Zerobounce
46
44
 
47
45
  # @param [Hash] env
48
46
  # @return [Error, nil]
49
- def parse_200(env)
47
+ def parse200(env)
50
48
  # The body hasn't been parsed yet and to avoid potentially parsing the body twice
51
49
  # we just use String#start_with?
52
50
  ApiError.new(env) if env[:body].to_s.start_with?('{"error":')
@@ -66,6 +64,12 @@ module Zerobounce
66
64
  class MissingParameter < Error
67
65
  end
68
66
 
67
+ # When the status code isn't in the defined codes to parse.
68
+ #
69
+ # @author Aaron Frase
70
+ class UnknownError < Error
71
+ end
72
+
69
73
  # General API error, the response code was 200 but an error still occurred.
70
74
  #
71
75
  # @author Aaron Frase
@@ -13,7 +13,7 @@ module Zerobounce
13
13
  # The request instance.
14
14
  #
15
15
  # @attr_reader [Faraday::Response] response
16
- # The original {https://www.rubydoc.info/gems/faraday/0.15.2/Faraday/Response Faraday::Response}
16
+ # The original {https://www.rubydoc.info/gems/faraday/1.4.2/Faraday/Response Faraday::Response}
17
17
  class Response
18
18
  attr_reader :response
19
19
  attr_reader :request
@@ -17,7 +17,7 @@ module Zerobounce
17
17
  # :abuse
18
18
  # :do_not_mail
19
19
  #
20
- # @return [Symbol] The status as a +Symbol+.
20
+ # @return [Symbol, nil] The status as a +Symbol+.
21
21
  def status
22
22
  @status ||= @body[:status].to_s.empty? ? nil : @body[:status].tr('-', '_').to_sym
23
23
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zerobounce
4
4
  # The version of the gem.
5
- VERSION = '0.1.2'
5
+ VERSION = '0.2.0'
6
6
  end
data/zerobounce.gemspec CHANGED
@@ -24,16 +24,20 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
24
24
 
25
25
  spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
26
26
 
27
+ spec.required_ruby_version = '>= 2.5'
28
+
27
29
  spec.add_dependency 'faraday', '>= 0.14', '< 2.0'
28
- spec.add_dependency 'faraday_middleware', '~> 0.12'
30
+ spec.add_dependency 'faraday_middleware', '~> 1.0'
29
31
 
30
- spec.add_development_dependency 'bundler', '~> 1.16'
31
- spec.add_development_dependency 'pry', '~> 0.12.2'
32
+ spec.add_development_dependency 'bundler', '~> 2.2.17'
33
+ spec.add_development_dependency 'pry', '~> 0.14.1'
32
34
  spec.add_development_dependency 'rake', '~> 13.0'
33
35
  spec.add_development_dependency 'rspec', '~> 3.0'
34
36
  spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
35
- spec.add_development_dependency 'rubocop', '~> 0.52'
36
- spec.add_development_dependency 'rubocop-rspec', '~> 1.22', '>= 1.22.2'
37
- spec.add_development_dependency 'simplecov', '~> 0.17.1'
38
- spec.add_development_dependency 'yard', '~> 0.9.12'
37
+ spec.add_development_dependency 'rubocop', '~> 1.15'
38
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.3'
39
+ spec.add_development_dependency 'rubocop-rake', '~> 0.5.1'
40
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
41
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
42
+ spec.add_development_dependency 'yard', '~> 0.9.26'
39
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zerobounce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Frase
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -36,42 +36,42 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.12'
39
+ version: '1.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.12'
46
+ version: '1.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.16'
53
+ version: 2.2.17
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.16'
60
+ version: 2.2.17
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: pry
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.12.2
67
+ version: 0.14.1
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.12.2
74
+ version: 0.14.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -120,62 +120,90 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.52'
123
+ version: '1.15'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.52'
130
+ version: '1.15'
131
131
  - !ruby/object:Gem::Dependency
132
- name: rubocop-rspec
132
+ name: rubocop-performance
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '1.22'
137
+ version: '1.11'
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 1.22.2
140
+ version: 1.11.3
141
141
  type: :development
142
142
  prerelease: false
143
143
  version_requirements: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
- version: '1.22'
147
+ version: '1.11'
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: 1.22.2
150
+ version: 1.11.3
151
+ - !ruby/object:Gem::Dependency
152
+ name: rubocop-rake
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: 0.5.1
158
+ type: :development
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: 0.5.1
165
+ - !ruby/object:Gem::Dependency
166
+ name: rubocop-rspec
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '2.3'
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '2.3'
151
179
  - !ruby/object:Gem::Dependency
152
180
  name: simplecov
153
181
  requirement: !ruby/object:Gem::Requirement
154
182
  requirements:
155
183
  - - "~>"
156
184
  - !ruby/object:Gem::Version
157
- version: 0.17.1
185
+ version: 0.21.2
158
186
  type: :development
159
187
  prerelease: false
160
188
  version_requirements: !ruby/object:Gem::Requirement
161
189
  requirements:
162
190
  - - "~>"
163
191
  - !ruby/object:Gem::Version
164
- version: 0.17.1
192
+ version: 0.21.2
165
193
  - !ruby/object:Gem::Dependency
166
194
  name: yard
167
195
  requirement: !ruby/object:Gem::Requirement
168
196
  requirements:
169
197
  - - "~>"
170
198
  - !ruby/object:Gem::Version
171
- version: 0.9.12
199
+ version: 0.9.26
172
200
  type: :development
173
201
  prerelease: false
174
202
  version_requirements: !ruby/object:Gem::Requirement
175
203
  requirements:
176
204
  - - "~>"
177
205
  - !ruby/object:Gem::Version
178
- version: 0.9.12
206
+ version: 0.9.26
179
207
  description: A Ruby client for Zerobounce.net.
180
208
  email:
181
209
  - afrase91@gmail.com
@@ -183,11 +211,12 @@ executables: []
183
211
  extensions: []
184
212
  extra_rdoc_files: []
185
213
  files:
186
- - ".circleci/config.yml"
187
214
  - ".editorconfig"
188
215
  - ".github/ISSUE_TEMPLATE/bug_report.md"
189
216
  - ".github/ISSUE_TEMPLATE/feature_request.md"
190
217
  - ".github/pull_request_template.md"
218
+ - ".github/workflows/gem-push.yml"
219
+ - ".github/workflows/ruby.yml"
191
220
  - ".gitignore"
192
221
  - ".rspec"
193
222
  - ".rubocop.yml"
@@ -228,14 +257,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
257
  requirements:
229
258
  - - ">="
230
259
  - !ruby/object:Gem::Version
231
- version: '0'
260
+ version: '2.5'
232
261
  required_rubygems_version: !ruby/object:Gem::Requirement
233
262
  requirements:
234
263
  - - ">="
235
264
  - !ruby/object:Gem::Version
236
265
  version: '0'
237
266
  requirements: []
238
- rubygems_version: 3.0.6
267
+ rubygems_version: 3.0.3.1
239
268
  signing_key:
240
269
  specification_version: 4
241
270
  summary: A Ruby client for Zerobounce.net.
data/.circleci/config.yml DELETED
@@ -1,136 +0,0 @@
1
- version: 2
2
-
3
- workspace_root: &workspace_root
4
- ~/zerobounce
5
-
6
- defaults: &defaults
7
- working_directory: *workspace_root
8
- docker:
9
- - image: circleci/ruby:2.4
10
-
11
- attach_workspace: &attach_workspace
12
- attach_workspace:
13
- at: *workspace_root
14
-
15
- restore_repo: &restore_repo
16
- restore_cache:
17
- name: Restore repository
18
- keys:
19
- - v1-repo-{{ .Branch }}-{{ .Revision }}
20
-
21
- restore_gems: &restore_gems
22
- restore_cache:
23
- name: Restore gems
24
- keys:
25
- - v1-zerobounce-{{ checksum "Gemfile.lock" }}
26
-
27
- jobs:
28
- checkout-code:
29
- <<: *defaults
30
- steps:
31
- - checkout
32
- - save_cache:
33
- key: v1-repo-{{ .Branch }}-{{ .Revision }}
34
- paths:
35
- - *workspace_root
36
-
37
- bundle-dependencies:
38
- <<: *defaults
39
- steps:
40
- - *restore_repo
41
- - *restore_gems
42
- - run:
43
- name: Install Bundler dependencies
44
- command: |
45
- bin/bundle install --path=vendor/bundle \
46
- --jobs=4 \
47
- --retry=3
48
- - run:
49
- name: Setup Code Climate test-reporter
50
- command: |
51
- mkdir -p tmp/
52
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
53
- chmod +x ./tmp/cc-test-reporter
54
- - save_cache:
55
- key: v1-zerobounce-{{ checksum "Gemfile.lock" }}
56
- paths:
57
- - vendor/bundle
58
- - persist_to_workspace:
59
- root: *workspace_root
60
- paths:
61
- - vendor/bundle
62
- - tmp/cc-test-reporter
63
-
64
- run-specs:
65
- <<: *defaults
66
- parallelism: 2
67
- steps:
68
- - *restore_repo
69
- - *attach_workspace
70
- - run:
71
- name: Set bundler path
72
- command: bin/bundle --path vendor/bundle
73
- - run:
74
- name: Run tests
75
- command: |
76
- bin/bundle exec rspec --profile 10 \
77
- --format RspecJunitFormatter \
78
- --out test_results/rspec.xml \
79
- --format progress \
80
- $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
81
- ./tmp/cc-test-reporter format-coverage \
82
- -t simplecov \
83
- -o tmp/codeclimate.${CIRCLE_NODE_INDEX}.json \
84
- ${CIRCLE_ARTIFACTS}/coverage/.resultset.json
85
- - persist_to_workspace:
86
- root: *workspace_root
87
- paths:
88
- - tmp
89
- - store_test_results:
90
- path: test_results
91
- - store_artifacts:
92
- path: test_results
93
- destination: test-results
94
- - store_artifacts:
95
- path: coverage
96
- destination: test-coverage
97
-
98
- upload-coverage:
99
- <<: *defaults
100
- steps:
101
- - *attach_workspace
102
- - run:
103
- name: Upload coverage results to Code Climate
104
- command: |
105
- ./tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -p 2 -o tmp/codeclimate.total.json
106
- ./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json
107
-
108
- run-rubocop:
109
- <<: *defaults
110
- steps:
111
- - *restore_repo
112
- - *attach_workspace
113
- - run:
114
- name: Set bundler path
115
- command: bin/bundle --path vendor/bundle
116
- - run:
117
- name: Run rubocop
118
- command: bin/bundle exec rubocop
119
-
120
- workflows:
121
- version: 2
122
- build-test:
123
- jobs:
124
- - checkout-code
125
- - bundle-dependencies:
126
- requires:
127
- - checkout-code
128
- - run-rubocop:
129
- requires:
130
- - bundle-dependencies
131
- - run-specs:
132
- requires:
133
- - bundle-dependencies
134
- - upload-coverage:
135
- requires:
136
- - run-specs