rails-gdpr-export 1.0.0 → 1.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: 7071e26a9662f67d80d9c59a8ee5dcb3d896682b63094b8fd37c288f73ebb052
4
- data.tar.gz: 0f10a671e075a4fc691b88a99d905434e93ce189b81adc90a7e89a59fac5c1c0
3
+ metadata.gz: 7dab6bb312d7424d72e84050f79b87ca1fd01a1c68ff14deb3210a33c8c6df7b
4
+ data.tar.gz: 3d6f9cfc9fc7751d138c332d6e85bccdcb48d80530ee621982f9dc0cd69d3837
5
5
  SHA512:
6
- metadata.gz: 96fa84ddc1af458eb2e6a545644159c5fae81667cbc032182b70ac6f8fc99d6071f996be7cf3a1f9ad67086e12254849e2c2eb8324d8a54ee15e631d01696cda
7
- data.tar.gz: efb60c1bf1fc6e1503d856b5e57ef591d6c9f7e52a1f169a861395469ebcc53ec0c1b171cb0c0498bdc132a7536e5ffe22b90317f99abd271640db3550b15e06
6
+ metadata.gz: 6c255cfee87d8e55b73e0be2e2ac9150461c9d8e122148e78660945503f6ff914ae48e0a93ad76453852e536b431dc083ead653d669088da5a4560fd24d89a95
7
+ data.tar.gz: 6cb1209cce21e957771ca83467eb32e016bd1144149c8fe4f21cdc65a8bbccf02e266a6a608a6c3870c71267966f6a40690be06813ef26e72221fe6b4343b9a5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-gdpr-export (1.0.0)
4
+ rails-gdpr-export (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -32,20 +32,22 @@ ActiveRecord::Base.send :include, GdprExporter
32
32
 
33
33
  ### Data collection
34
34
 
35
- In order to specify the fields that you want to return to the user you need to call `ruby gdpr_collect`.
36
- The call target is a rails model and its arguments are as follows:
37
- * set of simple fields: i.e. fields that will be output as is
38
- * a hash of params:
39
- {user_id: <the field in the model used as alias for the user id>
35
+ In order to specify the fields you want to return to the user you need to call `gdpr_collect`.
36
+ The call target is a rails model and its arguments are:
37
+ * a set of simple fields, i.e. fields that will be output as is,
38
+ * followed by a hash of params:
39
+ ```ruby
40
+ {user_id: <the field in the model used as alias for the user_id field>
40
41
  renamed_fields: {<field_from_db> => <field_name_in_output>}
41
42
  table_name: <the new table name in output>
42
43
  description: <a comment>
43
44
  join: <an association>}
45
+ ```
44
46
 
47
+ #### Example
45
48
 
46
49
  ```ruby
47
- User.gdpr_collect :email, :last_sign_in_at, :stripe_customer_id,
48
- :type, :forward_mailbox,
50
+ User.gdpr_collect :email, :last_sign_in_at, :type, :forward_mailbox,
49
51
  {user_id: :id,
50
52
  renamed_fields: {sign_in_count: "sign in count",
51
53
  current_sign_in_at: "time of current sign in",
@@ -54,10 +56,11 @@ User.gdpr_collect :email, :last_sign_in_at, :stripe_customer_id,
54
56
  last_sign_in_ip: "previously used IP address"}}
55
57
  ```
56
58
 
57
- ```
59
+ From your `User` model, you want to retrieve the values of the fields `email, last_sign_in_at,
60
+ type, forward_mailbox`, in addition to the fields `sign_in_count, current_sign_in_at, chosen_program_id, current_sign_in_ip, last_sign_in_ip`. However for the latter you want their csv header to be renamed. And the field representing the user in the `User` model is `id`.
58
61
 
59
62
  ### Data export
60
- Call `ruby GdprExporter.export(<user_id>)` and it will return a csv formatted output.
63
+ Finally, call `GdprExporter.export(<user_id>)` to return a csv formatted output of all the fields you specified previously.
61
64
 
62
65
 
63
66
  ## Contributing
@@ -1,5 +1,5 @@
1
1
  module Exts
2
2
  module Gdpr
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
data/lib/gdpr_exporter.rb CHANGED
@@ -76,9 +76,12 @@ module GdprExporter
76
76
  self.class.send :attr_reader, :gdpr_hash_params
77
77
 
78
78
  # Build the csv header and prepare the fields used for querying
79
+ #
79
80
  user_id_field = hash_params[:user_id]
80
- csv_headers = [:user_id].concat @gdpr_simple_fields
81
- query_fields = [user_id_field].concat @gdpr_simple_fields
81
+ # csv_headers = [:user_id].concat @gdpr_simple_fields # Uncomment if user_id needed
82
+ # query_fields = [user_id_field].concat @gdpr_simple_fields # Uncomment if user_id needed
83
+ csv_headers = [].concat @gdpr_simple_fields
84
+ query_fields = [].concat @gdpr_simple_fields
82
85
 
83
86
  if hash_params[:renamed_fields]
84
87
  csv_headers.concat hash_params[:renamed_fields].values
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-gdpr-export
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chrislain Razafimahefa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler