activeadmin_active_resource 0.1.3 → 0.2.0

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: d0f390fdd3d4ec7772412e134b3e2ed01a103e27197ddaeae46addcdc6cdc9fe
4
- data.tar.gz: 38aa9bfde64b0e486e1b4328cc9aaa33045a2de8294f2fcb2c01ec21d951aaed
3
+ metadata.gz: 41b5f19734c7469213f38f9fd7ac85f74ba8c948dc6d0ef8ec04d7b4744ed9cf
4
+ data.tar.gz: af34834021706ff0e853e0bfa5f3fa3df4de4cfa4f2eda8c3661896a9118a2b2
5
5
  SHA512:
6
- metadata.gz: 25c11edf28aed4ad54396002dd9574be12567bcec267ca78d56df95a543ca417d7fe87b24aa13b851271fcabfca9fc6b11458b7423788cdd64cb4ae0165cbd43
7
- data.tar.gz: dd78d7fd966f9d35160a82f7e68ee6636b77dc4e839dc89eb22b89ba4f0a7b133b38e08a25f32a5c91597edc417b8c6c109ab43983e54d3273ea0eb5ae312f2e
6
+ metadata.gz: c2f20563d2be4dc09e7abf208de66300a1d53cca8418ebdceca441f88eb4ba7c189687df2d5af08d6e9714437126651dae33bd2d566920fc17e44f52c14e2a78
7
+ data.tar.gz: fae82fe5f50484456d1668d5566eda4e87ecc6299f261e439a3f8a4179b654f53fb6f18f9d86066dd667dd77f07beaa833e2f22df1d2665901d41bdec78a0cf9
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Mattia Roccoberton
1
+ Copyright (c) 2020 Mattia Roccoberton
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,21 +3,17 @@
3
3
  An ActiveAdmin plugin to use a REST API in place of a local database as data source using [Active Resource](https://github.com/rails/activeresource).
4
4
 
5
5
  WARNING: this component is a Beta version, some Active Admin functionalities don't work as expected:
6
-
7
6
  - Filters: partially supported (see example)
8
7
  - Edit: fields must be configured explicitly
9
8
  - Comments: not supported
10
9
 
11
10
  ## Install
12
-
13
11
  - Add to your Gemfile: `gem 'activeadmin_active_resource'`
14
12
  - Execute bundle
15
13
  - Disable comments in active_admin config initializer
16
14
 
17
15
  ## Example
18
-
19
16
  - Post model:
20
-
21
17
  ```rb
22
18
  class Post < ActiveResource::Base
23
19
  self.site = 'http://localhost:3000' # API url: another Rails project, a REST API, etc.
@@ -36,9 +32,7 @@ class Post < ActiveResource::Base
36
32
  }
37
33
  end
38
34
  ```
39
-
40
35
  - Post admin config:
41
-
42
36
  ```rb
43
37
  ActiveAdmin.register Post do
44
38
  filter :title_cont # Ransack postfixes required (_eq, _cont, etc.)
@@ -59,11 +53,8 @@ ActiveAdmin.register Post do
59
53
  end
60
54
  end
61
55
  ```
62
-
63
56
  - Ransack options [here](https://github.com/activerecord-hackery/ransack#search-matchers)
64
-
65
57
  - Rails API index example with Ransack and Kaminari:
66
-
67
58
  ```rb
68
59
  after_action :set_pagination, only: [:index]
69
60
 
@@ -81,19 +72,15 @@ end
81
72
  ```
82
73
 
83
74
  ## Notes
84
-
85
75
  If you create a new rails project don't use *--skip-active-record*
86
76
 
87
77
  ## Do you like it? Star it!
88
-
89
78
  If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
90
79
 
91
80
  Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
92
81
 
93
82
  ## Contributors
94
-
95
- - [Mattia Roccoberton](http://blocknot.es) - creator, maintainer
83
+ [Mattia Roccoberton](http://blocknot.es): author
96
84
 
97
85
  ## License
98
-
99
86
  [MIT](LICENSE.txt)
data/Rakefile CHANGED
@@ -1,3 +1,3 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
3
+ require 'bundler/gem_tasks'
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'activeadmin/active_resource/results'
2
4
  require 'activeadmin/active_resource/engine'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_admin'
2
4
 
3
5
  module ActiveAdmin
@@ -40,7 +42,7 @@ end
40
42
 
41
43
  # -> http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-columns
42
44
  def columns
43
- @columns ||= self.known_attributes.map { |col| OpenStruct.new(name: col) }
45
+ @columns ||= known_attributes.map { |col| OpenStruct.new(name: col) }
44
46
  end
45
47
 
46
48
  def find_all(options = {})
@@ -52,8 +54,8 @@ end
52
54
  end
53
55
 
54
56
  # -> http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find_by
55
- def find_by(arg, *args)
56
- arg && arg['id'] ? self.find(arg['id']) : self.find(:first, arg)
57
+ def find_by(arg, *_args)
58
+ arg && arg['id'] ? find(arg['id']) : find(:first, arg)
57
59
  end
58
60
 
59
61
  # -> http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-inheritance_column
@@ -63,7 +65,7 @@ end
63
65
 
64
66
  # -> http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-quoted_table_name
65
67
  def quoted_table_name
66
- @quoted_table_name ||= "\"#{self.to_s.tableize}\""
68
+ @quoted_table_name ||= "\"#{to_s.tableize}\""
67
69
  end
68
70
 
69
71
  def page(page)
@@ -77,13 +79,13 @@ end
77
79
  results
78
80
  end
79
81
 
80
- def ransack(params = {}, options = {})
82
+ def ransack(params = {}, _options = {})
81
83
  @ransack_params = params.blank? ? {} : params.permit!.to_h
82
84
  OpenStruct.new(conditions: {}, object: OpenStruct.new(klass: self), result: self)
83
85
  end
84
86
 
85
87
  # -> http://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html#method-i-reflect_on_all_associations
86
- def reflect_on_all_associations(macro = nil)
88
+ def reflect_on_all_associations(_macro = nil)
87
89
  []
88
90
  end
89
91
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveAdmin
2
4
  module ActiveResource
3
5
  class Results < ::ActiveResource::Collection
4
6
  attr_accessor :current_page, :limit_value, :total_count, :total_pages
5
7
 
6
- def initialize( elements = [] )
8
+ def initialize(elements = [])
7
9
  super elements
8
10
  @limit_value = ActiveAdmin.application.default_per_page
9
11
  @total_count = 0
@@ -11,7 +13,7 @@ module ActiveAdmin
11
13
  @current_page = 1
12
14
  end
13
15
 
14
- def except( *params )
16
+ def except(*_params)
15
17
  self
16
18
  end
17
19
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveAdmin
2
4
  module ActiveResource
3
- VERSION = '0.1.3'.freeze
5
+ VERSION = '0.2.0'
4
6
  end
5
7
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_resource'
2
4
  require 'activeadmin/active_resource'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_active_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2020-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -16,40 +16,65 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activeresource
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 5.1.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: 5.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.13.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.13.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.90.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.90.0
41
69
  description: An Active Admin plugin to use Active Resource
42
70
  email: mat@blocknot.es
43
71
  executables: []
44
72
  extensions: []
45
73
  extra_rdoc_files: []
46
74
  files:
47
- - ".gitignore"
48
- - Gemfile
49
75
  - LICENSE.txt
50
76
  - README.md
51
77
  - Rakefile
52
- - activeadmin_active_resource.gemspec
53
78
  - lib/activeadmin/active_resource.rb
54
79
  - lib/activeadmin/active_resource/engine.rb
55
80
  - lib/activeadmin/active_resource/results.rb
@@ -59,7 +84,7 @@ homepage: https://github.com/blocknotes/activeadmin_active_resource
59
84
  licenses:
60
85
  - MIT
61
86
  metadata: {}
62
- post_install_message:
87
+ post_install_message:
63
88
  rdoc_options: []
64
89
  require_paths:
65
90
  - lib
@@ -74,9 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
99
  - !ruby/object:Gem::Version
75
100
  version: '0'
76
101
  requirements: []
77
- rubyforge_project:
78
- rubygems_version: 2.7.8
79
- signing_key:
102
+ rubygems_version: 3.0.3
103
+ signing_key:
80
104
  specification_version: 4
81
105
  summary: Active Resource for ActiveAdmin
82
106
  test_files: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- _misc/
2
- Gemfile.lock
3
- *.orig
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
@@ -1,20 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'activeadmin/active_resource/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'activeadmin_active_resource'
7
- spec.version = ActiveAdmin::ActiveResource::VERSION
8
- spec.summary = 'Active Resource for ActiveAdmin'
9
- spec.description = 'An Active Admin plugin to use Active Resource'
10
- spec.license = 'MIT'
11
- spec.authors = ['Mattia Roccoberton']
12
- spec.email = 'mat@blocknot.es'
13
- spec.homepage = 'https://github.com/blocknotes/activeadmin_active_resource'
14
-
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.require_paths = ['lib']
17
-
18
- spec.add_runtime_dependency 'activeadmin', '~> 1.0'
19
- spec.add_runtime_dependency 'activeresource', '~> 5.0'
20
- end