pew_pew 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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/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 CHANGED
@@ -1,9 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## Pew Pew 0.0.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
4
9
 
5
10
  * Add support for Ruby < 1.9.3.
6
11
 
7
- ## Pew Pew 0.0.1
12
+ ## Pew Pew 0.0.1 - June 4, 2012
8
13
 
9
14
  * Initial release.
data/README.md CHANGED
@@ -93,3 +93,9 @@ See the [documentation][] for the complete [list of resources][resources].
93
93
  3. Commit your changes (`git commit -am 'Add some feature.'`)
94
94
  4. Push to the branch (`git push origin my-new-feature`)
95
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: "../"
@@ -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.2'
2
+ VERSION = '0.1.0'
3
3
  end
data/pew_pew.gemspec CHANGED
@@ -1,22 +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.required_ruby_version = '>= 1.9'
11
+ spec.required_ruby_version = '>= 2.6'
11
12
 
12
- gem.add_dependency 'faraday_middleware', '~> 0.8.0'
13
- gem.add_dependency 'hashie', '~> 1.1'
14
- gem.add_dependency 'relax', '~> 0.2.0'
15
- gem.add_development_dependency 'rspec', '~> 2.6'
16
- gem.add_development_dependency 'vcr', '~> 2.2'
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'
17
21
 
18
- gem.files = `git ls-files`.split($\)
19
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
20
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
- gem.require_paths = ['lib']
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']
22
26
  end
@@ -4,8 +4,8 @@ http_interactions:
4
4
  method: post
5
5
  uri: https://api.mailgun.net/v2/<%= domain %>/messages
6
6
  body:
7
- encoding: US-ASCII
8
- string: to=pewpew%40devoh.com&from=pewpew%40devoh.com&subject=Test&text=This+is+a+test+message.
7
+ encoding: UTF-8
8
+ string: from=pewpew%40devoh.com&subject=Test&text=This+is+a+test+message.&to=pewpew%40devoh.com
9
9
  headers:
10
10
  User-Agent:
11
11
  - <%= user_agent %>
@@ -16,140 +16,162 @@ http_interactions:
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message:
19
+ message: OK
20
20
  headers:
21
- server:
22
- - nginx/1.0.14
23
- date:
24
- - Thu, 24 May 2012 08:00:44 GMT
25
- content-type:
26
- - application/json
27
- connection:
28
- - close
21
+ access-control-allow-credentials:
22
+ - 'true'
23
+ access-control-allow-origin:
24
+ - "*"
25
+ cache-control:
26
+ - no-store
29
27
  content-length:
30
- - '96'
31
- content-disposition:
32
- - inline
28
+ - '93'
29
+ content-type:
30
+ - application/json; charset=utf-8
31
+ date:
32
+ - Fri, 18 Nov 2022 02:40:49 GMT
33
+ strict-transport-security:
34
+ - max-age=63072000; includeSubDomains
35
+ x-ratelimit-limit:
36
+ - '4000000'
37
+ x-ratelimit-remaining:
38
+ - '3999999'
39
+ x-ratelimit-reset:
40
+ - '1668739258933'
41
+ x-recipient-limit:
42
+ - '2000000'
43
+ x-recipient-remaining:
44
+ - '1999999'
45
+ x-recipient-reset:
46
+ - '1668739258933'
47
+ x-xss-protection:
48
+ - 1; mode=block
33
49
  body:
34
- encoding: US-ASCII
35
- string: ! "{\n \"message\": \"Queued. Thank you.\",\n \"id\": \"<20120524080044.27067.73085@pewpew.mailgun.org>\"\n}"
36
- http_version:
37
- recorded_at: Thu, 24 May 2012 08:00:44 GMT
50
+ encoding: UTF-8
51
+ string: '{"id":"<20221118024049.bcdf841f319da0e8@pewpew.mailgun.org>","message":"Queued.
52
+ Thank you."}
53
+
54
+ '
55
+ recorded_at: Fri, 18 Nov 2022 02:40:49 GMT
38
56
  - request:
39
57
  method: post
40
58
  uri: https://api.mailgun.net/v2/<%= domain %>/messages
41
59
  body:
42
60
  encoding: ASCII-8BIT
