class TFSGraph::BranchStore

Constants

LIMIT

Public Class Methods

new(project) click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 10
def initialize(project)
  @project = project
end

Public Instance Methods

cache(attrs) click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 22
def cache(attrs)
  branch = RepositoryRegistry.branch_repository.build attrs

  # add_branch action runs save! on branch
  @project.add_branch(branch)

  branch
end
fetch_since_date(date) click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 18
def fetch_since_date(date)
  normalize root_query.where("DateCreated gt DateTime'#{date}'").run
end
fetch_since_last_update() click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 14
def fetch_since_last_update
  fetch_since_date(@project.last_updated.iso8601)
end

Private Instance Methods

normalize(branches) click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 36
def normalize(branches)
  BranchNormalizer.normalize_many branches
end
root_query() click to toggle source
# File lib/tfs_graph/branch/branch_store.rb, line 32
def root_query
  tfs.projects(@project.name).branches.order_by('DateCreated desc').limit(LIMIT)
end