simple_jsonapi 1.0.0 → 1.1.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 +5 -5
- data/CHANGELOG.md +3 -0
- data/Jenkinsfile +2 -91
- data/README.md +7 -7
- data/lib/simple_jsonapi/version.rb +1 -1
- data/simple_jsonapi.gemspec +2 -2
- metadata +15 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: cbbc2be0986ffd89bb33a180ad8284d51cc80ade159048ca50f8bcf5506351a2
         | 
| 4 | 
            +
              data.tar.gz: 60d1b758d602e64266359b55580d0f7bd00d270ec4e7a574977a6620a654e562
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 07b5abf147a21fe16c02438cf8e36854733112186127ac406f0687d61ef69d2ff40e5cf28a5d32303c91a85c39c0bb7ca7d822e1dc007236903d68029afa0251
         | 
| 7 | 
            +
              data.tar.gz: 3ed39704342fb16f57e2e742f00fce6cc7a08f1b2dc8025b2c00b55d2cde74a26000e58996d73165154938104a49ebfc0e2e9ee8f9a4d1c12591c9ec12489fb6
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Jenkinsfile
    CHANGED
    
    | @@ -1,92 +1,3 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
              agent none
         | 
| 3 | 
            -
              options {
         | 
| 4 | 
            -
                timeout(time: 1, unit: 'HOURS')
         | 
| 5 | 
            -
                skipDefaultCheckout()
         | 
| 6 | 
            -
              }
         | 
| 1 | 
            +
            @Library('plm-global-jenkins')_
         | 
| 7 2 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
                stage("Build Ruby") {
         | 
| 10 | 
            -
                  agent {
         | 
| 11 | 
            -
                    node {
         | 
| 12 | 
            -
                      label 'docker'
         | 
| 13 | 
            -
                    }
         | 
| 14 | 
            -
                  }
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  steps {
         | 
| 17 | 
            -
                    script {
         | 
| 18 | 
            -
                      with_ruby_build() {
         | 
| 19 | 
            -
                        script {
         | 
| 20 | 
            -
                          uid = sh(returnStdout: true, script: 'stat -c %g .').trim()
         | 
| 21 | 
            -
                          gid = sh(returnStdout: true, script: 'stat -c %u .').trim()
         | 
| 22 | 
            -
                        }
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                        sh "chown -R ${uid}:${gid} vendor/bundle/"
         | 
| 25 | 
            -
                        sh "rm -rf vendor/bundle/ruby/2.3.0/cache"
         | 
| 26 | 
            -
                        stash name: 'ruby-bundle', includes: 'vendor/bundle/'
         | 
| 27 | 
            -
                      }
         | 
| 28 | 
            -
                    }
         | 
| 29 | 
            -
                  }
         | 
| 30 | 
            -
                }
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                stage("Test") {
         | 
| 33 | 
            -
                  steps {
         | 
| 34 | 
            -
                    script {
         | 
| 35 | 
            -
                      node('docker') {
         | 
| 36 | 
            -
                        checkout([
         | 
| 37 | 
            -
                          $class: 'GitSCM',
         | 
| 38 | 
            -
                          branches: scm.branches,
         | 
| 39 | 
            -
                          doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
         | 
| 40 | 
            -
                          extensions: scm.extensions + [[$class: 'CloneOption', noTags: true, reference: '', shallow: true]],
         | 
| 41 | 
            -
                          userRemoteConfigs: scm.userRemoteConfigs
         | 
| 42 | 
            -
                        ])
         | 
| 43 | 
            -
                        try {
         | 
| 44 | 
            -
                          docker.image('ruby:2.3.3').inside() {
         | 
| 45 | 
            -
                            sh 'rm -rf vendor/bundle'
         | 
| 46 | 
            -
                            unstash 'ruby-bundle'
         | 
| 47 | 
            -
                            sh 'bundle install --path=vendor/bundle'
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                            withEnv([
         | 
| 50 | 
            -
                              'DISABLE_SPRING=1',
         | 
| 51 | 
            -
                              'TZ=America/New_York'
         | 
| 52 | 
            -
                            ]) {
         | 
| 53 | 
            -
                              sh 'bundle exec rake test'
         | 
| 54 | 
            -
                            }
         | 
| 55 | 
            -
                          }
         | 
| 56 | 
            -
                        }
         | 
| 57 | 
            -
                        finally {
         | 
| 58 | 
            -
                          junit 'test/reports/'
         | 
| 59 | 
            -
                          cleanWs()
         | 
| 60 | 
            -
                        }
         | 
| 61 | 
            -
                      }
         | 
| 62 | 
            -
                    }
         | 
| 63 | 
            -
                  }
         | 
| 64 | 
            -
                }
         | 