43
61
  string: !binary |-
44
- LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0DQpDb250ZW50LURpc3Bv
45
- c2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9InRvIg0KDQpwZXdwZXdAZGV2b2gu
46
- Y29tDQotLS0tLS0tLS0tLS0tUnVieU11bHRpcGFydFBvc3QNCkNvbnRlbnQt
47
- RGlzcG9zaXRpb246IGZvcm0tZGF0YTsgbmFtZT0iZnJvbSINCg0KcGV3cGV3
48
- QGRldm9oLmNvbQ0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0DQpD
49
- b250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9InN1YmplY3Qi
50
- DQoNClRlc3QNCi0tLS0tLS0tLS0tLS1SdWJ5TXVsdGlwYXJ0UG9zdA0KQ29u
51
- dGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJ0ZXh0Ig0KD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VlM2FlOQ0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJ0ZXh0Ig0KDQpUaGlzIGlzIGEgdGVzdCBtZXNzYWdlLg0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LWZkNjMxNDkwYWU0NzU0ZjAzODY3ZjBkZWFhZWUzYWU5DQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImF0dGFjaG1lbnQiOyBmaWxlbmFtZT0iaW1hZ2UucG5nIg0KQ29udGVudC1MZW5ndGg6IDY3DQpDb250ZW50LVR5cGU6IGltYWdlL3BuZw0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmluYXJ5DQoNColQTkcNChoKAAAADUlIRFIAAAABAAAAAQgGAAAAHxXEiQAAAApJREFUeJxjAAEAAAUAAQ0KLbQAAAAASUVORK5CYIINCi0tLS0tLS0tLS0tLS1SdWJ5TXVsdGlwYXJ0UG9zdC1mZDYzMTQ5MGFlNDc1NGYwMzg2N2YwZGVhYWVlM2FlOS0tDQo=
60
63
  headers:
61
64
  User-Agent:
62
65
  - <%= user_agent %>
63
66
  Authorization:
64
67
  - Basic <%= basic_auth %>
65
68
  Content-Type:
66
- - multipart/form-data;boundary=-----------RubyMultipartPost
69
+ - multipart/form-data; boundary=-----------RubyMultipartPost-fd631490ae4754f03867f0deaaee3ae9
67
70
  Content-Length:
68
- - '676'
71
+ - '872'
69
72
  response:
70
73
  status:
71
74
  code: 200
72
- message:
75
+ message: OK
73
76
  headers:
74
- server:
75
- - nginx/1.0.14
76
- date:
77
- - Tue, 29 May 2012 23:22:22 GMT
78
- content-type:
79
- - application/json
80
- connection:
81
- - close
77
+ access-control-allow-credentials:
78
+ - 'true'
79
+ access-control-allow-origin:
80
+ - "*"
81
+ cache-control:
82
+ - no-store
82
83
  content-length:
83
- - '95'
84
- content-disposition:
85
- - inline
84
+ - '93'
85
+ content-type:
86
+ - application/json; charset=utf-8
87
+ date:
88
+ - Fri, 18 Nov 2022 02:40:49 GMT
89
+ strict-transport-security:
90
+ - max-age=63072000; includeSubDomains
91
+ x-ratelimit-limit:
92
+ - '4000000'
93
+ x-ratelimit-remaining:
94
+ - '3999998'
95
+ x-ratelimit-reset:
96
+ - '1668739258933'
97
+ x-recipient-limit:
98
+ - '2000000'
99
+ x-recipient-remaining:
100
+ - '1999998'
101
+ x-recipient-reset:
102
+ - '1668739258933'
103
+ x-xss-protection:
104
+ - 1; mode=block
86
105
  body:
87
- encoding: US-ASCII
88
- string: ! "{\n \"message\": \"Queued. Thank you.\",\n \"id\": \"<20120529232222.4550.70051@pewpew.mailgun.org>\"\n}"
89
- http_version:
90
- recorded_at: Tue, 29 May 2012 23:22:22 GMT
106
+ encoding: UTF-8
107
+ string: '{"id":"<20221118024049.7a75b8c6cc931f53@pewpew.mailgun.org>","message":"Queued.
108
+ Thank you."}
109
+
110
+ '
111
+ recorded_at: Fri, 18 Nov 2022 02:40:49 GMT
91
112
  - request:
