standardapi 5.2.0.6 → 5.2.0.7
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f3957c161eeaacb9d65db690f90ed3f229b4a09518fe76a9b43e76b60118892c
         | 
| 4 | 
            +
              data.tar.gz: 74be1b993b808bb6f91abdcf3da4558c65873ca4a4201d138bdbdc19808ae401
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b54ce14e9c544ea3b2cc6cb555ea5c58da2ba920818e33c595d4c15ae03b6b0856c9755ff1f7e15b9d75e8518fb5c7fb90ab09dd77a7971d650c80bb8e703209
         | 
| 7 | 
            +
              data.tar.gz: 53ec52f5704a7cb2fef62df2160c496799a6bfd6f47dba72f985cdf201f79a447606fa80c5966dcfc5a5993075cd90c02324575e5d4ae5f6c15b62e7d7e145c7
         | 
| @@ -2,7 +2,8 @@ module StandardAPI | |
| 2 2 | 
             
              module Controller
         | 
| 3 3 |  | 
| 4 4 | 
             
                def self.included(klass)
         | 
| 5 | 
            -
                  klass.helper_method :includes, :orders, :model, :resource_limit, | 
| 5 | 
            +
                  klass.helper_method :includes, :orders, :model, :resource_limit,
         | 
| 6 | 
            +
                    :default_limit
         | 
| 6 7 | 
             
                  klass.before_action :set_standardapi_headers
         | 
| 7 8 | 
             
                  klass.append_view_path(File.join(File.dirname(__FILE__), 'views'))
         | 
| 8 9 | 
             
                  klass.extend(ClassMethods)
         | 
    
        data/lib/standard_api/helpers.rb
    CHANGED
    
    | @@ -8,7 +8,7 @@ module StandardAPI | |
| 8 8 | 
             
                    'application/record'
         | 
| 9 9 | 
             
                  end
         | 
| 10 10 | 
             
                end
         | 
| 11 | 
            -
             | 
| 11 | 
            +
             | 
| 12 12 | 
             
                def can_cache?(klass, includes)
         | 
| 13 13 | 
             
                  cache_columns = ['cached_at'] + cached_at_columns_for_includes(includes)
         | 
| 14 14 | 
             
                  if (cache_columns - klass.column_names).empty?
         | 
| @@ -101,5 +101,44 @@ module StandardAPI | |
| 101 101 | 
             
                  digest.hexdigest
         | 
| 102 102 | 
             
                end
         | 
| 103 103 |  | 
| 104 | 
            +
                def json_column_type(sql_type)
         | 
| 105 | 
            +
                  case sql_type
         | 
| 106 | 
            +
                  when /character varying(\(\d+\))?/
         | 
| 107 | 
            +
                    'string'
         | 
| 108 | 
            +
                  when 'timestamp without time zone'
         | 
| 109 | 
            +
                    'datetime'
         | 
| 110 | 
            +
                  when 'time without time zone'
         | 
| 111 | 
            +
                    'datetime'
         | 
| 112 | 
            +
                  when 'text'
         | 
| 113 | 
            +
                    'string'
         | 
| 114 | 
            +
                  when 'json'
         | 
| 115 | 
            +
                    'hash'
         | 
| 116 | 
            +
                  when 'bigint'
         | 
| 117 | 
            +
                    'integer'
         | 
| 118 | 
            +
                  when 'integer'
         | 
| 119 | 
            +
                    'integer'
         | 
| 120 | 
            +
                  when 'jsonb'
         | 
| 121 | 
            +
                    'hash'
         | 
| 122 | 
            +
                  when 'inet'
         | 
| 123 | 
            +
                    'string' # TODO: should be inet
         | 
| 124 | 
            +
                  when 'hstore'
         | 
| 125 | 
            +
                    'hash'
         | 
| 126 | 
            +
                  when 'date'
         | 
| 127 | 
            +
                    'datetime'
         | 
| 128 | 
            +
                  when /numeric(\(\d+(,\d+)?\))?/
         | 
| 129 | 
            +
                    'decimal'
         | 
| 130 | 
            +
                  when 'double precision'
         | 
| 131 | 
            +
                    'decimal'
         | 
| 132 | 
            +
                  when 'ltree'
         | 
| 133 | 
            +
                   'string'
         | 
| 134 | 
            +
                  when 'boolean'
         | 
| 135 | 
            +
                    'boolean'
         | 
| 136 | 
            +
                  when 'geometry'
         | 
| 137 | 
            +
                    'ewkb'
         | 
| 138 | 
            +
                  when 'uuid' # TODO: should be uuid
         | 
| 139 | 
            +
                    'string'
         | 
| 140 | 
            +
                  end
         | 
| 141 | 
            +
                end
         | 
| 142 | 
            +
             | 
| 104 143 | 
             
              end
         | 
| 105 144 | 
             
            end
         | 
    
        data/lib/standard_api/version.rb
    CHANGED
    
    
| @@ -1,48 +1,7 @@ | |
| 1 | 
            -
            mapping = lambda do |sql_type|
         | 
| 2 | 
            -
              case sql_type
         | 
| 3 | 
            -
              when /character varying(\(\d+\))?/
         | 
| 4 | 
            -
                'string'
         | 
| 5 | 
            -
              when 'timestamp without time zone'
         | 
| 6 | 
            -
                'datetime'
         | 
| 7 | 
            -
              when 'time without time zone'
         | 
| 8 | 
            -
                'datetime'
         | 
| 9 | 
            -
              when 'text'
         | 
| 10 | 
            -
                'string'
         | 
| 11 | 
            -
              when 'json'
         | 
| 12 | 
            -
                'hash'
         | 
| 13 | 
            -
              when 'bigint'
         | 
| 14 | 
            -
                'integer'
         | 
| 15 | 
            -
              when 'integer'
         | 
| 16 | 
            -
                'integer'
         | 
| 17 | 
            -
              when 'jsonb'
         | 
| 18 | 
            -
                'hash'
         | 
| 19 | 
            -
              when 'inet'
         | 
| 20 | 
            -
                'string' # TODO: should be inet
         | 
| 21 | 
            -
              when 'hstore'
         | 
| 22 | 
            -
                'hash'
         | 
| 23 | 
            -
              when 'date'
         | 
| 24 | 
            -
                'datetime'
         | 
| 25 | 
            -
              when 'numeric(162)'
         | 
| 26 | 
            -
                'decimal'
         | 
| 27 | 
            -
              when 'numeric'
         | 
| 28 | 
            -
                'decimal'
         | 
| 29 | 
            -
              when 'double precision'
         | 
| 30 | 
            -
                'decimal'
         | 
| 31 | 
            -
              when 'ltree'
         | 
| 32 | 
            -
               'string'
         | 
| 33 | 
            -
              when 'boolean'
         | 
| 34 | 
            -
                'boolean'
         | 
| 35 | 
            -
              when 'geometry'
         | 
| 36 | 
            -
                'ewkb'
         | 
| 37 | 
            -
              when 'uuid' # TODO: should be uuid
         | 
| 38 | 
            -
                'string'
         | 
| 39 | 
            -
              end
         | 
| 40 | 
            -
            end
         | 
| 41 | 
            -
             | 
| 42 1 | 
             
            json.set! 'columns' do
         | 
| 43 2 | 
             
              model.columns.each do |column|
         | 
| 44 3 | 
             
                json.set! column.name, {
         | 
| 45 | 
            -
                  type:  | 
| 4 | 
            +
                  type: json_column_type(column.sql_type),
         | 
| 46 5 | 
             
                  primary_key: column.name == model.primary_key,
         | 
| 47 6 | 
             
                  null: column.null,
         | 
| 48 7 | 
             
                  array: column.array
         | 
| @@ -1,51 +1,9 @@ | |
| 1 | 
            -
            mapping = lambda do |sql_type|
         | 
| 2 | 
            -
              case sql_type
         | 
| 3 | 
            -
              when /character varying(\(\d+\))?/
         | 
| 4 | 
            -
                'string'
         | 
| 5 | 
            -
              when 'timestamp without time zone'
         | 
| 6 | 
            -
                'datetime'
         | 
| 7 | 
            -
              when 'time without time zone'
         | 
| 8 | 
            -
                'datetime'
         | 
| 9 | 
            -
              when 'text'
         | 
| 10 | 
            -
                'string'
         | 
| 11 | 
            -
              when 'json'
         | 
| 12 | 
            -
                'hash'
         | 
| 13 | 
            -
              when 'bigint'
         | 
| 14 | 
            -
                'integer'
         | 
| 15 | 
            -
              when 'integer'
         | 
| 16 | 
            -
                'integer'
         | 
| 17 | 
            -
              when 'jsonb'
         | 
| 18 | 
            -
                'hash'
         | 
| 19 | 
            -
              when 'inet'
         | 
| 20 | 
            -
                'string' # TODO: should be inet
         | 
| 21 | 
            -
              when 'hstore'
         | 
| 22 | 
            -
                'hash'
         | 
| 23 | 
            -
              when 'date'
         | 
| 24 | 
            -
                'datetime'
         | 
| 25 | 
            -
              when 'numeric(162)'
         | 
| 26 | 
            -
                'decimal'
         | 
| 27 | 
            -
              when 'numeric'
         | 
| 28 | 
            -
                'decimal'
         | 
| 29 | 
            -
              when 'double precision'
         | 
| 30 | 
            -
                'decimal'
         | 
| 31 | 
            -
              when 'ltree'
         | 
| 32 | 
            -
               'string'
         | 
| 33 | 
            -
              when 'boolean'
         | 
| 34 | 
            -
                'boolean'
         | 
| 35 | 
            -
              when 'geometry'
         | 
| 36 | 
            -
                'ewkb'
         | 
| 37 | 
            -
              when 'uuid' # TODO: should be uuid
         | 
| 38 | 
            -
                'string'
         | 
| 39 | 
            -
              end
         | 
| 40 | 
            -
            end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 1 | 
             
            json.object! do
         | 
| 44 2 | 
             
              json.set! 'columns' do
         | 
| 45 3 | 
             
                json.object! do
         | 
| 46 4 | 
             
                  model.columns.each do |column|
         | 
| 47 5 | 
             
                    json.set! column.name, {
         | 
| 48 | 
            -
                      type:  | 
| 6 | 
            +
                      type: json_column_type(column.sql_type),
         | 
| 49 7 | 
             
                      primary_key: column.name == model.primary_key,
         | 
| 50 8 | 
             
                      null: column.null,
         | 
| 51 9 | 
             
                      array: column.array
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: standardapi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5.2.0. | 
| 4 | 
            +
              version: 5.2.0.7
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Bracy
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-11- | 
| 11 | 
            +
            date: 2018-11-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |