pew_pew 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/build.yml +36 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +1 -2
  5. data/.travis.yml +5 -0
  6. data/Appraisals +7 -0
  7. data/CHANGELOG.md +14 -0
  8. data/README.md +18 -1
  9. data/gemfiles/faraday_2.0.gemfile +7 -0
  10. data/gemfiles/faraday_2.7.gemfile +7 -0
  11. data/lib/pew_pew/domain.rb +1 -1
  12. data/lib/pew_pew/resource.rb +12 -10
  13. data/lib/pew_pew/version.rb +1 -1
  14. data/pew_pew.gemspec +21 -15
  15. data/spec/fixtures/bounces.yml +4 -4
  16. data/spec/fixtures/campaigns.yml +11 -11
  17. data/spec/fixtures/complaints.yml +4 -4
  18. data/spec/fixtures/lists.yml +11 -11
  19. data/spec/fixtures/logs.yml +1 -1
  20. data/spec/fixtures/mailboxes.yml +4 -4
  21. data/spec/fixtures/messages.yml +157 -115
  22. data/spec/fixtures/routes.yml +6 -6
  23. data/spec/fixtures/stats.yml +1 -1
  24. data/spec/fixtures/unsubscribes.yml +6 -6
  25. data/spec/pew_pew/client_spec.rb +47 -39
  26. data/spec/pew_pew/config_spec.rb +28 -28
  27. data/spec/pew_pew/resource_spec.rb +42 -36
  28. data/spec/pew_pew/resources/bounces_spec.rb +57 -53
  29. data/spec/pew_pew/resources/campaigns_spec.rb +169 -167
  30. data/spec/pew_pew/resources/complaints_spec.rb +49 -45
  31. data/spec/pew_pew/resources/lists_spec.rb +209 -195
  32. data/spec/pew_pew/resources/logs_spec.rb +30 -25
  33. data/spec/pew_pew/resources/mailboxes_spec.rb +41 -39
  34. data/spec/pew_pew/resources/messages_spec.rb +49 -45
  35. data/spec/pew_pew/resources/routes_spec.rb +105 -103
  36. data/spec/pew_pew/resources/stats_spec.rb +19 -17
  37. data/spec/pew_pew/resources/unsubscribes_spec.rb +71 -65
  38. data/spec/pew_pew/response_spec.rb +25 -13
  39. data/spec/pew_pew_spec.rb +4 -5
  40. data/spec/spec_helper.rb +1 -1
  41. data/spec/support/contexts/api_requests.rb +10 -4
  42. data/spec/support/contexts/domain_resource.rb +1 -1
  43. data/spec/support/vcr.rb +36 -1
  44. metadata +85 -49
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0a1bcd1454887394ebff0e731baf87d0e097e6d0f040faf3ca5b21f877e2d733
4
+ data.tar.gz: 3087c678aaf3575fe6363068a21286aeb0b85960ec615e9cb8d1bb51d0a98d70
5
+ SHA512:
6
+ metadata.gz: f09dadc7f90f85cdd8184c54f7d12b4fc70b273ab5c4b7b718f94dc5a5108ee15090267b8543e207b87abccdf3d6d9e5023cdf2174740844cb74d86e9f224509
7
+ data.tar.gz: 2a6bca30ae6e6d35256affb6e694a7acd42f4fed7a0ff73579fea2b955a0f7f752c7ab0b4422b40b65f695345fb536f0b8e0937ea73c9564ef50a63e5bd5048a
@@ -0,0 +1,36 @@
1
+ name: Build
2
+ on:
3
+ - push
4
+ - pull_request
5
+
6
+ jobs:
7
+ build:
8
+ name: Ruby ${{ matrix.ruby }} / Faraday ${{ matrix.faraday }}
9
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - "2.6"
15
+ - "2.7"
16
+ - "3.0"
17
+ - "3.1"
18
+ faraday:
19
+ - "2.0"
20
+ - "2.7"
21
+
22
+ runs-on: "ubuntu-latest"
23
+
24
+ env:
25
+ BUNDLE_GEMFILE: gemfiles/faraday_${{ matrix.faraday }}.gemfile
26
+ RUBYOPT: "--disable-error_highlight"
27
+
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ - name: Setup project
34
+ run: bundle install
35
+ - name: Run tests
36
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -10,6 +10,7 @@ _yardoc
10
10
  bin
