jfgomez86-track-r 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/track-r/story.rb +22 -0
  3. data/track-r.gemspec +2 -2
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
data/lib/track-r/story.rb CHANGED
@@ -39,6 +39,20 @@ class Story
39
39
  @labels = @story.at('labels').inner_html unless @story.at('labels').nil?
40
40
  end
41
41
 
42
+ def update(attrs = {})
43
+ unless attrs.empty?
44
+ if validate_attributes(attrs)
45
+ attrs.each do |attribute, value|
46
+ virt_attr = "#{attribute}="
47
+ self.send(virt_attr, value)
48
+ end
49
+ return save
50
+ else
51
+ raise ArgumentError
52
+ end
53
+ end
54
+ end
55
+
42
56
  def save
43
57
  parameters = build_story_xml
44
58
  api_url = URI.parse("http://www.pivotaltracker.com/services/v2/projects/#{@project_id}/stories/#{@id}")
@@ -72,6 +86,14 @@ class Story
72
86
  story_xml << "</story>"
73
87
  end
74
88
 
89
+ def validate_attributes(attrs)
90
+ valid_attributes = attributes
91
+ attrs.each_key do |k|
92
+ return false unless valid_attributes.include? k
93
+ end
94
+ return true
95
+ end
96
+
75
97
  def attributes
76
98
  {
77
99
  "story_type" => @story_type,
data/track-r.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{track-r}
5
- s.version = "1.1.0"
5
+ s.version = "1.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jose Felix Gomez"]
9
- s.date = %q{2009-07-14}
9
+ s.date = %q{2009-07-23}
10
10
  s.description = %q{track-r is a library that provides wrapper classes and methods for accessing PivotalTracker's public API.}
11
11
  s.email = %q{jfgomez86@gmail.com}
12
12
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jfgomez86-track-r
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Felix Gomez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-14 00:00:00 -07:00
12
+ date: 2009-07-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15