easy-resources 0.5.5 → 0.6.1

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -0
  3. data/lib/easy/resources/redmine/redmine_base.rb +1 -0
  4. data/lib/easy/resources/redmine/user.rb +15 -0
  5. data/lib/easy/resources/version.rb +1 -1
  6. data/lib/easy/resources.rb +1 -0
  7. data/spec/easy_resources_spec.rb +20 -0
  8. data/spec/fixtures/files/user/show.xml +21 -0
  9. data/spec/models/easy-resources/redmine/user_spec.rb +19 -0
  10. data/spec/spec_helper.rb +4 -1
  11. metadata +9 -113
  12. data/spec/dummy/Rakefile +0 -6
  13. data/spec/dummy/app/assets/config/manifest.js +0 -3
  14. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  15. data/spec/dummy/app/assets/javascripts/cable.js +0 -13
  16. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  17. data/spec/dummy/app/channels/application_cable/channel.rb +0 -4
  18. data/spec/dummy/app/channels/application_cable/connection.rb +0 -4
  19. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  20. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  21. data/spec/dummy/app/jobs/application_job.rb +0 -2
  22. data/spec/dummy/app/mailers/application_mailer.rb +0 -4
  23. data/spec/dummy/app/models/application_record.rb +0 -3
  24. data/spec/dummy/app/views/layouts/application.html.erb +0 -15
  25. data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
  26. data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
  27. data/spec/dummy/bin/bundle +0 -3
  28. data/spec/dummy/bin/rails +0 -4
  29. data/spec/dummy/bin/rake +0 -4
  30. data/spec/dummy/bin/setup +0 -36
  31. data/spec/dummy/bin/update +0 -31
  32. data/spec/dummy/bin/yarn +0 -11
  33. data/spec/dummy/config/application.rb +0 -19
  34. data/spec/dummy/config/boot.rb +0 -5
  35. data/spec/dummy/config/cable.yml +0 -10
  36. data/spec/dummy/config/database.yml +0 -25
  37. data/spec/dummy/config/environment.rb +0 -5
  38. data/spec/dummy/config/environments/development.rb +0 -61
  39. data/spec/dummy/config/environments/production.rb +0 -94
  40. data/spec/dummy/config/environments/test.rb +0 -46
  41. data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -8
  42. data/spec/dummy/config/initializers/assets.rb +0 -14
  43. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  44. data/spec/dummy/config/initializers/content_security_policy.rb +0 -25
  45. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
  46. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  47. data/spec/dummy/config/initializers/inflections.rb +0 -16
  48. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  49. data/spec/dummy/config/initializers/new_framework_defaults_5_2.rb +0 -38
  50. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  51. data/spec/dummy/config/locales/en.yml +0 -33
  52. data/spec/dummy/config/puma.rb +0 -34
  53. data/spec/dummy/config/routes.rb +0 -3
  54. data/spec/dummy/config/spring.rb +0 -6
  55. data/spec/dummy/config/storage.yml +0 -34
  56. data/spec/dummy/config.ru +0 -5
  57. data/spec/dummy/db/test.sqlite3 +0 -0
  58. data/spec/dummy/log/development.log +0 -0
  59. data/spec/dummy/log/test.log +0 -0
  60. data/spec/dummy/package.json +0 -5
  61. data/spec/dummy/public/404.html +0 -67
  62. data/spec/dummy/public/422.html +0 -67
  63. data/spec/dummy/public/500.html +0 -66
  64. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  65. data/spec/dummy/public/apple-touch-icon.png +0 -0
  66. data/spec/dummy/public/favicon.ico +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b17566f7ec6789071ec27d98f8b7be0fd8a72857cdf30d03203683fb259192f
4
- data.tar.gz: 1c117186911ca2277b09d463933ba923d92eebec86c50bf80d23dca689bf031c
3
+ metadata.gz: 64a20718aae7ffc73d9edfc4c85e72753304cf64f9b2f46110495188e69069fb
4
+ data.tar.gz: 0b2b651ccb2de8b5e2f4c1dd621cccf99e09d6125bf03deaffa02ca1485ba7fb
5
5
  SHA512:
