stash-client 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22a995f8ecb313040733cccd8002a39c6c02521f
4
- data.tar.gz: 47413a94656bc880660d765518de4cd9c7805186
3
+ metadata.gz: 366ade5c848ed2bf054a811a897c6507f37bc9c0
4
+ data.tar.gz: 4bc2f3fcb7dfc7bcefd6868a775d1148f7ba6d79
5
5
  SHA512:
6
- metadata.gz: 155333c9fafbcd0c0f8ea2658e26ad5d16c9023a0e35030b9b6fc690599f9df8e05f5339bdab82caa19b02b17728ba5fafed55839d0deaa1437f370d7cdc8c50
7
- data.tar.gz: a10c5e21bad2874d8e9af866f77a7788b8f2bbb15ec694876179cf1e342b89839aa366f8acb9903b9048c6e990471abf15d774ed65fa31db2867387210685a5b
6
+ metadata.gz: 0120334e28567dae31f9670b7100d945e70121224ce69b6a1022bd2a1f56ff7cc4eb169e0492ad8c07e53a3dcd98a3f119921509b98f7fa361d5b8ec37454daa
7
+ data.tar.gz: b5447d17c342f5202da2b504ee47a1982fabd59916c05f9a504f1f19a36b0484424da4b128de008f5bbb6e3d772358ed1b3d4e80aa4b79a1496fc6928cd9b7cb
data/.travis.yml CHANGED
@@ -2,4 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - ruby-head
5
+ - ruby-head
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Jari Bakken
1
+ Copyright (c) 2013-2014 Jari Bakken
2
2
 
3
3
  MIT License
4
4
 
data/lib/stash/client.rb CHANGED
@@ -57,7 +57,7 @@ module Stash
57
57
  # default limit to 100 commits
58
58
  query_values['limit'] = 100
59
59
  end
60
-
60
+
61
61
  uri.query_values = query_values
62
62
 
63
63
  if query_values['limit'] && query_values['limit'] < 100
@@ -67,6 +67,23 @@ module Stash
67
67
  end
68
68
  end
69
69
 
70
+ def changes_for(repo, sha, opts = {})
71
+ path = remove_leading_slash repo.fetch('link').fetch('url').sub('browse', 'changes')
72
+ uri = @url.join(path)
73
+
74
+ query_values = { 'until' => sha }
75
+ query_values['since'] = opts[:parent] if opts[:parent]
76
+ query_values['limit'] = opts[:limit] if opts[:limit]
77
+
78
+ uri.query_values = query_values
79
+
80
+ if query_values['limit']
81
+ fetch(uri).fetch('values')
82
+ else
83
+ fetch_all(uri)
84
+ end
85
+ end
86
+
70
87
  private
71
88
 
72
89
  def fetch_all(uri)
@@ -1,5 +1,5 @@
1
1
  module Stash
2
2
  class Client
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -30,6 +30,13 @@ module Stash
30
30
  client.commits_for({'link' => {'url' => '/repos/foo/browse'}}).should == [{'key' => 'value'}]
31
31
  end
32
32
 
33
+ it 'feches changes' do
34
+ stub_request(:get, 'foo:bar@git.example.com/rest/api/1.0/projects/foo/repos/bar/changes?limit=100&until=deadbeef').to_return(body: response_with_value('key' => 'value'))
35
+
36
+ repo = {'link' => {'url' => '/projects/foo/repos/bar/browse'}}
37
+ client.changes_for(repo, 'deadbeef', limit: 100).should == [{'key' => 'value'}]
38
+ end
39
+
33
40
  it 'respects since/until when fetching commits' do
34
41
  stub_request(:get, 'foo:bar@git.example.com/rest/api/1.0/repos/foo/commits?since=cafebabe&until=deadbeef').to_return(body: response_with_value('key' => 'value'))
35
42
  client.commits_for({'link' => {'url' => '/repos/foo/browse'}}, since: 'cafebabe', until: 'deadbeef').should == [{'key' => 'value'}]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-09 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,11 +133,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.1.10
136
+ rubygems_version: 2.0.14
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Atlassian Stash Client
140
140
  test_files:
141
141
  - spec/spec_helper.rb
142
142
  - spec/stash/client_spec.rb
143
- has_rdoc: