Class: Iteration
- Inherits:
-
Object
- Object
- Iteration
- Defined in:
- lib/track-r/iteration.rb
Instance Attribute Summary collapse
-
#finish_date(format = "%m/%d/%Y") ⇒ Object
readonly
Returns the value of attribute finish_date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#start_date(format = "%m/%d/%Y") ⇒ Object
readonly
Returns the value of attribute start_date.
-
#stories ⇒ Object
readonly
Returns the value of attribute stories.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Iteration
constructor
A new instance of Iteration.
Constructor Details
#initialize(options = {}) ⇒ Iteration
Returns a new instance of Iteration.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/track-r/iteration.rb', line 15 def initialize(={}) @token = [:token] || Token.new if .include?(:project_id) && .include?(:iteration_id) @id = [:iteration_id] @project_id = [:project_id] @number = [:number] @type = assign_type([:type]) @limit = [:limit] @offset = [:offset] @api_url = build_api_url @iteration = Hpricot(open(@api_url, {"X-TrackerToken" => @token})) elsif .include?(:iteration) && .include?(:project_id) @project_id = [:project_id] @iteration = [:iteration] else raise ArgumentError, "Valid options are: :iteration (receives an Hpricot Object) + :project_id OR :project_id + :iteration_id" end build_iteration end |
Instance Attribute Details
#finish_date(format = "%m/%d/%Y") ⇒ Object (readonly)
Returns the value of attribute finish_date.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def finish_date @finish_date end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def id @id end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def limit @limit end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def number @number end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def offset @offset end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def project_id @project_id end |
#start_date(format = "%m/%d/%Y") ⇒ Object (readonly)
Returns the value of attribute start_date.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def start_date @start_date end |
#stories ⇒ Object (readonly)
Returns the value of attribute stories.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def stories @stories end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def token @token end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/track-r/iteration.rb', line 2 def type @type end |
Class Method Details
.find(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/track-r/iteration.rb', line 4 def self.find(={}) @token = [:token] || Token.new if .include?(:project_id) @project_id = [:project_id] api_url = "#{CONFIG[:api_location]}/projects/#{@project_id}/iterations/#{.include?(:type) ? [:type] : ""}" iterations = (Hpricot(open(api_url, {"X-TrackerToken" => @token.to_s}))/'iteration').map do |iteration| Iteration.new(:iteration => iteration, :project_id => @project_id) end end end |