redmine_rest 0.3.0 → 0.4.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: 60f9d21ded72e8820f98bef43db42e9f07ee830f
4
- data.tar.gz: 21c765be9944e3e68ece1cd98625e891d04dd5ef
3
+ metadata.gz: 96164b1590935de3603154ab2fd0faae02670348
4
+ data.tar.gz: aeddb22e3a0bd3592c76e50762249889e66da880
5
5
  SHA512:
6
- metadata.gz: c22d9098f4ead35819fdfbb8489b68c531b1fa9e3d78511c11b9d001c0513d27d82e4af2ec178e4e3907cad558117e75ca1320a6b33217ba0c3c9abb2fb4c41a
7
- data.tar.gz: a2ce1f62f121fd1ed2256435a2bb3bccb04f185ecafc40c35a470869aa16cdd60617aa5be0580df50d2ef3031853e0d3336d94cdaeccd5e1ed7b27eee5db622e
6
+ metadata.gz: 62be2a54cadea149d0eac4885ff729a4c2f3e36bfae5e7366f7b71a8ce4da7f036597f86948a4de6f65dd5d895bc1ec5e22171abbe9d8f257dd02d6e00edf5ac
7
+ data.tar.gz: ce47345536250edb7e5ff26ca95033a5c0de1e68fadcfc1e9bc761540e5b97f11214ddba22e9078fb3af3f4d111b242edc6a921545b0ae65cc5d40868ad32919
data/lib/redmine_rest.rb CHANGED
@@ -1,8 +1,3 @@
1
1
  require 'redmine_rest/version'
2
+ Dir[File.expand_path('../redmine_rest/helpers/**/*.rb', __FILE__)].each { |f| require f }
2
3
  require 'redmine_rest/models'
3
-
4
- #
5
- # top-level mainspace
6
- #
7
- module RedmineRest
8
- end
@@ -0,0 +1,16 @@
1
+ require 'active_resource'
2
+ require 'unicode'
3
+
4
+ module RedmineRest
5
+ module Helpers
6
+ #
7
+ # some methods for ActiveResource collections
8
+ #
9
+ module Collection
10
+ def filter_by_name_substring(str)
11
+ str = Unicode.downcase(str)
12
+ self.class.new @elements.find_all { |e| Unicode.downcase(e.name).include? str }
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ require 'active_resource'
2
+
3
+ module RedmineRest
4
+ module Models
5
+ module Collections
6
+ #
7
+ # Methods for status collections
8
+ #
9
+ class IssueStatus < ActiveResource::Collection
10
+ include Helpers::Collection
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'active_resource'
2
+
3
+ module RedmineRest
4
+ module Models
5
+ module Collections
6
+ #
7
+ # Methods for project collections
8
+ #
9
+ class Project < ActiveResource::Collection
10
+ include Helpers::Collection
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'active_resource'
2
+
3
+ module RedmineRest
4
+ module Models
5
+ module Collections
6
+ #
7
+ # Methods for version collections
8
+ #
9
+ class Version < ActiveResource::Collection
10
+ include Helpers::Collection
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,7 @@
1
1
  require 'active_resource'
2
2
 
3
+ require_relative 'collections/issue_status'
4
+
3
5
  module RedmineRest
4
6
  module Models
5
7
  #
@@ -7,6 +9,14 @@ module RedmineRest
7
9
  #
8
10
  class IssueStatus < ActiveResource::Base
9
11
  self.format = :xml
12
+ self.collection_parser = Collections::IssueStatus
13
+
14
+ def self.find(*args)
15
+ fail('Issue statuses can be loaded as :all only') unless args.size == 1 && args.first == :all
16
+
17
+ return @statuses if @statuses
18
+ @statuses = super
19
+ end
10
20
  end
11
21
  end
12
22
  end
@@ -1,5 +1,7 @@
1
1
  require 'active_resource'
2
2
 
3
+ require_relative 'collections/project'
4
+
3
5
  module RedmineRest
4
6
  module Models
5
7
  #
@@ -7,6 +9,7 @@ module RedmineRest
7
9
  #
8
10
  class Project < ActiveResource::Base
9
11
  self.format = :xml
12
+ self.collection_parser = Collections::Project
10
13
  end
11
14
  end
12
15
  end
@@ -5,6 +5,11 @@ module RedmineRest
5
5
  #
6
6
  # TimeEntry model
7
7
  #
8
+ # *WARNING:*
9
+ #
10
+ # You have to define activity_id if you wanna create TimeEntry.
11
+ # Or you should set default activity in Redmine administration.
12
+ #
8
13
  class TimeEntry < ActiveResource::Base
9
14
  self.format = :xml
10
15
  end
@@ -1,11 +1,15 @@
1
1
  require 'active_resource'
2
2
 
3
+ require_relative 'collections/version'
4
+
3
5
  module RedmineRest
4
6
  module Models
5
7
  #
6
8
  # Version model
7
9
  #
8
10
  class Version < ActiveResource::Base
11
+ self.format = :xml
12
+ self.collection_parser = Collections::Version
9
13
  end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module RedmineRest
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
data/redmine_rest.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rubocop', '0.36.0'
25
25
 
26
26
  spec.add_dependency 'activeresource', '4.0.0'
27
+ spec.add_dependency 'unicode', '0.4.4.2'
27
28
  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.3.0
4
+ version: 0.4.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-05 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
82
  version: 4.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: unicode
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.4.4.2
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.4.4.2
83
97
  description:
84
98
  email:
85
99
  - non.dmitriy@gmail.com
@@ -97,8 +111,12 @@ files:
97
111
  - bin/console
98
112
  - bin/setup
99
113
  - lib/redmine_rest.rb
114
+ - lib/redmine_rest/helpers/collection.rb
100
115
  - lib/redmine_rest/models.rb
101
116
  - lib/redmine_rest/models/collections/issue.rb
117
+ - lib/redmine_rest/models/collections/issue_status.rb
118
+ - lib/redmine_rest/models/collections/project.rb
119
+ - lib/redmine_rest/models/collections/version.rb
102
120
  - lib/redmine_rest/models/issue.rb
103
121
  - lib/redmine_rest/models/issue_status.rb
104
122
  - lib/redmine_rest/models/project.rb