11
11
  coverage
12
12
  doc
13
+ gemfiles/*.lock
13
14
  lib/bundler/man
14
15
  pkg
15
16
  rdoc
data/.rspec CHANGED
@@ -1,2 +1 @@
1
- --color
2
- --format progress
1
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ script: bundle exec rspec
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "faraday-2.0" do
2
+ gem "faraday", "2.0.1"
3
+ end
4
+
5
+ appraise "faraday-2.7" do
6
+ gem "faraday", "2.7.1"
7
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## Pew Pew 0.1.0 - November 18, 2022
4
+
5
+ * Support Faraday ~> 2.0
6
+ * Require Ruby >= 2.6
7
+
8
+ ## Pew Pew 0.0.2 - June 5, 2012
9
+
10
+ * Add support for Ruby < 1.9.3.
11
+
12
+ ## Pew Pew 0.0.1 - June 4, 2012
13
+
14
+ * Initial release.
data/README.md CHANGED
@@ -4,6 +4,11 @@ A Ruby client library for using the [Mailgun] web service.
4
4
 
5
5
  [mailgun]: https://mailgun.net/
6
6
 
7
+ [![Build Status][travis-image]][travis]
8
+
9
+ [travis]: http://travis-ci.org/tylerhunt/pew_pew
10
+ [travis-image]: https://secure.travis-ci.org/tylerhunt/pew_pew.png
11
+
7
12
 
8
13
  ## Installation
9
14
 
@@ -67,13 +72,19 @@ PewPew.messages.send_email(
67
72
  ```
68
73
 
69
74
  For resources that require a domain, you may pass it as an option when calling
70
- the resource. If a domain has been configured, it will be used as the default.
75
+ the resource. If a domain has been configured, it will be used as the default
76
+ for all methods called on the resource.
71
77
 
72
78
  ``` ruby
73
79
  PewPew.stats.all # uses the configured domain
74
80
  PewPew.stats(domain: 'example.com').all # uses example.com
75
81
  ```
76
82
 
83
+ See the [documentation][] for the complete [list of resources][resources].
84
+
85
+ [documentation]: http://rubydoc.info/gems/pew_pew/frames
86
+ [resources]: http://rubydoc.info/gems/pew_pew/frames/PewPew/Resources
87
+
77
88
 
78
89
  ## Contributing
79
90
 
@@ -82,3 +93,9 @@ PewPew.stats(domain: 'example.com').all # uses example.com
82
93
  3. Commit your changes (`git commit -am 'Add some feature.'`)
83
94
  4. Push to the branch (`git push origin my-new-feature`)
84
95
  5. Create a new Pull Request
96
+
97
+
98
+ ## Copyright
99
+
100
+ Copyright © 2012 Tyler Hunt.
101
+ Released under the terms of the MIT license. See LICENSE for details.
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "2.0.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "2.7.1"
6
+
7
+ gemspec path: "../"
@@ -5,5 +5,5 @@ module PewPew
5
5
  end
6
6
  private :domain
7
7
  end
8
- private_constant :Domain
8
+ private_constant :Domain if respond_to?(:private_constant) # >= 1.9.3
9
9
  end
@@ -1,10 +1,12 @@
1
- require 'faraday_middleware'
1
+ require 'faraday'
2
+ require 'faraday/mashify'
3
+ require 'faraday/multipart'
2
4
 
3
5
  module PewPew
4
6
  module Resource
5
7
  include Relax::Resource
6
8
 
7
- class ResponseDecorator < Faraday::Response::Middleware
9
+ class ResponseDecorator < Faraday::Middleware
8
10
  def on_complete(env)
9
11
  if env[:body].is_a?(Array)
10
12
  items = env[:body]
@@ -36,16 +38,16 @@ module PewPew
36
38
  private :delete
37
39
 
38
40
  def connection
39
- super do |builder|
40
- builder.basic_auth(Config::USERNAME, config.api_key)
41
+ super { |builder|
42
+ builder.set_basic_auth Config::USERNAME, config.api_key
41
43
 
42
- builder.use(ResponseDecorator)
43
- builder.response(:mashify, mash_class: Response)
44
- builder.response(:json)
44
+ builder.use ResponseDecorator
45
+ builder.response :mashify, mash_class: Response
46
+ builder.response :json, content_type: //
45
47
 
46
- builder.request(:multipart)
47
- builder.request(:url_encoded)
48
- end
48
+ builder.request :multipart
49
+ builder.request :url_encoded
50
+ }
49
51
  end
50
52
  private :connection
51
53
  end
@@ -1,3 +1,3 @@
1
1
  module PewPew
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
data/pew_pew.gemspec CHANGED
@@ -1,20 +1,26 @@
1
1
  require './lib/pew_pew/version'
2
2
 
3
- Gem::Specification.new do |gem|
4
- gem.name = 'pew_pew'
5
- gem.version = PewPew::VERSION
6
- gem.summary = 'A Ruby client library for using the Mailgun web service.'
7
- gem.homepage = 'http://github.com/tylerhunt/pew_pew'
8
- gem.author = 'Tyler Hunt'
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'pew_pew'
5
+ spec.version = PewPew::VERSION
6
+ spec.authors = ['Tyler Hunt']
7
+ spec.summary = 'A Ruby client library for using the Mailgun web service.'
8
+ spec.homepage = 'http://github.com/tylerhunt/pew_pew'
9
+ spec.license = 'MIT'
9
10
 
10
- gem.add_dependency 'faraday_middleware', '~> 0.8.0'
11
- gem.add_dependency 'hashie', '~> 1.1'
12
- gem.add_dependency 'relax', '~> 0.2.0'
13
- gem.add_development_dependency 'rspec', '~> 2.6'
14
- gem.add_development_dependency 'vcr', '~> 2.2'
11
+ spec.required_ruby_version = '>= 2.6'
15
12
 
16
- gem.files = `git ls-files`.split($\)
17
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ['lib']
13
+ spec.add_dependency 'faraday-mashify'
14
+ spec.add_dependency 'faraday-multipart'
15
+ spec.add_dependency 'hashie', '~> 1.1'
16
+ spec.add_dependency 'relax', '~> 0.3.0'
17
+ spec.add_development_dependency 'appraisal', '~> 2.4'
18
+ spec.add_development_dependency 'rspec', '~> 3.12'
19
+ spec.add_development_dependency 'rspec-its', '~> 1.3'
20
+ spec.add_development_dependency 'vcr', '~> 6.1'
21
+
22
+ spec.files = `git ls-files`.split($\)
23
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
24
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
+ spec.require_paths = ['lib']
20
26
  end
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: address=test%40example.com&code=554&error=Relay+access+denied
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  Content-Type:
@@ -44,7 +44,7 @@ http_interactions:
44
44
  string: ''
45
45
  headers:
46
46
  User-Agent:
47
- - PewPew Ruby Gem 0.0.1
47
+ - <%= user_agent %>
48
48
  Authorization:
49
49
  - Basic <%= basic_auth %>
50
50
  response:
@@ -79,7 +79,7 @@ http_interactions:
79
79
  string: ''
80
80
  headers:
81
81
  User-Agent:
82
- - PewPew Ruby Gem 0.0.1
82
+ - <%= user_agent %>
83
83
  Authorization:
84
84
  - Basic <%= basic_auth %>
85
85
  response:
@@ -115,7 +115,7 @@ http_interactions:
115
115
  string: ''
116
116
  headers:
117
117
  User-Agent:
118
- - PewPew Ruby Gem 0.0.1
118
+ - <%= user_agent %>
119
119
  Authorization:
120
120
  - Basic <%= basic_auth %>
121
121
  response:
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: name=Test&id=test
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  Content-Type:
@@ -44,7 +44,7 @@ http_interactions:
44
44
  string: ''
45
45
  headers:
46
46
  User-Agent:
47
- - PewPew Ruby Gem 0.0.1
47
+ - <%= user_agent %>
48
48
  Authorization:
49
49
  - Basic <%= basic_auth %>
50
50
  response:
@@ -77,7 +77,7 @@ http_interactions:
77
77
  string: name=Test
78
78
  headers:
79
79
  User-Agent:
80
- - PewPew Ruby Gem 0.0.1
80
+ - <%= user_agent %>
81
81
  Authorization:
82
82
  - Basic <%= basic_auth %>
83
83
  Content-Type:
@@ -113,7 +113,7 @@ http_interactions:
113
113
  string: ''
114
114
  headers:
115
115
  User-Agent:
116
- - PewPew Ruby Gem 0.0.1
116
+ - <%= user_agent %>
117
117
  Authorization:
118
118
  - Basic <%= basic_auth %>
119
119
  response:
@@ -151,7 +151,7 @@ http_interactions:
151
151
  string: ''
152
152
  headers:
153
153
  User-Agent:
154
- - PewPew Ruby Gem 0.0.1
154
+ - <%= user_agent %>
155
155
  Authorization:
156
156
  - Basic <%= basic_auth %>
157
157
  response:
@@ -185,7 +185,7 @@ http_interactions:
185
185
  string: ''
186
186
  headers:
187
187
  User-Agent:
188
- - PewPew Ruby Gem 0.0.1
188
+ - <%= user_agent %>
189
189
  Authorization:
190
190
  - Basic <%= basic_auth %>
191
191
  response:
@@ -216,7 +216,7 @@ http_interactions:
216
216
  string: ''
217
217
  headers:
218
218
  User-Agent:
219
- - PewPew Ruby Gem 0.0.1
219
+ - <%= user_agent %>
220
220
  Authorization:
221
221
  - Basic <%= basic_auth %>
222
222
  response:
@@ -249,7 +249,7 @@ http_interactions:
249
249
  string: ''
250
250
  headers:
251
251
  User-Agent:
252
- - PewPew Ruby Gem 0.0.1
252
+ - <%= user_agent %>
253
253
  Authorization:
254
254
  - Basic <%= basic_auth %>
255
255
  response:
@@ -280,7 +280,7 @@ http_interactions:
280
280
  string: ''
281
281
  headers:
282
282
  User-Agent:
283
- - PewPew Ruby Gem 0.0.1
283
+ - <%= user_agent %>
284
284
  Authorization:
285
285
  - Basic <%= basic_auth %>
286
286
  response:
@@ -311,7 +311,7 @@ http_interactions:
311
311
  string: ''
312
312
  headers:
313
313
  User-Agent:
314
- - PewPew Ruby Gem 0.0.1
314
+ - <%= user_agent %>
315
315
  Authorization:
316
316
  - Basic <%= basic_auth %>
317
317
  response:
@@ -342,7 +342,7 @@ http_interactions:
342
342
  string: ''
343
343
  headers:
344
344
  User-Agent:
345
- - PewPew Ruby Gem 0.0.1
345
+ - <%= user_agent %>
346
346
  Authorization:
347
347
  - Basic <%= basic_auth %>
348
348
  response:
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: address=test%40example.com
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  Content-Type:
@@ -44,7 +44,7 @@ http_interactions:
44
44
  string: ''
45
45
  headers:
46
46
  User-Agent:
47
- - PewPew Ruby Gem 0.0.1
47
+ - <%= user_agent %>
48
48
  Authorization:
49
49
  - Basic <%= basic_auth %>
50
50
  response:
@@ -78,7 +78,7 @@ http_interactions:
78
78
  string: ''
79
79
  headers:
80
80
  User-Agent:
81
- - PewPew Ruby Gem 0.0.1
81
+ - <%= user_agent %>
82
82
  Authorization:
83
83
  - Basic <%= basic_auth %>
84
84
  response:
@@ -113,7 +113,7 @@ http_interactions:
113
113
  string: ''
114
114
  headers:
115
115
  User-Agent:
116
- - PewPew Ruby Gem 0.0.1
116
+ - <%= user_agent %>
117
117
  Authorization:
118
118
  - Basic <%= basic_auth %>
119
119
  response:
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: address=newsletter%40pewpew.mailgun.org&description=Weekly+News+and+Updates&name=Newsletter
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  Content-Type:
@@ -46,7 +46,7 @@ http_interactions:
46
46
  string: ''
47
47
  headers:
48
48
  User-Agent:
49
- - PewPew Ruby Gem 0.0.1
49
+ - <%= user_agent %>
50
50
  Authorization:
51
51
  - Basic <%= basic_auth %>
52
52
  response:
@@ -82,7 +82,7 @@ http_interactions:
82
82
  string: ''
83
83
  headers:
84
84
  User-Agent:
85
- - PewPew Ruby Gem 0.0.1
85
+ - <%= user_agent %>
86
86
  Authorization:
87
87
  - Basic <%= basic_auth %>
88
88
  response:
@@ -118,7 +118,7 @@ http_interactions:
118
118
  string: description=Monthly+News+and+Updates
119
119
  headers:
120
120
  User-Agent:
121
- - PewPew Ruby Gem 0.0.1
121
+ - <%= user_agent %>
122
122
  Authorization:
123
123
  - Basic <%= basic_auth %>
124
124
  Content-Type:
@@ -156,7 +156,7 @@ http_interactions:
156
156
  string: ''
157
157
  headers:
158
158
  User-Agent:
159
- - PewPew Ruby Gem 0.0.1
159
+ - <%= user_agent %>
160
160
  Authorization:
161
161
  - Basic <%= basic_auth %>
162
162
  response:
@@ -190,7 +190,7 @@ http_interactions:
190
190
  string: ''
191
191
  headers:
192
192
  User-Agent:
193
- - PewPew Ruby Gem 0.0.1
193
+ - <%= user_agent %>
194
194
  Authorization:
195
195
  - Basic <%= basic_auth %>
196
196
  response:
@@ -227,7 +227,7 @@ http_interactions:
227
227
  string: address=member%40example.com&name=Member+Name&vars=%7B%22awesome%22%3Atrue%7D
228
228
  headers:
229
229
  User-Agent:
230
- - PewPew Ruby Gem 0.0.1
230
+ - <%= user_agent %>
231
231
  Authorization:
232
232
  - Basic <%= basic_auth %>
233
233
  Content-Type:
@@ -265,7 +265,7 @@ http_interactions:
265
265
  string: ''
266
266
  headers:
267
267
  User-Agent:
268
- - PewPew Ruby Gem 0.0.1
268
+ - <%= user_agent %>
269
269
  Authorization:
270
270
  - Basic <%= basic_auth %>
271
271
  response:
@@ -300,7 +300,7 @@ http_interactions:
300
300
  string: ''
301
301
  headers:
302
302
  User-Agent:
303
- - PewPew Ruby Gem 0.0.1
303
+ - <%= user_agent %>
304
304
  Authorization:
305
305
  - Basic <%= basic_auth %>
306
306
  response:
@@ -336,7 +336,7 @@ http_interactions:
336
336
  string: subscribed=false
337
337
  headers:
338
338
  User-Agent:
339
- - PewPew Ruby Gem 0.0.1
339
+ - <%= user_agent %>
340
340
  Authorization:
341
341
  - Basic <%= basic_auth %>
342
342
  Content-Type:
@@ -374,7 +374,7 @@ http_interactions:
374
374
  string: ''
375
375
  headers:
376
376
  User-Agent:
377
- - PewPew Ruby Gem 0.0.1
377
+ - <%= user_agent %>
378
378
  Authorization:
379
379
  - Basic <%= basic_auth %>
380
380
  response:
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  response:
@@ -8,7 +8,7 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - PewPew Ruby Gem 0.0.1
11
+ - <%= user_agent %>
12
12
  Authorization:
13
13
  - Basic <%= basic_auth %>
14
14
  response:
@@ -43,7 +43,7 @@ http_interactions:
43
43
  string: mailbox=test&password=secret
44
44
  headers:
45
45
  User-Agent:
46
- - PewPew Ruby Gem 0.0.1
46
+ - <%= user_agent %>
47
47
  Authorization:
48
48
  - Basic <%= basic_auth %>
49
49
  Content-Type:
@@ -78,7 +78,7 @@ http_interactions:
78
78
  string: password=s3cr3t
79
79
  headers:
80
80
  User-Agent:
81
- - PewPew Ruby Gem 0.0.1
81
+ - <%= user_agent %>
82
82
  Authorization:
83
83
  - Basic <%= basic_auth %>
84
84
  Content-Type:
@@ -113,7 +113,7 @@ http_interactions:
113
113
  string: ''
114
114
  headers:
115
115
  User-Agent:
116
- - PewPew Ruby Gem 0.0.1
116
+ - <%= user_agent %>
117
117
  Authorization:
118
118
  - Basic <%= basic_auth %>
119
119
  response: