decanter 3.0.0 → 3.0.1

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: ba861d2437b9eb12f96d0ec704fd942bdc9d1883759b3e30b17b223e936c1c3e
4
- data.tar.gz: f475da814ab3af68c80452de399a4f633403b9ff1fb5756087f9f0eac04b7679
3
+ metadata.gz: d88913e453daf9b338ba361c9d0bcf8bd460c6cbf8f9ba9c8690f8bb72072350
4
+ data.tar.gz: 4831a0a79c97caaf4ebe48123e2ae77baa5bf15a95b911e639ead8c43c428186
5
5
  SHA512:
6
- metadata.gz: cce2d74bc1e8437510b4a10c586f1cfd67d914d63cd9571c88d3290f1fc08d0050e5950c16ced0b9696548c39b93bc0c20329c2633bd60196b48b8acca9f1c2f
7
- data.tar.gz: 90a256b4b3a30e18017b7b4cf471b72425446319dd2ca0a516d9ecb475e014f7717dc7071ba5898d24c9720d562991e228edbbc0e15eb5757d4443d3687d3b37
6
+ metadata.gz: 5b16bca4f276b1aceefb952104e38675ba0bea4792ef4d9b30e61d1b0501ed1dff9d832f97cb17cc2db62711c644e12183900ded11d6382dea0830a91f38c28a
7
+ data.tar.gz: 19b9c671278b61dc7a903f2df4861c606914585165bfa3bfd81f82d950db6fa02328ee3d25ead2dd9048690b92238856d7fd8b833def2bc40b045d405c3a4832
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug with Decanter
4
+ labels: bug
5
+ ---
6
+
7
+ <!--
8
+ Please fill out this template with all the relevant information so we can
9
+ understand what's going on and fix the issue. We encourage you to submit a PR
10
+ to fix the reported issue!
11
+ -->
12
+
13
+ ## Environment
14
+
15
+ - `decanter` version:
16
+ - `ruby` version:
17
+ - `rails` version:
18
+
19
+ ## Expected Behavior
20
+
21
+ ## Current Behavior
22
+
23
+ ## Steps to Reproduce
24
+ <!--
25
+ If possible, please create a repository that reproduces the issue with the
26
+ minimal amount of code possible.
27
+ -->
28
+
29
+ ## Suggested Solution
30
+ <!--
31
+ It's ok if you don't have a suggested solution, but please let us know if you
32
+ have any ideas!
33
+ -->
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a feature for Decanter
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Feature Description
8
+
9
+ ## Suggested Solution
10
+ <!--
11
+ It's ok if you don't have a suggested solution, but please let us know if you
12
+ have any ideas!
13
+ -->
14
+
15
+ ## Alternatives Considered / Existing Workarounds
16
+
17
+ ## Additional Context
18
+ <!-- Add other information, screenshots, etc. about the request here -->
@@ -0,0 +1,8 @@
1
+ ## Items Addressed
2
+ <!-- Include description and link to resolved issue(s) here. -->
3
+
4
+ ## Author Checklist
5
+ - [ ] Add unit test(s)
6
+ - [ ] Update documentation (if necessary)
7
+ - [ ] Update version in `version.rb` following [versioning guidelines](https://github.com/LaunchPadLab/opex/blob/master/gists/gem-guidelines.md#pull-requests-and-deployments)
8
+
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [conor@launchpadlab.com](mailto:conor@launchpadlab.com). All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -0,0 +1,36 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing! This project follows our [Gem guidelines](https://github.com/LaunchPadLab/opex/blob/master/gists/gem-guidelines.md).
4
+
5
+ ## Code of Conduct
6
+
7
+ We expect all participants to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md).
8
+
9
+ ## How Can I Contribute?
10
+
11
+ There are several ways to contribute to this project, including (but not limited to):
12
+
13
+ - Reporting bugs
14
+ - Requesting features
15
+ - Responding to bug reports / feature requests
16
+ - Submitting PR(s) that address issues labeled with "help wanted"
17
+ - Updating documentation
18
+
19
+ Before making a contribution, search through the existing [issues](https://github.com/LaunchPadLab/decanter/issues) and [pull requests](https://github.com/LaunchPadLab/decanter/pulls) to see if your item has already been raised or addressed. If there is an existing **open** issue that impacts you, it is best practice to upvote (👍) the initial comment as opposed to adding an additional comment voicing your support. The latter creates noise for the LaunchPad Lab team and makes it difficult for us to quickly and effectively rank issues according to the community's priority.
20
+
21
+ ## Getting Started Locally
22
+ 1. Fork and clone the repo
23
+ 1. Run `bundle` to install dependencies
24
+ 1. Run `rspec` to run unit tests
25
+ 1. Load development changes in a local application in your Gemfile
26
+ ```ruby
27
+ gem "decanter", path: "/path/to/repo"
28
+ ```
29
+
30
+ ## Proposing a Change
31
+ For any non-trivial change, we prefer an issue to be created first. This helps us (and you!) save time and keep track of conversations and decisions made regarding the project.
32
+
33
+ ### Sending a Pull Request
34
+ If this is your first Pull Request, we recommend learning how to navigate GitHub via this free video tutorial: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).
35
+
36
+ The LaunchPad Lab team monitors this repository for pull requests. Once a pull request has been created from a forked repository that **meets all the guidelines** outlined in the [Pull Request Checklist](.github/PULL_REQUEST_TEMPLATE.md), we will review the request and either merge it, request changes, or close it with an explanation. We aim to respond to pull requests within 48 hours.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decanter (3.0.0)
4
+ decanter (3.0.1)
5
5
  actionpack (>= 4.2.10)
6
6
  activesupport
7
7
  rails-html-sanitizer (>= 1.0.4)
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # Decanter
2
2
 
3
- Decanter is a Ruby gem that makes it easy to transform incoming data before it hits the model.
3
+ Decanter is a Ruby gem that makes it easy to transform incoming data before it hits the model. You can think of Decanter as the opposite of Active Model Serializers (AMS). While AMS transforms your outbound data into a format that your frontend consumes, Decanter transforms your incoming data into a format that your backend consumes.
4
4
 
5
5
  ```ruby
6
6
  gem 'decanter', '~> 3.0'
7
7
  ```
8
8
 
9
+ ## Migration Guides
10
+
11
+ - [v3.0.0](migration-guides/v3.0.0.md)
12
+
9
13
  ## Contents
10
14
 
11
- - [Migration guides](#migration-guides)
12
15
  - [Basic Usage](#basic-usage)
13
16
  - [Decanters](#decanters)
14
17
  - [Generators](#generators)
@@ -22,10 +25,7 @@ gem 'decanter', '~> 3.0'
22
25
  - [Chaining parsers](#chaining-parsers)
23
26
  - [Requiring params](#requiring-params)
24
27
  - [Global configuration](#global-configuration)
25
-
26
- ## Migration Guides
27
-
28
- - [v3.0.0](migration-guides/v3.0.0.md)
28
+ - [Contributing](#contributing)
29
29
 
30
30
  ## Basic Usage
31
31
 
@@ -43,14 +43,15 @@ class TripDecanter < Decanter::Base
43
43
  end
44
44
  ```
45
45
 
46
- Transform incoming params in your controller using `Decanter#decant`:
46
+ Then, transform incoming params in your controller using `Decanter#decant`:
47
47
 
48
48
  ```rb
49
49
  # app/controllers/trips_controller.rb
50
50
 
51
51
  def create
52
- trip_params = TripDecanter.decant(params[:trip])
53
- @trip = Trip.new(trip_params)
52
+ trip_params = params.require(:trip) # or params[:trip] if you are not using Strong Parameters
53
+ decanted_trip_params = TripDecanter.decant(trip_params)
54
+ @trip = Trip.new(decanted_trip_params)
54
55
 
55
56
  # ...any response logic
56
57
  end
@@ -79,6 +80,8 @@ class TripDecanter < Decanter::Base
79
80
  end
80
81
  ```
81
82
 
83
+ This decanter will look up and apply the corresponding `DestinationDecanter` whenever necessary to transform nested resources.
84
+
82
85
  ### Default parsers
83
86
 
84
87
  Decanter comes with the following parsers out of the box:
@@ -107,8 +110,6 @@ Parsers can receive options that modify their behavior. These options are passed
107
110
  input :start_date, :date, parse_format: '%Y-%m-%d'
108
111
  ```
109
112
 
110
- This decanter will look up and apply the corresponding `DestinationDecanter` whenever necessary to transform nested resources.
111
-
112
113
  ### Exceptions
113
114
 
114
115
  By default, `Decanter#decant` will raise an exception when unexpected parameters are passed. To override this behavior, you can disable strict mode:
@@ -230,3 +231,11 @@ Decanter.config do |config|
230
231
  config.strict = false
231
232
  end
232
233
  ```
234
+
235
+ ## Contributing
236
+
237
+ This project is maintained by developers at [LaunchPad Lab](https://launchpadlab.com/). Contributions of any kind are welcome!
238
+
239
+ We aim to provide a response to incoming issues within 48 hours. However, please note that we are an active dev shop and these responses may be as simple as _"we do not have time to respond to this right now, but can address it at {x} time"_.
240
+
241
+ For detailed information specific to contributing to this project, reference our [Contribution guide](CONTRIBUTING.md).
@@ -1,3 +1,3 @@
1
1
  module Decanter
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decanter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Francis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-02-15 00:00:00.000000000 Z
12
+ date: 2020-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -132,10 +132,15 @@ extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
134
  - ".codeclimate.yml"
135
+ - ".github/ISSUE_TEMPLATE/BUG_REPORT.md"
136
+ - ".github/ISSUE_TEMPLATE/FEATURE_REQUEST.md"
137
+ - ".github/PULL_REQUEST_TEMPLATE.md"
135
138
  - ".gitignore"
136
139
  - ".rspec"
137
140
  - ".ruby-version"
138
141
  - ".travis.yml"
142
+ - CODE_OF_CONDUCT.md
143
+ - CONTRIBUTING.md
139
144
  - Gemfile
140
145
  - Gemfile.lock
141
146
  - LICENSE.txt