92
113
  method: post
93
114
  uri: https://api.mailgun.net/v2/<%= domain %>/messages
94
115
  body:
95
116
  encoding: ASCII-8BIT
96
117
  string: !binary |-
97
- LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0DQpDb250ZW50LURpc3Bv
98
- c2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9InRvIg0KDQpwZXdwZXdAZGV2b2gu
99
- Y29tDQotLS0tLS0tLS0tLS0tUnVieU11bHRpcGFydFBvc3QNCkNvbnRlbnQt
100
- RGlzcG9zaXRpb246IGZvcm0tZGF0YTsgbmFtZT0iZnJvbSINCg0KcGV3cGV3
101
- QGRldm9oLmNvbQ0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0DQpD
102
- b250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9InN1YmplY3Qi
103
- DQoNClRlc3QNCi0tLS0tLS0tLS0tLS1SdWJ5TXVsd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zg4M2Y0ZDBhZS0tDQo=
115
119
  headers:
116
120
  User-Agent:
117
121
  - <%= user_agent %>
118
122
  Authorization:
119
123
  - Basic <%= basic_auth %>
120
124
  Content-Type:
121
- - multipart/form-data;boundary=-----------RubyMultipartPost
125
+ - multipart/form-data; boundary=-----------RubyMultipartPost-a20a6d8337ccbd212169ac3883f4d0ae
122
126
  Content-Length:
123
- - '802'
127
+ - '1031'
124
128
  response:
125
129
  status:
126
130
  code: 200
127
- message:
131
+ message: OK
128
132
  headers:
129
- server:
130
- - nginx/1.0.14
131
- date:
132
- - Tue, 29 May 2012 23:45:26 GMT
133
- content-type:
134
- - application/json
135
- connection:
136
- - close
133
+ access-control-allow-credentials:
134
+ - 'true'
135
+ access-control-allow-origin:
136
+ - "*"
137
+ cache-control:
138
+ - no-store
137
139
  content-length:
138
- - '97'
139
- content-disposition:
140
- - inline
140
+ - '93'
141
+ content-type:
142
+ - application/json; charset=utf-8
143
+ date:
144
+ - Fri, 18 Nov 2022 02:40:49 GMT
145
+ strict-transport-security:
146
+ - max-age=63072000; includeSubDomains
147
+ x-ratelimit-limit:
148
+ - '4000000'
149
+ x-ratelimit-remaining:
150
+ - '3999997'
151
+ x-ratelimit-reset:
152
+ - '1668739258933'
153
+ x-recipient-limit:
154
+ - '2000000'
155
+ x-recipient-remaining:
156
+ - '1999997'
157
+ x-recipient-reset:
158
+ - '1668739258933'
159
+ x-xss-protection:
160
+ - 1; mode=block
141
161
  body:
142
- encoding: US-ASCII
143
- string: ! "{\n \"message\": \"Queued. Thank you.\", \n \"id\": \"<20120529234526.13436.15849@pewpew.mailgun.org>\"\n}"
144
- http_version:
145
- recorded_at: Tue, 29 May 2012 23:45:26 GMT
162
+ encoding: UTF-8
163
+ string: '{"id":"<20221118024049.4dd8e5980d33aba1@pewpew.mailgun.org>","message":"Queued.
164
+ Thank you."}
165
+
166
+ '
167
+ recorded_at: Fri, 18 Nov 2022 02:40:49 GMT
146
168
  - request:
147
169
  method: post
148
170
  uri: https://api.mailgun.net/v2/<%= domain %>/messages.mime
149
171
  body:
150
- encoding: US-ASCII
151
- string: ! "-------------RubyMultipartPost\r\nContent-Disposition: form-data;
152
- name=\"to\"\r\n\r\npewpew@devoh.com\r\n-------------RubyMultipartPost\r\nContent-Disposition:
172
+ encoding: UTF-8
173
+ string: "-------------RubyMultipartPost-db1e8de197dfbe11e940a63d75da98fa\r\nContent-Disposition:
174
+ form-data; name=\"to\"\r\n\r\npewpew@devoh.com\r\n-------------RubyMultipartPost-db1e8de197dfbe11e940a63d75da98fa\r\nContent-Disposition:
153
175
  form-data; name=\"message\"; filename=\"mime.eml\"\r\nContent-Length: 931\r\nContent-Type:
154
176
  message/rfc822\r\nContent-Transfer-Encoding: binary\r\n\r\nDate: Thu, 31 May
155
177
  2012 21:17:55 -0700\nFrom: pewpew@devoh.com\nTo: pewpew@devoh.com\nMessage-ID:
@@ -161,36 +183,56 @@ http_interactions:
161
183
  is a test message.\n\n----==_mimepart_4fc8427374a4_48dd3fe70cc34cd059187\nDate:
162
184
  Thu, 31 May 2012 21:17:55 -0700\nMime-Version: 1.0\nContent-Type: text/html;\n
163
185
  charset=UTF-8\nContent-Transfer-Encoding: 7bit\nContent-ID: <4fc84273b619_48dd3fe70cc34cd05937b@rouge.local.mail>\n\n<p>This
164
- is a test message.<p>\n\n----==_mimepart_4fc8427374a4_48dd3fe70cc34cd059187--\n\r\n-------------RubyMultipartPost--\r\n\r\n"
186
+ is a test message.<p>\n\n----==_mimepart_4fc8427374a4_48dd3fe70cc34cd059187--\n\r\n-------------RubyMultipartPost-db1e8de197dfbe11e940a63d75da98fa--\r\n"
165
187
  headers:
166
188
  User-Agent:
167
189
  - <%= user_agent %>
168
190
  Authorization:
169
191
  - Basic <%= basic_auth %>
170
192
  Content-Type:
171
- - multipart/form-data;boundary=-----------RubyMultipartPost
193
+ - multipart/form-data; boundary=-----------RubyMultipartPost-db1e8de197dfbe11e940a63d75da98fa
172
194
  Content-Length:
173
- - '1253'
195
+ - '1350'
174
196
  response:
175
197
  status:
176
198
  code: 200
177
- message:
199
+ message: OK
178
200
  headers:
179
- server:
180
- - nginx/1.0.14
181
- date:
182
- - Fri, 01 Jun 2012 04:19:03 GMT
183
- content-type:
184
- - application/json
185
- connection:
186
- - close
201
+ access-control-allow-credentials:
202
+ - 'true'
203
+ access-control-allow-origin:
204
+ - "*"
205
+ cache-control:
206
+ - no-store
187
207
  content-length:
188
- - '102'
189
- content-disposition:
190
- - inline
208
+ - '94'
209
+ content-type:
210
+ - application/json; charset=utf-8
211
+ date:
212
+ - Fri, 18 Nov 2022 02:40:50 GMT
213
+ strict-transport-security:
214
+ - max-age=63072000; includeSubDomains
215
+ x-ratelimit-limit:
216
+ - '4000000'
217
+ x-ratelimit-remaining:
218
+ - '3999996'
219
+ x-ratelimit-reset:
220
+ - '1668739258933'
221
+ x-recipient-limit:
222
+ - '2000000'
223
+ x-recipient-remaining:
224
+ - '1999996'
225
+ x-recipient-reset:
226
+ - '1668739258933'
227
+ x-server:
228
+ - influx
229
+ x-xss-protection:
230
+ - 1; mode=block
191
231
  body:
192
- encoding: US-ASCII
193
- string: ! "{\n \"message\": \"Queued. Thank you.\",\n \"id\": \"<4fc84273c474_48dd3fe70cc34cd05949d@rouge.local.mail>\"\n}"
194
- http_version:
195
- recorded_at: Fri, 01 Jun 2012 04:19:09 GMT
196
- recorded_with: VCR 2.2.0
232
+ encoding: UTF-8
233
+ string: '{"id":"<4fc84273c474_48dd3fe70cc34cd05949d@rouge.local.mail>","message":"Queued.
234
+ Thank you."}
235
+
236
+ '
237
+ recorded_at: Fri, 18 Nov 2022 02:40:50 GMT
238
+ recorded_with: VCR 6.1.0
@@ -1,51 +1,59 @@
1
- require 'spec_helper'
1
+ module PewPew
2
+ RSpec.describe Client do
3
+ context '#config' do
4
+ subject { described_class.new.config }
2
5
 
