grape-entity 0.8.2 → 0.9.0

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: aa38cbc30d489d88e91c10c688c581251392a448330eca12ff79ebe22958bd9c
4
- data.tar.gz: a96f1d0ada161d659f71aaca4e44588afc2727f4966e3f46058189483d46aa0c
3
+ metadata.gz: 040fece8639b5fd085e4c77f1c88172e686e2655adf5e1cbb80aa0bb06c46faf
4
+ data.tar.gz: f688469ee710ac98ed822d41c3724f47d1ec8b6f9aa067eead52c07662c45121
5
5
  SHA512:
6
- metadata.gz: 12f8a447cf4f297bb4c07375d08efa41e5d1691a907ccbfdc7cef8c2f394cfc03a041318f76ab2475089b5d1b7438414cd00dca6305105bf616b3c2465b1c000
7
- data.tar.gz: 0a7c13fec63e43adb8269d0639c1e4abfef77cba02a3a7b234716588e968116e1875e94bab08f68cdec60e656b65f159d42f308342eeac6f42846a6f5aec9b27
6
+ metadata.gz: 3f14751f855805e0ea16f5c232a67c70c76d7523075a93ad442de9a31c9eb04816c1deae576d0e68671f6126790e7ca7d96bc8a7da4aa7c61d06f00385863c69
7
+ data.tar.gz: 2d683f2414287de225b0d47e615f91563daf3b73c74e674c24cd2a1c6c2a417098ce0118e23d7272bf165d2895cb09fab824d52dfcb069dbfd8ea6e860b03b63
@@ -0,0 +1,14 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ day: "friday"
13
+ assignees:
14
+ - "LeFnord"
@@ -0,0 +1,26 @@
1
+ name: Rubocop
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ rubocop:
13
+ name: Rubocop
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: '3.0'
20
+ - run: gem install rubocop --no-doc
21
+ - run: rubocop --format progress --format json --out rubocop.json
22
+ id: rubocop
23
+ - uses: duderman/rubocop-annotate-action@v0.1.0
24
+ with:
25
+ path: rubocop.json
26
+ if: ${{ failure() }}
@@ -0,0 +1,26 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ spec:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ['2.6', '2.7', '3.0', head, jruby, truffleruby]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true
25
+ - name: Run rspec
26
+ run: bundle exec rspec
data/.rubocop.yml CHANGED
@@ -4,9 +4,9 @@ AllCops:
4
4
  Exclude:
5
5
  - vendor/**/*
6
6
  - example/**/*
7
- TargetRubyVersion: 2.7
8
- UseCache: true
9
7
  NewCops: enable
8
+ TargetRubyVersion: 3.0
9
+ SuggestExtensions: false
10
10
 
11
11
  # Layout stuff
12
12
  #
data/CHANGELOG.md CHANGED
@@ -9,6 +9,13 @@
9
9
  * Your contribution here.
10
10
 
11
11
 
