version-one 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -430,7 +430,7 @@ end
430
430
 
431
431
  # Remove the moment from the href if any
432
432
  def normalized_href(s)
433
- if s =~ /(\/.+\/[A-Z][a-zA-Z]+\/\d{4,6})(\/\d{4,6})?$/
433
+ if s =~ /(\/.+\/[A-Z][a-zA-Z]+\/\d+)(\/\d+)?$/
434
434
  $1
435
435
  else
436
436
  raise ArgumentError, "Invalid href '#{s}'"
@@ -439,7 +439,7 @@ end
439
439
 
440
440
  # Remove the moment from the ID if any
441
441
  def normalized_id(s)
442
- if s =~ /^([A-Z][a-zA-Z]+:\d{4,6})(:\d{4,6})?$/
442
+ if s =~ /^([A-Z][a-zA-Z]+:\d+)(:\d+)?$/
443
443
  $1
444
444
  else
445
445
  raise ArgumentError, "Invalid ID '#{s}'"
@@ -458,4 +458,5 @@ end
458
458
  class Conversation < Asset; end
459
459
  class Task < Asset; end
460
460
  class Test < Asset; end
461
+ class Request < Asset; end
461
462
  end
@@ -50,6 +50,10 @@ module VersionOne
50
50
  Query.new 'Issue'
51
51
  end
52
52
 
53
+ def self.requests
54
+ Query.new 'Request'
55
+ end
56
+
53
57
  def find_by_url(url)
54
58
  xml = nil
55
59
  #xml = cache_store.read(@cache[:key]) if can_cache?
@@ -124,12 +128,22 @@ module VersionOne
124
128
  end
125
129
  end
126
130
 
127
- def for_project_and_children(project_id)
128
- where("Scope.ParentMeAndUp='Scope:#{project_id}'")
131
+ def for_project_and_children(project)
132
+ project_id = case project
133
+ when Asset
134
+ project.id
135
+ when Integer
136
+ "Scope:#{project}"
137
+ when /^(Scope:)?(\d+)(:\d+)?$/
138
+ ($1 || 'Scope:') + $2
139
+ else
140
+ raise ArgumentError, 'Invalid project argument'
141
+ end
142
+ where('Scope.ParentMeAndUp' => project_id)
129
143
  end
130
144
 
131
145
  def active
132
- where("IsInactive='false'")
146
+ where('IsInactive' => 'false')
133
147
  end
134
148
 
135
149
  def order(attrib, dir=:asc)
@@ -1,3 +1,3 @@
1
1
  module VersionOne
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version-one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-24 00:00:00.000000000 Z
12
+ date: 2014-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby