redmine_rest 0.1.1 → 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
  SHA1:
3
- metadata.gz: 47ba9981d3a1c0ec378761361a4fb2d78567576d
4
- data.tar.gz: 3869e170a9f1f7963c1a809695d495fc45715321
3
+ metadata.gz: ac3d0294a5bcc3ee1ce3fc8ff6f9c2236379280d
4
+ data.tar.gz: 26fa8199cbabbadcb4c78e109bf9662d2b082307
5
5
  SHA512:
6
- metadata.gz: 491477c10183f3a00af074318b03a9221c2050dbb7a7a73b61678b3138da44be5aa008427828eee6e7c8981fa7fe4edb75091cb40553793949cd93791d382d92
7
- data.tar.gz: ab062a2f8f92f74ae5b22d4dea6b909ccd75ef3aec69dcf91a67ccd9120769a5e1338904dfd853aaab311aa041b441ccd6baec60af07f20770af20b17bb190a6
6
+ metadata.gz: 28dcb1ab6e507c794361c0d0bc06d0469925c9e93230217353a457074d5edca73486dd4172db2ffa671d5ae459a33dc08bd64b934404201929f18ccf06ab3432
7
+ data.tar.gz: 1e64494ef73ea5e3fe78a4442bf299320f5ce9235151f8f93982295f0a2dc5d5d6d3904c2078d6ad077ca31b3bf5c2514fd12c08747b74c8eb7cd8b95fe464b0
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # RedmineRest
2
+ [![Gem Version](https://badge.fury.io/rb/redmine_rest.svg)](https://badge.fury.io/rb/redmine_rest)
2
3
 
3
4
  This is gem with some ActiveResource models for Redmine.
4
5
 
@@ -21,10 +22,19 @@ Or install it yourself as:
21
22
 
22
23
  ## Usage
23
24
 
24
- RedmineRest::Models.configure_models user: 'user', password: 'password', site: 'URL'
25
- # or by using apikey:
26
- RedmineRest::Models.configure_models apikey: 'apikey', site: 'URL'
27
- issue = RedmineRest::Models::Issue.find(1234)
25
+ ```ruby
26
+ RedmineRest::Models.configure_models user: 'user', password: 'password', site: 'URL'
27
+ # or by using apikey:
28
+ RedmineRest::Models.configure_models apikey: 'apikey', site: 'URL'
29
+
30
+ include RedmineRest::Models
31
+ issues_by_project = Issue.all.group_by_project
32
+ issues_by_project.each do |project, issues|
33
+ puts project.name
34
+ issues.each { |i| puts i.subject }
35
+ puts
36
+ end
37
+ ```
28
38
 
29
39
 
30
40
  ## Contributing
@@ -0,0 +1,24 @@
1
+ require 'active_resource'
2
+
3
+ module RedmineRest
4
+ module Models
5
+ module Collections
6
+ #
7
+ # Methods for issue collections
8
+ #
9
+ class Issue < ActiveResource::Collection
10
+ def group_by_project
11
+ group_by(&:project)
12
+ end
13
+
14
+ def group_by_author
15
+ group_by(&:author)
16
+ end
17
+
18
+ def group_by_assigned_to
19
+ group_by(&:assigned_to)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -3,6 +3,7 @@ require 'active_resource'
3
3
  require_relative 'user'
4
4
  require_relative 'project'
5
5
  require_relative 'version'
6
+ require_relative 'collections/issue'
6
7
 
7
8
  module RedmineRest
8
9
  module Models
@@ -11,6 +12,8 @@ module RedmineRest
11
12
  #
12
13
  class Issue < ActiveResource::Base
13
14
  self.format = :xml
15
+ self.collection_parser = Collections::Issue
16
+
14
17
  has_one :author, class_name: User
15
18
  has_one :assigned_to, class_name: User
16
19
  has_one :project, class_name: Project
@@ -8,6 +8,14 @@ module RedmineRest
8
8
  class User < ActiveResource::Base
9
9
  self.format = :xml
10
10
 
11
+ def self.find_by_name_or_mail(str)
12
+ all_by_name_or_mail(str).first
13
+ end
14
+
15
+ def self.all_by_name_or_mail(str)
16
+ find :all, params: { name: str }
17
+ end
18
+
11
19
  def issues(params = {})
12
20
  params[:assigned_to_id] = id
13
21
  Issue.all params: params
@@ -1,3 +1,3 @@
1
1
  module RedmineRest
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/lib/redmine_rest.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'redmine_rest/version'
2
2
  require 'redmine_rest/models'
3
3
 
4
+ #
5
+ # top-level mainspace
6
+ #
4
7
  module RedmineRest
5
- # Your code goes here...
6
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Non
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,6 +98,7 @@ files:
98
98
  - bin/setup
99
99
  - lib/redmine_rest.rb
100
100
  - lib/redmine_rest/models.rb
101
+ - lib/redmine_rest/models/collections/issue.rb
101
102
  - lib/redmine_rest/models/issue.rb
102
103
  - lib/redmine_rest/models/issue_status.rb
103
104
  - lib/redmine_rest/models/project.rb