| 65 | 
            -
              }
         | 
| 66 | 
            -
             | 
| 67 | 
            -
              post {
         | 
| 68 | 
            -
                failure {
         | 
| 69 | 
            -
                  script {
         | 
| 70 | 
            -
                    if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'current') {
         | 
| 71 | 
            -
                      slackSend (channel: '#plm_website', color: '#FF0000', message: "FAILED ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.RUN_DISPLAY_URL})")
         | 
| 72 | 
            -
                    }
         | 
| 73 | 
            -
                  }
         | 
| 74 | 
            -
                }
         | 
| 75 | 
            -
              }
         | 
| 76 | 
            -
            }
         | 
| 77 | 
            -
             | 
| 78 | 
            -
            def with_ruby_build(closure) {
         | 
| 79 | 
            -
              docker.image('ruby:2.3.3').inside() {
         | 
| 80 | 
            -
                checkout([
         | 
| 81 | 
            -
                  $class: 'GitSCM',
         | 
| 82 | 
            -
                  branches: scm.branches,
         | 
| 83 | 
            -
                  doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
         | 
| 84 | 
            -
                  extensions: scm.extensions + [[$class: 'CloneOption', noTags: true, reference: '', shallow: true]],
         | 
| 85 | 
            -
                  userRemoteConfigs: scm.userRemoteConfigs
         | 
| 86 | 
            -
                ])
         | 
| 87 | 
            -
                sh 'rm -rf vendor/bundle'
         | 
| 88 | 
            -
                sh 'bundle install --path=vendor/bundle'
         | 
| 89 | 
            -
                closure()
         | 
| 90 | 
            -
                cleanWs()
         | 
| 91 | 
            -
              }
         | 
| 92 | 
            -
            }
         | 
| 3 | 
            +
            publishRubyPackagePipeline('./lib/simple_jsonapi/version.rb', 'SimpleJsonapi::VERSION')
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            # SimpleJsonapi
         | 