6
- metadata.gz: 11eba67236d54851faa1869f884a54c83c0595778b1fbda9d7479afd9369ce9157446d495fb82f35cd636be5cd670e21e0f7641ca2263954fccd5c6b906229a6
7
- data.tar.gz: 7ef6f369074165fe05213d85939f2a2c544e251a4464e11f6e50bde6053fb97a476fa80a985f0c540bf620d88d3c73aad845dee573db2af1bf6ca9cd26b884f0
6
+ metadata.gz: f7bbd2dfa99cd99f3ffe8b131915cd3f987a330dcbb3b4a670b5afd3c7fdc734b54bc4aef50a178fb551a7a2082bc0d74a88509085137eecaf6e1dacd8acb065
7
+ data.tar.gz: fc51e66045ed5cd92619a30c0f0267fe4f9d3e35ec220f38bb905a1ca3628d9625ce5e77418d4471ed33991934493b498609f13ae4fefa8d04781ca523ba1f2a
data/README.md CHANGED
@@ -20,6 +20,30 @@ And then execute:
20
20
 
21
21
  $ bundle
22
22
 
23
+ ## Configuration
24
+
25
+ 1. in config/secrets.yml
26
+ ```yaml
27
+ production:
28
+ sites:
29
+ redmine:
30
+ api_key: secret
31
+ url: https://redmine.app
32
+ ```
33
+ 2. then in config/initializers/easy.rb
34
+ ```ruby
35
+ require "easy/configuration"
36
+ Easy::Resources::Redmine::RedmineBase.configure
37
+ ```
38
+
39
+ OR
40
+
41
+ just in config/initializers/easy.rb
42
+ ```ruby
43
+ require "easy/configuration"
44
+ Easy::Resources::Redmine::RedmineBase.configure api_key: "secret", url: "https://redmine.app"
45
+ ```
46
+
23
47
  ## Development
24
48
 
25
49
  run bundle install install and do not forget to run `rspec`.
@@ -13,6 +13,7 @@ module Easy
13
13
  @api_key = key
14
14
  end
15
15
 
16
+ # @param [Hash, nil] conf
16
17
  def configure(conf = nil)
17
18
  conf ||= Easy.config.sites.redmine
18
19
  super(conf)
@@ -0,0 +1,15 @@
1
+ module Easy
2
+ module Resources
3
+ module Redmine
4
+ class User < RedmineBase
5
+
6
+ self.element_name = 'user'
7
+
8
+ def name
9
+ "#{firstname} #{lastname}"
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Easy
2
2
  module Resources
3
- VERSION = '0.5.5'
3
+ VERSION = '0.6.1'
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ module Easy
19
19
  autoload :EasyWebApplicationActivity
20
20
  autoload :Issue
21
21
  autoload :Project
22
+ autoload :User
22
23
 
23
24
  end
24
25
 
@@ -5,4 +5,24 @@ RSpec.describe Easy::Resources do
5
5
  expect(Easy::Resources::VERSION).not_to be nil
6
6
  end
7
7
 
