howlingmine-client 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,7 +1,11 @@
1
- === 0.1.1 / 2009-10-06
1
+ === 0.1.2 / 2009-12-16
2
+
3
+ * add support for custom fields
4
+
5
+ === 0.1.1 / 2009-12-15
2
6
 
3
7
  * fix gem dependencies
4
8
 
5
- === 0.1 / 2009-10-06
9
+ === 0.1 / 2009-12-15
6
10
 
7
11
  * Initial release
@@ -19,6 +19,8 @@ end
19
19
  issue = HowlingMine::Issue.new
20
20
  issue.subject = 'issue number one'
21
21
  issue.description = 'oh my, first issue'
22
+ # create a custom field
23
+ issue.custom_fields[:foofield1] = 'value1'
22
24
  # if an issue with the same subject exist, the default behaviour
23
25
  # is to update the journal creating another comment
24
26
  issue.save
@@ -35,4 +37,4 @@ issue = HowlingMine::Issue.last
35
37
  if issue
36
38
  puts '-' * 40
37
39
  puts "Issue ##{issue.id} updated on: #{issue.updated_on.strftime '%F %H:%M'}"
38
- end
40
+ end
@@ -98,28 +98,28 @@
98
98
  <key>caret</key>
99
99
  <dict>
100
100
  <key>column</key>
101
- <integer>23</integer>
101
+ <integer>10</integer>
102
102
  <key>line</key>
103
- <integer>33</integer>
103
+ <integer>13</integer>
104
104
  </dict>
105
105
  <key>firstVisibleColumn</key>
106
106
  <integer>0</integer>
107
107
  <key>firstVisibleLine</key>
108
- <integer>48</integer>
108
+ <integer>0</integer>
109
109
  </dict>
110
110
  <key>test/issue_test.rb</key>
111
111
  <dict>
112
112
  <key>caret</key>
113
113
  <dict>
114
114
  <key>column</key>
115
- <integer>30</integer>
115
+ <integer>3</integer>
116
116
  <key>line</key>
117
- <integer>106</integer>
117
+ <integer>125</integer>
118
118
  </dict>
119
119
  <key>firstVisibleColumn</key>
120
120
  <integer>0</integer>
121
121
  <key>firstVisibleLine</key>
122
- <integer>0</integer>
122
+ <integer>94</integer>
123
123
  </dict>
124
124
  </dict>
125
125
  <key>openDocuments</key>
@@ -134,6 +134,6 @@
134
134
  <key>showFileHierarchyDrawer</key>
135
135
  <true/>
136
136
  <key>windowFrame</key>
137
- <string>{{300, 77}, {660, 645}}</string>
137
+ <string>{{287, 68}, {660, 645}}</string>
138
138
  </dict>
139
139
  </plist>
@@ -4,15 +4,26 @@ module HowlingMine
4
4
  attr_accessor :id, :subject, :description, :raw, :author
5
5
  attr_writer :created_on, :updated_on
6
6
 
7
+ def custom_fields
8
+ @custom_fields ||= {}
9
+ end
10
+
11
+ def method_missing(name, *args)
12
+ cf = @custom_fields[name]
13
+ if cf
14
+ cf['value']
15
+ else
16
+ super
17
+ end
18
+ end
19
+
7
20
  def save
8
21
  client = HowlingMine::Client
9
22
  params = {
10
23
  :subject => subject || 'no subject',
11
24
  :description => description || '',
12
25
  :author => author || 'none',
13
- #:custom_fields => {
14
- # :foofield1 => 'field-text'
15
- #}.to_yaml
26
+ :custom_fields => custom_fields.to_yaml
16
27
  }
17
28
 
18
29
  HowlingMine::Config.params.merge!(params)
@@ -48,6 +59,9 @@ module HowlingMine
48
59
  issue.created_on = i['created_on']
49
60
  issue.updated_on = i['updated_on']
50
61
  if i['custom_fields']
62
+ i['custom_fields'].each do |k,v|
63
+ issue.custom_fields[k.to_sym] = v
64
+ end
51
65
  end
52
66
  issues << issue
53
67
  end
data/lib/howlingmine.rb CHANGED
@@ -10,5 +10,5 @@ require "#{File.join(File.dirname(__FILE__),'howlingmine/client')}"
10
10
  require "#{File.join(File.dirname(__FILE__),'howlingmine/issue')}"
11
11
 
12
12
  module HowlingMine
13
- VERSION = '0.1.1'
13
+ VERSION = '0.1.2'
14
14
  end
data/test/issue_test.rb CHANGED
@@ -107,5 +107,20 @@ class TestIssue < Test::Unit::TestCase
107
107
  assert HowlingMine::Issue.all.size == 2
108
108
  end
109
109
  end
110
+
111
+ def test_custom_fields
112
+ issue = HowlingMine::Issue.new
113
+ issue.subject = 'issue number 1'
114
+ issue.description = 'description'
115
+ issue.custom_fields[:foofield1] = 'value1'
116
+ assert issue.save
117
+
118
+ issue = HowlingMine::Issue.get 1
119
+ assert issue.custom_fields.size == 1
120
+ assert issue.foofield1 == 'value1'
121
+ assert_raises NoMethodError do
122
+ assert issue.unexistant_method98847
123
+ end
124
+ end
110
125
 
111
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howlingmine-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Rubio
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-15 00:00:00 +01:00
12
+ date: 2009-12-16 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency