redmine_rest 0.4.0 → 0.5.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: 96164b1590935de3603154ab2fd0faae02670348
4
- data.tar.gz: aeddb22e3a0bd3592c76e50762249889e66da880
3
+ metadata.gz: 48c83e8cd8b95eda110d312a81120070f76b8178
4
+ data.tar.gz: c488561848255e6913dfafe166804ace1d772bcc
5
5
  SHA512:
6
- metadata.gz: 62be2a54cadea149d0eac4885ff729a4c2f3e36bfae5e7366f7b71a8ce4da7f036597f86948a4de6f65dd5d895bc1ec5e22171abbe9d8f257dd02d6e00edf5ac
7
- data.tar.gz: ce47345536250edb7e5ff26ca95033a5c0de1e68fadcfc1e9bc761540e5b97f11214ddba22e9078fb3af3f4d111b242edc6a921545b0ae65cc5d40868ad32919
6
+ metadata.gz: e80080d2a9414b8836da70c9182fd49a1706471c70754853a576019fcf69919825b309013f40c401803a15cdaa2062e649630349339fa24fe50e2fcf3de7682d
7
+ data.tar.gz: 766c6756120983d751e8396c3e06745cbb30b3d2bb4f83fec810f0a975266eb9fb5dd046a4d4e106125000c56f657a4bddffcc383dafbd8eff8d6bf93bc35823
data/bin/console CHANGED
@@ -11,4 +11,6 @@ require 'redmine_rest'
11
11
  # Pry.start
12
12
 
13
13
  require 'irb'
14
+
15
+ ActiveResource::Base.logger = Logger.new(STDOUT)
14
16
  IRB.start
@@ -0,0 +1,14 @@
1
+ require 'active_resource'
2
+
3
+ module RedmineRest
4
+ module Models
5
+ module Collections
6
+ #
7
+ # Methods for tracker collections
8
+ #
9
+ class Tracker < ActiveResource::Collection
10
+ include Helpers::Collection
11
+ end
12
+ end
13
+ end
14
+ end
@@ -24,6 +24,8 @@ module RedmineRest
24
24
  has_many :watchers, class_name: User
25
25
  has_many :relations, class_name: Relation
26
26
 
27
+ validates :subject, :tracker_id, presence: true
28
+
27
29
  #
28
30
  # Adds journals, relations, children and watchers to request.
29
31
  #
@@ -43,15 +45,8 @@ module RedmineRest
43
45
  super(what, options)
44
46
  end
45
47
 
46
- #
47
- # Methods for necessery attributes.
48
- #
49
- # I guess it's equal to `.<attribute>?`
50
- #
51
- [:author, :assigned_to, :project, :version, :children, :watchers, :relations, :parent].each do |attr|
52
- define_method(attr) do
53
- attributes[attr]
54
- end
48
+ def method_missing(method, *args)
49
+ args.empty? && !block_given? ? attributes[method] : super
55
50
  end
56
51
  end
57
52
  end
@@ -0,0 +1,22 @@
1
+ require 'active_resource'
2
+
3
+ require_relative 'collections/tracker'
4
+
5
+ module RedmineRest
6
+ module Models
7
+ #
8
+ # Tracker model
9
+ #
10
+ class Tracker < ActiveResource::Base
11
+ self.format = :xml
12
+ self.collection_parser = Collections::Tracker
13
+
14
+ def self.find(*args)
15
+ fail('Trackers can be loaded as :all only') unless args.size == 1 && args.first == :all
16
+
17
+ return @trackers if @trackers
18
+ @trackers = super
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module RedmineRest
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  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.4.0
4
+ version: 0.5.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-08 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -116,12 +116,14 @@ files:
116
116
  - lib/redmine_rest/models/collections/issue.rb
117
117
  - lib/redmine_rest/models/collections/issue_status.rb
118
118
  - lib/redmine_rest/models/collections/project.rb
119
+ - lib/redmine_rest/models/collections/tracker.rb
119
120
  - lib/redmine_rest/models/collections/version.rb
120
121
  - lib/redmine_rest/models/issue.rb
121
122
  - lib/redmine_rest/models/issue_status.rb
122
123
  - lib/redmine_rest/models/project.rb
123
124
  - lib/redmine_rest/models/relation.rb
124
125
  - lib/redmine_rest/models/time_entry.rb
126
+ - lib/redmine_rest/models/tracker.rb
125
127
  - lib/redmine_rest/models/user.rb
126
128
  - lib/redmine_rest/models/version.rb
127
129
  - lib/redmine_rest/version.rb