data_guru 0.4.0 → 1.0.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
  SHA1:
3
- metadata.gz: 596c654f0a314f25642dcec4f6215855fb162f2e
4
- data.tar.gz: 9e7b366fcb502b7d1d52ca89dcc63695e9af047b
3
+ metadata.gz: 3385e9759c76cf598810c880efcb0011dc62331e
4
+ data.tar.gz: 86cc6fe4ee3c388e111156b00e5d54f8e1674603
5
5
  SHA512:
6
- metadata.gz: 1bb1d3def03cf3d6e0815e010b54616a414221f07a170a81f12c22478ca7534edef2923cd63f405d7c3a681598beeb858b47cba1b837ca9fee794eb4f302b5ad
7
- data.tar.gz: b50f495835e174e425b8e4c6ec50f6e92ac83f9edc13276467b8d7dca686cae0bc4e8aa7c4eeb8a65df47c76aeecc0221fd8ca657b4a361927f2f774f144a568
6
+ metadata.gz: 1320b19b6d3f119730dcd173b31660754da2585490b758c7b9269c76a1c8d70300283f280b7e5b476188a361cc48efcf0d2331175467d745074fab99ac1cc363
7
+ data.tar.gz: 1d7a38793ecbe88a33eba71d70d954b7fed3b90bfe3d72ac5d9be0f51b796a26f1e83bfc3b57efe5f64a0abc43c41003dfa9530efbe13115210eed068f4cc134
data/README.md CHANGED
@@ -35,21 +35,21 @@ DataGuru.configure do |config|
35
35
  end
36
36
  ```
37
37
 
38
- Possible configuration values:
38
+ **Required** configuration values:
39
39
 
40
- `api_url` - *[mandatory]* api server where data from Permissions is stored
40
+ `api_url` - url of server managing the Permissions repo
41
41
 
42
- `access_token` - *[mandatory]* token needed for verifying access to api server
42
+ `access_token` - token for authorizing access to the server
43
43
 
44
- ## Usage
44
+ ## Use
45
45
 
46
46
  If you use default config files (see Permissions section below) you can simply do:
47
47
 
48
48
  ```ruby
49
- data = DataGuru::Client.new
49
+ data = DataGuru::Client.new(api_url: <URL>, access_token: <TOKEN>)
50
50
 
51
51
  # get collections
52
- data.users.all
52
+ data.members.all
53
53
  data.projects.all
54
54
  data.github_teams.all
55
55
  data.google_groups.all
@@ -58,20 +58,20 @@ data.toggl_teams.all
58
58
 
59
59
  # find in collections by attribute
60
60
  data.projects.find{ |project| project.display_name == 'Some project' }
61
- data.users.find{ |user| user.github == 'example' }
61
+ data.members.find{ |member| member.github == 'example' }
62
62
 
63
- # filter through collections by attributes
64
- data.users.select{ |user| user.external }
65
- data.users.select{ |user| user.public_key.nil? }.count
63
+ # filter collections by attributes
64
+ data.members.select{ |member| member.external }
65
+ data.members.select{ |member| member.public_key.nil? }.count
66
66
 
67
- # select key names of all github teams user belongs to
68
- user = data.users.first
69
- data.github_teams.select{ |team| team.members.include?(user.id) }.map(&:id)
67
+ # select key names of all github teams a member belongs to
68
+ member = data.members.first
69
+ data.github_teams.select{ |team| team.members.include?(member.id) }.map(&:id)
70
70
  ```
71
71
 
72
- The collections have `Enumerable` module included so you can filter models by attributes easily (`data.users.select{ |user| user.some_method }`)
72
+ The collections `include Enumerable` module so that you can filter models by attributes easily (`data.members.select{ |member| member.some_method }`).
73
73
 
74
- You can refresh repo and storage at any time, just do:
74
+ You can refresh repo and storage at any time:
75
75
 
76
76
  ```ruby
77
77
  data = DataGuru::Client.new
@@ -82,54 +82,62 @@ On a single model you can do:
82
82
 