12
+ ### 0.9.0 (2021-03-20)
13
+
14
+ #### Features
15
+
16
+ * [#346](https://github.com/ruby-grape/grape-entity/pull/346): Ruby 3 support - [@LeFnord](https://github.com/LeFnord).
17
+
18
+
12
19
  ### 0.8.2 (2020-11-08)
13
20
 
14
21
  #### Fixes
data/Gemfile CHANGED
@@ -15,6 +15,6 @@ group :test do
15
15
  gem 'guard-bundler'
16
16
  gem 'guard-rspec'
17
17
  gem 'rb-fsevent'
18
- gem 'ruby-grape-danger', '~> 0.1.1', require: false
18
+ gem 'ruby-grape-danger', '~> 0.2', require: false
19
19
  gem 'simplecov', require: false
20
20
  end
data/README.md CHANGED
@@ -1,10 +1,46 @@
1
- # Grape::Entity
2
-
3
1
  [![Gem Version](http://img.shields.io/gem/v/grape-entity.svg)](http://badge.fury.io/rb/grape-entity)
4
- [![Build Status](http://img.shields.io/travis/ruby-grape/grape-entity.svg)](https://travis-ci.org/ruby-grape/grape-entity)
2
+ ![Ruby](https://github.com/ruby-grape/grape-entity/workflows/Ruby/badge.svg)
5
3
  [![Coverage Status](https://coveralls.io/repos/github/ruby-grape/grape-entity/badge.svg?branch=master)](https://coveralls.io/github/ruby-grape/grape-entity?branch=master)
6
4
  [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-entity.svg)](https://codeclimate.com/github/ruby-grape/grape-entity)
7
5
 
6
+ # Table of Contents
7
+
8
+ - [Grape::Entity](#grapeentity)
9
+ - [Introduction](#introduction)
10
+ - [Example](#example)
11
+ - [Reusable Responses with Entities](#reusable-responses-with-entities)
12
+ - [Defining Entities](#defining-entities)
13
+ - [Basic Exposure](#basic-exposure)
14
+ - [Exposing with a Presenter](#exposing-with-a-presenter)
15
+ - [Conditional Exposure](#conditional-exposure)
16
+ - [Safe Exposure](#safe-exposure)
17
+ - [Nested Exposure](#nested-exposure)
18
+ - [Collection Exposure](#collection-exposure)
19
+ - [Merge Fields](#merge-fields)
20
+ - [Runtime Exposure](#runtime-exposure)
21
+ - [Unexpose](#unexpose)
22
+ - [Overriding exposures](#overriding-exposures)
23
+ - [Returning only the fields you want](#returning-only-the-fields-you-want)
24
+ - [Aliases](#aliases)
25
+ - [Format Before Exposing](#format-before-exposing)
26
+ - [Expose Nil](#expose-nil)
27
+ - [Documentation](#documentation)
28
+ - [Options Hash](#options-hash)
29
+ - [Passing Additional Option To Nested Exposure](#passing-additional-option-to-nested-exposure)
30
+ - [Attribute Path Tracking](#attribute-path-tracking)
31
+ - [Using the Exposure DSL](#using-the-exposure-dsl)
32
+ - [Using Entities](#using-entities)
33
+ - [Entity Organization](#entity-organization)
34
+ - [Caveats](#caveats)
35
+ - [Installation](#installation)
36
+ - [Testing with Entities](#testing-with-entities)
37
+ - [Project Resources](#project-resources)
38
+ - [Contributing](#contributing)
39
+ - [License](#license)
40
+ - [Copyright](#copyright)
41
+
42
+ # Grape::Entity
43
+
8
44
  ## Introduction
9
45
 
10
46
  This gem adds Entity support to API frameworks, such as [Grape](https://github.com/ruby-grape/grape). Grape's Entity is an API focused facade that sits on top of an object model.
data/UPGRADING.md CHANGED
@@ -1,22 +1,10 @@
1
1
  # Upgrading Grape Entity
2
2
 
3
- ### Upgrading to >= 0.8.2
4
-
5
- In Ruby 3.0: the block handling will be changed
6
- [language-changes point 3, Proc](https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes).
7
- This:
8
- ```ruby
9
- expose :that_method_without_args, &:method_without_args
10
- ```
11
- will be deprecated.
12
-
13
- Prefer to use this pattern for simple setting a value
14
- ```ruby
15
- expose :method_without_args, as: :that_method_without_args
16
- ```
17
3
 
18
4
  ### Upgrading to >= 0.8.2
19
5
 
6
+ Official support for ruby < 2.5 removed, ruby 2.5 only in testing mode, but no support.
7
+
20
8
  In Ruby 3.0: the block handling will be changed
21
9
  [language-changes point 3, Proc](https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes).
22
10
  This:
data/grape-entity.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.description = 'Extracted from Grape, A Ruby framework for rapid API development with great conventions.'
15
15
  s.license = 'MIT'
16
16
 
17
- s.required_ruby_version = '>= 2.4'
17
+ s.required_ruby_version = '>= 2.5'
18
18
 
19
19
  s.add_runtime_dependency 'activesupport', '>= 3.0.0'
20
20
  # FIXME: remove dependecy
@@ -122,8 +122,6 @@ module Grape
122
122
  case value
123
123
  when :to_s, :str, :string
124
124
  :to_s
125
- when :to_sym, :sym, :symbol
126
- :to_sym
127
125
  else
128
126
  :to_sym
129
127
  end
@@ -51,7 +51,6 @@ module Grape
51
51
  output
52
52
  end
53
53
 
54
- # rubocop:disable Lint/EmptyBlock
55
54
  # In case if we want to solve collisions providing lambda to :merge option
56
55
  def merge_strategy(for_merge)
57
56
  if for_merge.respond_to? :call
@@ -60,7 +59,6 @@ module Grape
60
59
  -> {}
61
60
  end
62
61
  end
63
- # rubocop:enable Lint/EmptyBlock
64
62
  end
65
63
  end
66
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeEntity
4
- VERSION = '0.8.2'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-entity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-08 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -159,11 +159,13 @@ extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
161
  - ".coveralls.yml"
162
+ - ".github/dependabot.yml"
163
+ - ".github/workflows/rubocop.yml"
164
+ - ".github/workflows/ruby.yml"
162
165
  - ".gitignore"
163
166
  - ".rspec"
164
167
  - ".rubocop.yml"
165
168
  - ".rubocop_todo.yml"
166
- - ".travis.yml"
167
169
  - ".yardopts"
168
170
  - CHANGELOG.md
169
171
  - CONTRIBUTING.md
@@ -223,14 +225,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
225
  requirements:
224
226
  - - ">="
225
227
  - !ruby/object:Gem::Version
226
- version: '2.4'
228
+ version: '2.5'
227
229
  required_rubygems_version: !ruby/object:Gem::Requirement
228
230
  requirements:
229
231
  - - ">="
230
232
  - !ruby/object:Gem::Version
231
233
  version: '0'
232
234
  requirements: []
233
- rubygems_version: 3.2.0.rc.1
235
+ rubygems_version: 3.2.3
234
236
  signing_key:
235
237
  specification_version: 4
236
238
  summary: A simple facade for managing the relationship between your model and API.
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- language: ruby
2
-
3
- before_install:
4
- - gem install bundler
5
-
6
- after_success:
7
- - bundle exec danger
8
-
9
- rvm:
10
- - 2.5.8
11
- - 2.6.6
12
- - 2.7.2
13
- - ruby-head
14
- - jruby-head
15
- - truffleruby-head
16
- - 2.4.10
17
-
18
-
19
- matrix:
20
- fast_finish: true
21
-
22
- allow_failures:
23
- - rvm: 2.4.10
24
- - rvm: ruby-head
25
- - rvm: jruby-head
26
- - rvm: truffleruby-head