request_migrations 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2224934d0be51149ebf90a756ae9cfd9172ee83310609c9cfc94c49c4c75166
4
- data.tar.gz: 3de2f808de4c02d7de89ec9baae0b5d68cadab94d8118e13688a941de791d3cf
3
+ metadata.gz: '091e4436fcd439967859301cc299fccaf6081f5da326ed79813e7cbce3f4d86c'
4
+ data.tar.gz: 4be2f76ade4958a48794ee62e6184c964f747f6c59a44a12ef20dcbbcc8c32a0
5
5
  SHA512:
6
- metadata.gz: 944f3e23fe55b3d9eb56cdf0491871bfecea72a5c9a57b15f8827152b7cf5a21ab0e0ac6c1f254a9afabe4fc980562b864e96a2868ec864a314d41876e1af987
7
- data.tar.gz: e3fa22992ac3aadcd34ce860310f6a496f4aa7f54179090863bcf993582e2c757fa07677862973b817edc2d209b289284e19ec040249c62011ad20ceb41ee0c6
6
+ metadata.gz: e2a22c88034bd0a67f34849909d85686267a4fd2a62dfbcfcb963766f678397d141a628608b63e0549581fbd9e02184a938619a269c81e44bd1a094d2febe702
7
+ data.tar.gz: d92878fd3a359c744c4cc9354325a5fea7d89ca81e9c3aa2718bd033a8b7ed8f7840f8bce0ada3f170dfb8f3a1ea9f1362cff8b08effafee53ffc0b5b59911c4
data/README.md CHANGED
@@ -17,6 +17,24 @@ Sponsored by:
17
17
 
18
18
  _A software licensing and distribution API built for developers._
19
19
 
20
+ Links:
21
+
22
+ - [Installing request_migrations](#installation)
23
+ - [Supported Ruby versions](#supported-rubies)
24
+ - [RubyDoc](#documentation)
25
+ - [Usage](#usage)
26
+ - [Response migrations](#response-migrations)
27
+ - [Request migrations](#request-migrations)
28
+ - [Data migrations](#data-migrations)
29
+ - [Routing constraints](#routing-constraints)
30
+ - [Configuration](#configuration)
31
+ - [Version formats](#version-formats)
32
+ - [Testing](#testing)
33
+ - [Tips and tricks](#tips-and-tricks)
34
+ - [Credits](#credits)
35
+ - [Contributing](#contributing)
36
+ - [License](#license)
37
+
20
38
  ## Installation
21
39
 
22
40
  Add this line to your application's `Gemfile`:
@@ -39,8 +57,9 @@ $ gem install request_migrations
39
57
 
40
58
  ## Supported Rubies
41
59
 
42
- `request_migrations` supports Ruby 3. We encourage you to upgrade if you're on an older
43
- version. Ruby 3 provides a lot of great features, like better pattern matching.
60
+ **`request_migrations` supports Ruby 3.1 and above.** We encourage you to upgrade if you're on an older
61
+ version. Ruby 3 provides a lot of great features, like better pattern matching and a new shorthand
62
+ hash syntax.
44
63
 
45
64
  ## Documentation
46
65
 
@@ -124,8 +143,8 @@ end
124
143
 
125
144
  As you can see, with pattern matching, it makes creating migrations for certain
126
145
  resources simple. Here, we've defined a migration that only runs for the `users#show`
127
- and `me#show` resources, and only when the response is successfuly. In addition,
128
- the data is only migrated when the response body contains a user.
146
+ resource, and only when the response is successful. In addition, the data is
147
+ only migrated when the response body contains a user.
129
148
 
130
149
  Next, we'll need to configure `request_migrations` via an initializer under
131
150
  `initializers/request_migrations.rb`:
@@ -292,10 +311,11 @@ end
292
311
 
293
312
  This will apply the block defined in `migrate` onto our data. With that,
294
313
  we've successfully applied a migration to both our API responses, as well
295
- as to the webhook events we send. In this case, if our `event` matches the
296
- our user shape, e.g. `type: 'user'`, then the migration will be applied.
314
+ as to the webhook events we send. In this case, if our event data matches
315
+ our expected data shape, e.g. `type: 'user'`, then the migration will
316
+ be applied.
297
317
 
298
- In addition to data migrations, this allows for easier testing.
318
+ In addition to data migrations, this allows for easier [testing](#testing).
299
319
 
300
320
  ### Routing constraints
301
321
 
@@ -406,9 +426,11 @@ end
406
426
  ```
407
427
 
408
428
  To avoid polluting the global configuration, you can use `RequestMigrations::Testing`
409
- within your application's `spec/rails_helper.rb` (or similar).
429
+ within your application's `spec/rails_helper.rb`, or a similar spec helper:
410
430
 
411
431
  ```ruby
432
+ require 'request_migrations/testing'
433
+
412
434
  Rspec.configure do |config|
413
435
  config.before :each do
414
436
  RequestMigrations::Testing.setup!
@@ -420,6 +442,9 @@ Rspec.configure do |config|
420
442
  end
421
443
  ```
422
444
 
445
+ This will setup a new test configuration, and then restore the previous global configuration
446
+ after each spec.
447
+
423
448
  ## Tips and tricks
424
449
 
425
450
  Over the years, we're learned a thing or two about versioning an API. We'll share tips here.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequestMigrations
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
@@ -46,13 +46,16 @@ module RequestMigrations
46
46
  ##
47
47
  # @private
48
48
  def self.config=(cfg)
49
+ raise ArgumentError, 'invalid config provided' unless
50
+ cfg.is_a?(Configuration)
51
+
49
52
  @config = cfg
50
53
  end
51
54
 
52
55
  ##
53
56
  # @private
54
57
  def self.reset!
55
- @config = RequestMigrations::Configuration.new
58
+ @config = Configuration.new
56
59
  end
57
60
 
58
61
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeke Gabrielse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2022-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: '3.0'
91
+ version: '3.1'
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="