| 2 2 |  | 
| 3 | 
            -
            A library for building [ | 
| 3 | 
            +
            A library for building [JSON API](http://jsonapi.org) documents in Ruby. You may also be interested in [simple\_jsonapi\_rails](https://github.com/patientslikeme/simple_jsonapi_rails), which provides some integrations for using simple_jsonapi in a Rails application.
         | 
| 4 4 |  | 
| 5 | 
            -
            To view this README and more documentation of specific classes and methods, view the YARD documentation | 
| 5 | 
            +
            To view this README and more documentation of specific classes and methods, view the [YARD documentation](https://www.rubydoc.info/gems/simple_jsonapi).
         | 
| 6 6 |  | 
| 7 7 | 
             
            ### Features
         | 
| 8 8 |  | 
| 9 | 
            -
            SimpleJsonapi supports the following  | 
| 9 | 
            +
            SimpleJsonapi supports the following JSON API features:
         | 
| 10 10 |  | 
| 11 11 | 
             
            * Singular and collection endpoints
         | 
| 12 12 | 
             
            * Attributes and relationships, including nested relationships
         | 
| @@ -26,7 +26,7 @@ A specification for building APIs in JSON. As its creators [write](http://jsonap | |
| 26 26 |  | 
| 27 27 | 
             
            > If you’ve ever argued with your team about the way your JSON responses should be formatted, JSON API can be your anti-bikeshedding tool.
         | 
| 28 28 |  | 
| 29 | 
            -
            Here's a sample  | 
| 29 | 
            +
            Here's a sample JSON API response that also sets the stage for the examples we'll see below:
         | 
| 30 30 |  | 
| 31 31 | 
             
            ```json
         | 
| 32 32 | 
             
            {
         | 
| @@ -253,8 +253,8 @@ Attributes (and relationships) can be conditionally rendered by providing an `if | |
| 253 253 |  | 
| 254 254 | 
             
            ```ruby
         | 
| 255 255 | 
             
            class UserSerializer < SimpleJsonapi::Serializer
         | 
| 256 | 
            -
              attribute :ssn, if: { @current_user.is_an_admin? }
         | 
| 257 | 
            -
              attribute :country, unless: {  | 
| 256 | 
            +
              attribute :ssn, if: -> { @current_user.is_an_admin? }
         | 
| 257 | 
            +
              attribute :country, unless: ->(user) { user.hide_demographics? }
         | 
| 258 258 | 
             
            end
         | 
| 259 259 | 
             
            ```
         | 
| 260 260 |  | 
| @@ -383,7 +383,7 @@ It is also possible to pass in additional variables at render time via the `extr | |
| 383 383 |  | 
| 384 384 | 
             
            ```ruby
         | 
| 385 385 | 
             
            class UserSerializer < SimpleJsonapi::Serializer
         | 
| 386 | 
            -
              attribute :ssn, if: { @current_user.is_an_admin? }
         | 
| 386 | 
            +
              attribute :ssn, if: -> { @current_user.is_an_admin? }
         | 
| 387 387 | 
             
              relationship :orders do
         | 
| 388 388 | 
             
                data { |user| get_orders_for_user(user) }
         | 
| 389 389 | 
             
              end
         | 
    
        data/simple_jsonapi.gemspec
    CHANGED
    
    | @@ -18,12 +18,12 @@ Gem::Specification.new do |spec| | |
| 18 18 | 
             
              spec.test_files    = spec.files.grep(%r{^test/})
         | 
| 19 19 | 
             
              spec.require_paths = ['lib']
         | 
| 20 20 |  | 
| 21 | 
            -
              spec.add_runtime_dependency 'activesupport', ' | 
| 21 | 
            +
              spec.add_runtime_dependency 'activesupport', '>= 5.1', '< 7.0'
         | 
| 22 22 |  | 
| 23 23 | 
             
              spec.add_development_dependency 'bundler', '~> 1.10'
         | 
| 24 24 | 
             
              spec.add_development_dependency 'rake', '~> 10.0'
         | 
| 25 25 | 
             
              spec.add_development_dependency 'minitest'
         | 
| 26 | 
            -
              spec.add_development_dependency 'minitest-reporters'
         | 
| 26 | 
            +
              spec.add_development_dependency 'minitest-reporters', '~> 1.1.11'
         | 
| 27 27 | 
             
              spec.add_development_dependency 'pry'
         | 
| 28 28 | 
             
              spec.add_development_dependency 'mocha'
         | 
| 29 29 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,29 +1,35 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simple_jsonapi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - PatientsLikeMe
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2019-09-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '5.1'
         | 
| 20 | 
            +
                - - "<"
         | 
| 21 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            +
                    version: '7.0'
         | 
| 20 23 | 
             
              type: :runtime
         | 
| 21 24 | 
             
              prerelease: false
         | 
| 22 25 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 26 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 27 | 
            +
                - - ">="
         | 
| 25 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 29 | 
             
                    version: '5.1'
         | 
| 30 | 
            +
                - - "<"
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: '7.0'
         | 
| 27 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 34 | 
             
              name: bundler
         | 
| 29 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -70,16 +76,16 @@ dependencies: | |
| 70 76 | 
             
              name: minitest-reporters
         | 
| 71 77 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 78 | 
             
                requirements:
         | 
| 73 | 
            -
                - - " | 
| 79 | 
            +
                - - "~>"
         | 
| 74 80 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version:  | 
| 81 | 
            +
                    version: 1.1.11
         | 
| 76 82 | 
             
              type: :development
         | 
| 77 83 | 
             
              prerelease: false
         | 
| 78 84 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 85 | 
             
                requirements:
         | 
| 80 | 
            -
                - - " | 
| 86 | 
            +
                - - "~>"
         | 
| 81 87 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version:  | 
| 88 | 
            +
                    version: 1.1.11
         | 
| 83 89 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 90 | 
             
              name: pry
         | 
| 85 91 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -209,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 209 215 | 
             
                  version: '0'
         | 
| 210 216 | 
             
            requirements: []
         | 
| 211 217 | 
             
            rubyforge_project: 
         | 
| 212 | 
            -
            rubygems_version: 2. | 
| 218 | 
            +
            rubygems_version: 2.7.6
         | 
| 213 219 | 
             
            signing_key: 
         | 
| 214 220 | 
             
            specification_version: 4
         | 
| 215 221 | 
             
            summary: A library for building JSONAPI documents in Ruby.
         |