3
- describe PewPew::Client do
4
- context '#config' do
5
- subject { described_class.new.config }
6
+ its(:adapter) { should == Faraday.default_adapter }
7
+ its(:base_uri) { should == Config::BASE_URI }
8
+ its(:user_agent) { should == Config::USER_AGENT }
6
9
 
7
- its(:adapter) { should == Faraday.default_adapter }
8
- its(:base_uri) { should == PewPew::Config::BASE_URI }
9
- its(:user_agent) { should == PewPew::Config::USER_AGENT }
10
+ its(:api_key) { should be_nil }
11
+ its(:domain) { should be_nil }
12
+ end
10
13
 
11
- its(:api_key) { should be_nil }
12
- its(:domain) { should be_nil }
13
- end
14
+ context '#configure' do
15
+ let(:client) { described_class.new }
14
16
 
15
- context '#configure' do
16
- subject do
17
- described_class.new.configure do |config|
18
- config.adapter = :typhoeus
19
- config.base_uri = 'https://api.mailgun.com/v2'
20
- config.user_agent = 'A PewPew Application'
17
+ before do
18
+ client.configure do |config|
19
+ config.adapter = :typhoeus
20
+ config.base_uri = 'https://api.mailgun.com/v2'
21
+ config.user_agent = 'A PewPew Application'
21
22
 
22
- config.api_key = 'key-02n9f3ijl9sm9u97-8p7r-d7-15q-ui1'
23
- config.domain = 'pewpew.mailgun.org'
23
+ config.api_key = 'key-02n9f3ijl9sm9u97-8p7r-d7-15q-ui1'
24
+ config.domain = 'pewpew.mailgun.org'
25
+ end
24
26
  end
25
- end
26
27
 
27
- its(:adapter) { should == :typhoeus }
28
- its(:base_uri) { should == 'https://api.mailgun.com/v2' }
29
- its(:user_agent) { should == 'A PewPew Application' }
28
+ subject { client.config }
30
29
 
31
- its(:api_key) { should == 'key-02n9f3ijl9sm9u97-8p7r-d7-15q-ui1' }
32
- its(:domain) { should == 'pewpew.mailgun.org' }
33
- end
30
+ its(:adapter) { should == :typhoeus }
31
+ its(:base_uri) { should == 'https://api.mailgun.com/v2' }
32
+ its(:user_agent) { should == 'A PewPew Application' }
34
33
 
35
- {
36
- bounces: PewPew::Resources::Bounces,
37
- campaigns: PewPew::Resources::Campaigns,
38
- complaints: PewPew::Resources::Complaints,
39
- lists: PewPew::Resources::Lists,
40
- logs: PewPew::Resources::Logs,
41
- mailboxes: PewPew::Resources::Mailboxes,
42
- messages: PewPew::Resources::Messages,
43
- routes: PewPew::Resources::Routes,
44
- stats: PewPew::Resources::Stats,
45
- unsubscribes: PewPew::Resources::Unsubscribes,
46
- }.each do |method, resource_class|
47
- context "##{method}" do
48
- specify { subject.send(method).should be_a(resource_class) }
34
+ its(:api_key) { should == 'key-02n9f3ijl9sm9u97-8p7r-d7-15q-ui1' }
35
+ its(:domain) { should == 'pewpew.mailgun.org' }
36
+ end
37
+
38
+ {
39
+ bounces: Resources::Bounces,
40
+ campaigns: Resources::Campaigns,
41
+ complaints: Resources::Complaints,
42
+ lists: Resources::Lists,
43
+ logs: Resources::Logs,
44
+ mailboxes: Resources::Mailboxes,
45
+ messages: Resources::Messages,
46
+ routes: Resources::Routes,
47
+ stats: Resources::Stats,
48
+ unsubscribes: Resources::Unsubscribes,
49
+ }.each do |method, resource_class|
50
+ context "##{method}" do
51
+ specify {
52
+ resource = subject.send(method)
53
+
54
+ expect(resource).to be_a resource_class
55
+ }
56
+ end
49
57
  end
50
58
  end
51
59
  end