lib/tracker_api/resources/project.rb in tracker_api-0.2.12 vs lib/tracker_api/resources/project.rb in tracker_api-1.0.0
- old
+ new
@@ -1,9 +1,9 @@
module TrackerApi
module Resources
class Project
- include Shared::HasId
+ include Shared::Base
attribute :client
attribute :account, Account
attribute :account_id, Integer
@@ -15,18 +15,18 @@
attribute :description, String
attribute :enable_following, Boolean
attribute :enable_incoming_emails, Boolean
attribute :enable_planned_mode, Boolean
attribute :enable_tasks, Boolean
- attribute :epic_ids, Array[Integer]
- attribute :epics, Array[Epic]
+ attribute :epic_ids, Shared::Collection[Integer]
+ attribute :epics, Shared::Collection[Epic]
attribute :has_google_domain, Boolean
attribute :initial_velocity, Integer
attribute :iteration_length, Integer
attribute :kind, String
- attribute :label_ids, Array[Integer]
- attribute :labels, Array[Label]
+ attribute :label_ids, Shared::Collection[Integer]
+ attribute :labels, Shared::Collection[Label]
attribute :name, String
attribute :number_of_done_iterations_to_show, Integer
attribute :point_scale, String
attribute :point_scale_is_custom, Boolean
attribute :profile_content, String
@@ -52,11 +52,11 @@
# Provides a list of all the labels on the project.
#
# @param [Hash] params
# @return [Array[Label]] labels of this project
def labels(params = {})
- if @labels && @labels.any?
+ if @labels && @labels.present?
@labels
else
@labels = Endpoints::Labels.new(client).get(id, params)
end
end
@@ -64,13 +64,14 @@
# Provides a list of all the epics in the project.
#
# @param [Hash] params
# @return [Array[Epic]] epics associated with this project
def epics(params={})
- raise ArgumentError, 'Expected @epics to be an Array' unless @epics.is_a? Array
- return @epics unless @epics.empty?
-
- @epics = Endpoints::Epics.new(client).get(id, params)
+ if @epics && @epics.present?
+ @epics
+ else
+ @epics = Endpoints::Epics.new(client).get(id, params)
+ end
end
# Provides a list of all the iterations in the project.
#
# @param [Hash] params