8
+ describe '.configure' do
9
+
10
+ context "Easy::Resource" do
11
+ it "resource raise error" do
12
+ expect { Easy::Resource.configure api_key: "xx1", url: "https://test.dummy" }.to raise_exception NoMethodError
13
+ end
14
+ end
15
+
16
+ context "Easy::Resources::Redmine::RedmineBase" do
17
+ it "Easy::Resources::Redmine::RedmineBase" do
18
+ expect(Easy::Resources::Redmine::RedmineBase).to receive(:api_key=).with("xx1")
19
+ expect(Easy::Resources::Redmine::RedmineBase).to receive(:site=).with("https://test.dummy")
20
+ Easy::Resources::Redmine::RedmineBase.configure api_key: "xx1", url: "https://test.dummy"
21
+ end
22
+ end
23
+
24
+
25
+
26
+ end
27
+
8
28
  end
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <user>
3
+ <id>34</id>
4
+ <login>consultant1</login>
5
+ <admin>false</admin>
6
+ <firstname>Connie</firstname>
7
+ <lastname>Consultant</lastname>
8
+ <utc_offset>0</utc_offset>
9
+ <mail>cons1@easy.cz</mail>
10
+ <created_on>2017-10-21T22:00:00Z</created_on>
11
+ <last_login_on/>
12
+ <status>1</status>
13
+ <easy_system_flag>false</easy_system_flag>
14
+ <easy_external_id/>
15
+ <easy_user_type id="4" name="Project manager"/>
16
+ <easy_lesser_admin>false</easy_lesser_admin>
17
+ <language>en</language>
18
+ <avatar_url>
19
+ https://demo.easyproject.com/images/easy_images/easy_avatars/13/small/265495.jpg?1489589966
20
+ </avatar_url>
21
+ </user>
@@ -0,0 +1,19 @@
1
+ RSpec.describe Easy::Resources::Redmine::User do
2
+ include_context "redmine active resource shares" do
3
+ let(:entity_name) { 'user' }
4
+ end
5
+
6
+
7
+ it 'get user' do
8
+ expect(find_entity.mail).not_to be_empty
9
+ end
10
+
11
+ it "#name" do
12
+ expect(find_entity.name).to eq "Connie Consultant"
13
+ end
14
+ #
15
+ # it 'issue has project' do
16
+ # expect(find_entity.project).to be_a Easy::Resources::Redmine::Project
17
+ # end
18
+
19
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  ENV["RAILS_ENV"] = "test"
2
2
  require "simplecov"
3
- SimpleCov.start 'rails'
3
+ SimpleCov.start 'rails' do
4
+ add_filter 'lib/easy/resources/spec_helper'
5
+ add_filter 'lib/easy/resources/version'
6
+ end
4
7
 
5
8
  require "bundler/setup"
6
9
  require "webmock/rspec"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - petr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-26 00:00:00.000000000 Z
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -143,63 +143,9 @@ files:
143
143
  - lib/easy/resources/redmine/issue.rb
144
144
  - lib/easy/resources/redmine/project.rb
145
145
  - lib/easy/resources/redmine/redmine_base.rb
146
+ - lib/easy/resources/redmine/user.rb
146
147
  - lib/easy/resources/spec_helper.rb
147
148
  - lib/easy/resources/version.rb
148
- - spec/dummy/Rakefile
149
- - spec/dummy/app/assets/config/manifest.js
150
- - spec/dummy/app/assets/javascripts/application.js
151
- - spec/dummy/app/assets/javascripts/cable.js
152
- - spec/dummy/app/assets/stylesheets/application.css
153
- - spec/dummy/app/channels/application_cable/channel.rb
154
- - spec/dummy/app/channels/application_cable/connection.rb
155
- - spec/dummy/app/controllers/application_controller.rb
156
- - spec/dummy/app/helpers/application_helper.rb
157
- - spec/dummy/app/jobs/application_job.rb
158
- - spec/dummy/app/mailers/application_mailer.rb
159
- - spec/dummy/app/models/application_record.rb
160
- - spec/dummy/app/views/layouts/application.html.erb
161
- - spec/dummy/app/views/layouts/mailer.html.erb
162
- - spec/dummy/app/views/layouts/mailer.text.erb
163
- - spec/dummy/bin/bundle
164
- - spec/dummy/bin/rails
165
- - spec/dummy/bin/rake
166
- - spec/dummy/bin/setup
167
- - spec/dummy/bin/update
168
- - spec/dummy/bin/yarn
169
- - spec/dummy/config.ru
170
- - spec/dummy/config/application.rb
171
- - spec/dummy/config/boot.rb
172
- - spec/dummy/config/cable.yml
173
- - spec/dummy/config/database.yml
174
- - spec/dummy/config/environment.rb
175
- - spec/dummy/config/environments/development.rb
176
- - spec/dummy/config/environments/production.rb
177
- - spec/dummy/config/environments/test.rb
178
- - spec/dummy/config/initializers/application_controller_renderer.rb
179
- - spec/dummy/config/initializers/assets.rb
180
- - spec/dummy/config/initializers/backtrace_silencers.rb
181
- - spec/dummy/config/initializers/content_security_policy.rb
182
- - spec/dummy/config/initializers/cookies_serializer.rb
183
- - spec/dummy/config/initializers/filter_parameter_logging.rb
184
- - spec/dummy/config/initializers/inflections.rb
185
- - spec/dummy/config/initializers/mime_types.rb
186
- - spec/dummy/config/initializers/new_framework_defaults_5_2.rb
187
- - spec/dummy/config/initializers/wrap_parameters.rb
188
- - spec/dummy/config/locales/en.yml
189
- - spec/dummy/config/puma.rb
190
- - spec/dummy/config/routes.rb
191
- - spec/dummy/config/spring.rb
192
- - spec/dummy/config/storage.yml
193
- - spec/dummy/db/test.sqlite3
194
- - spec/dummy/log/development.log
195
- - spec/dummy/log/test.log
196
- - spec/dummy/package.json
197
- - spec/dummy/public/404.html
198
- - spec/dummy/public/422.html
199
- - spec/dummy/public/500.html
200
- - spec/dummy/public/apple-touch-icon-precomposed.png
201
- - spec/dummy/public/apple-touch-icon.png
202
- - spec/dummy/public/favicon.ico
203
149
  - spec/easy_resources_spec.rb
204
150
  - spec/fixtures/files/easy_contact.json
205
151
  - spec/fixtures/files/easy_contact/show.xml
@@ -218,6 +164,7 @@ files:
218
164
  - spec/fixtures/files/issue/show.xml
219
165
  - spec/fixtures/files/project.json
220
166
  - spec/fixtures/files/project/show.xml
167
+ - spec/fixtures/files/user/show.xml
221
168
  - spec/models/easy-resources/redmine/easy_contact_spec.rb
222
169
  - spec/models/easy-resources/redmine/easy_crm_case_spec.rb
223
170
  - spec/models/easy-resources/redmine/easy_web_application_activity_spec.rb
@@ -225,6 +172,7 @@ files:
225
172
  - spec/models/easy-resources/redmine/issue_spec.rb
226
173
  - spec/models/easy-resources/redmine/project_spec.rb
227
174
  - spec/models/easy-resources/redmine/redmine_base_spec.rb
175
+ - spec/models/easy-resources/redmine/user_spec.rb
228
176
  - spec/models/easy-resources/resource_spec.rb
229
177
  - spec/spec_helper.rb
230
178
  - spec/support/active_resource.rb
@@ -250,67 +198,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
198
  - !ruby/object:Gem::Version
251
199
  version: '0'
252
200
  requirements: []
253
- rubygems_version: 3.0.2
201
+ rubyforge_project:
202
+ rubygems_version: 2.7.6
254
203
  signing_key:
255
204
  specification_version: 4
256
205
  summary: Summary of Easy::Resources.
257
206
  test_files:
258
207
  - spec/spec_helper.rb