83
83
  ```ruby
84
84
  data = DataGuru::Client.new
85
- user = data.users.all.first
85
+ member = data.members.all.first
86
86
 
87
- # to get list of user attributes
88
- user.attributes
87
+ # to get list of member attributes
88
+ member.attributes
89
89
 
90
90
  # to get list of permitted and required attributes (see Permisions section below)
91
- user.permitted_attributes
92
- user.required_attributes
91
+ member.permitted_attributes
92
+ member.required_attributes
93
93
 
94
- # check if user has all required attributes set
95
- user.valid?
96
- user.missing_attributes
94
+ # check if member has all required attributes set
95
+ member.valid?
96
+ member.missing_attributes
97
97
  ```
98
98
 
99
- Each model has a set of getter methods (permitted_attributes) so you can for example do `user.github` to get just the github username of the user.
100
- Each model also has `id` method which returns the name of the file, for example for the user in a file `john.doe.yml` will return `john.doe`.
99
+ Each model has a set of getter methods (`permitted_attributes`), so for example you can do `member.github` to get just the github membername.
100
+ Each model also has `id` method which returns the name of the file the member is stored in, for example it will return `john.doe` for the member in the file `john.doe.yml`.
101
101
 
102
102
  You can check whether configuration (in your rails app) and model configuration (in your permissions repo) is valid by running `DataGuru::Client.new.errors`.
103
103
 
104
104
  ### Permissions
105
105
 
106
- A sample permissions repo contains a `config` directory with files like `user.yml`, `project.yml`, `github_team.yml`. In these files you specify attributes for each model with information about whether they are required, what is the default value and what type of value it is.
106
+ A sample permissions repo contains a `config/` directory with files like `member.yml`, `project.yml`, `github_team.yml`. In these files you specify attributes of each model with information about whether they are required, what is the default value, and what is the datatype.
107
107
 
108
- ```
108
+ ```yaml
109
109
  ---
110
- name:
111
- required: true
112
- default_value:
113
- value_type: string
114
110
  emails:
111
+ default_value: []
115
112
  required: true
116
- default_value:
117
113
  value_type: array
118
114
  external:
119
- required: false
120
115
  default_value: false
116
+ required: true
121
117
  value_type: boolean
118
+ github:
119
+ default_value:
120
+ required: true
121
+ value_type: string
122
+ name:
123
+ default_value:
124
+ required: true
125
+ value_type: string
126
+ public_key:
127
+ default_value:
128
+ required: true
129
+ value_type: string
122
130
  ```
123
131
 
124
- The methods `permitted_attributes` and `required_attributes` returns the array of specified attributes.
132
+ The methods `permitted_attributes` and `required_attributes` return array of specified attributes.
125
133
 
126
- All the files should be under the appropriate directory, for example all users under `users` directory, they can be nested if you want.
134
+ All files should stay in appropriate directories, e.g. store members in `members/` directory.
127
135
 
128
- For more information see the [permissions template repo](https://github.com/ardhena/permissions-template).
136
+ For more details see the [sample permissions repo](https://github.com/netguru/access-permissions-sample).
129
137
 
130
138
  ## Development
131
139
 
132
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
140
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
133
141
 
134
142
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
135
143
 
@@ -32,11 +32,12 @@ module DataGuru
32
32
  end
33
33
 
34
34
  def collection_resource_url(collection_type)
35
- "#{DataGuru.config.api_url}/#{collection_type}?token=#{DataGuru.config.access_token}"
35
+ "#{DataGuru.config.api_url}/collections/#{collection_type}" \
36
+ "?token=#{DataGuru.config.access_token}"
36
37
  end
37
38
 
38
39
  def config_resource_url
39
- "#{DataGuru.config.api_url}/config?token=#{DataGuru.config.access_token}"
40
+ "#{DataGuru.config.api_url}/collections/config?token=#{DataGuru.config.access_token}"
40
41
  end
41
42
 
42
43
  def config_data
@@ -21,7 +21,8 @@ module DataGuru
21
21
  end
22
22
 
23
23
  def config_resource_url
24
- "#{DataGuru.config.api_url}/config?token=#{DataGuru.config.access_token}"
24
+ "#{DataGuru.config.api_url}/collections/config" \
25
+ "?token=#{DataGuru.config.access_token}"
25
26
  end
26
27
 
27
28
  def keys
@@ -1,3 +1,3 @@
1
1
  module DataGuru
2
- VERSION = "0.4.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_guru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Nowak
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2015-10-20 00:00:00.000000000 Z
13
+ date: 2016-01-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport