Class: TFSGraph::BranchStore

Inherits:
AbstractStore show all
Defined in:
lib/tfs_graph/branch/branch_store.rb

Constant Summary collapse

LIMIT =
1000

Constants included from StoreHelpers

StoreHelpers::UPDATED_KEY

Constants included from TFSClient

TFSClient::InvalidConfig, TFSClient::REQUIRED_KEYS

Instance Method Summary collapse

Methods inherited from AbstractStore

#cache_all, #fetch_all, #fetch_and_cache

Methods included from StoreHelpers

#flush_all, #last_updated_on, #mark_as_updated

Methods included from TFSHelpers

#base_username, #branch_base, #branch_path_to_name, #branch_project, #odata_path_to_server_path, #scrub_changeset, #server_path_to_odata_path

Methods included from TFSClient

#endpoint, #setup, #tfs, #tfs=

Constructor Details

#initialize(project) ⇒ BranchStore

Returns a new instance of BranchStore.



10
11
12
# File 'lib/tfs_graph/branch/branch_store.rb', line 10

def initialize(project)
  @project = project
end

Instance Method Details

#cache(attrs) ⇒ Object



22
23
24
25
26
27
28
29
# 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) ⇒ Object



18
19
20
# 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_updateObject



14
15
16
# File 'lib/tfs_graph/branch/branch_store.rb', line 14

def fetch_since_last_update
  fetch_since_date(@project.last_updated.iso8601)
end