259
- - spec/dummy/app/mailers/application_mailer.rb
260
- - spec/dummy/app/models/application_record.rb
261
- - spec/dummy/app/jobs/application_job.rb
262
- - spec/dummy/app/controllers/application_controller.rb
263
- - spec/dummy/app/views/layouts/application.html.erb
264
- - spec/dummy/app/views/layouts/mailer.html.erb
265
- - spec/dummy/app/views/layouts/mailer.text.erb
266
- - spec/dummy/app/assets/config/manifest.js
267
- - spec/dummy/app/assets/javascripts/cable.js
268
- - spec/dummy/app/assets/javascripts/application.js
269
- - spec/dummy/app/assets/stylesheets/application.css
270
- - spec/dummy/app/helpers/application_helper.rb
271
- - spec/dummy/app/channels/application_cable/connection.rb
272
- - spec/dummy/app/channels/application_cable/channel.rb
273
- - spec/dummy/bin/update
274
- - spec/dummy/bin/rake
275
- - spec/dummy/bin/setup
276
- - spec/dummy/bin/bundle
277
- - spec/dummy/bin/yarn
278
- - spec/dummy/bin/rails
279
- - spec/dummy/config/routes.rb
280
- - spec/dummy/config/locales/en.yml
281
- - spec/dummy/config/cable.yml
282
- - spec/dummy/config/environments/production.rb
283
- - spec/dummy/config/environments/development.rb
284
- - spec/dummy/config/environments/test.rb
285
- - spec/dummy/config/spring.rb
286
- - spec/dummy/config/environment.rb
287
- - spec/dummy/config/storage.yml
288
- - spec/dummy/config/application.rb
289
- - spec/dummy/config/puma.rb
290
- - spec/dummy/config/database.yml
291
- - spec/dummy/config/boot.rb
292
- - spec/dummy/config/initializers/application_controller_renderer.rb
293
- - spec/dummy/config/initializers/backtrace_silencers.rb
294
- - spec/dummy/config/initializers/mime_types.rb
295
- - spec/dummy/config/initializers/filter_parameter_logging.rb
296
- - spec/dummy/config/initializers/wrap_parameters.rb
297
- - spec/dummy/config/initializers/assets.rb
298
- - spec/dummy/config/initializers/cookies_serializer.rb
299
- - spec/dummy/config/initializers/content_security_policy.rb
300
- - spec/dummy/config/initializers/inflections.rb
301
- - spec/dummy/config/initializers/new_framework_defaults_5_2.rb
302
- - spec/dummy/config.ru
303
- - spec/dummy/Rakefile
304
- - spec/dummy/public/favicon.ico
305
- - spec/dummy/public/422.html
306
- - spec/dummy/public/apple-touch-icon.png
307
- - spec/dummy/public/500.html
308
- - spec/dummy/public/404.html
309
- - spec/dummy/public/apple-touch-icon-precomposed.png
310
- - spec/dummy/package.json
311
- - spec/dummy/db/test.sqlite3
312
- - spec/dummy/log/test.log
313
- - spec/dummy/log/development.log
314
208
  - spec/models/easy-resources/redmine/project_spec.rb
315
209
  - spec/models/easy-resources/redmine/easy_crm_case_spec.rb
316
210
  - spec/models/easy-resources/redmine/easy_contact_spec.rb
@@ -318,6 +212,7 @@ test_files:
318
212
  - spec/models/easy-resources/redmine/redmine_base_spec.rb
319
213
  - spec/models/easy-resources/redmine/easy_web_application_activity_spec.rb
320
214
  - spec/models/easy-resources/redmine/easy_web_application_spec.rb
215
+ - spec/models/easy-resources/redmine/user_spec.rb
321
216
  - spec/models/easy-resources/resource_spec.rb
322
217
  - spec/support/active_resource.rb
323
218
  - spec/support/fixtures.rb
@@ -328,6 +223,7 @@ test_files:
328
223
  - spec/fixtures/files/easy_crm_case/show.xml
329
224
  - spec/fixtures/files/project.json
330
225
  - spec/fixtures/files/issue.json
226
+ - spec/fixtures/files/user/show.xml
331
227
  - spec/fixtures/files/project/show.xml
332
228
  - spec/fixtures/files/issue/show.xml
333
229
  - spec/fixtures/files/easy_contact.json
data/spec/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require_relative 'config/application'
5
-
6
- Rails.application.load_tasks
@@ -1,3 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../javascripts .js
3
- //= link_directory ../stylesheets .css
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require rails-ujs
14
- //= require activestorage
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- // Action Cable provides the framework to deal with WebSockets in Rails.
2
- // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
- //
4
- //= require action_cable
5
- //= require_self
6
- //= require_tree ./channels
7
-
8
- (function() {
9
- this.App || (this.App = {});
10
-
11
- App.cable = ActionCable.createConsumer();
12
-
13
- }).call(this);
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end