bitbuckit 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 273c2eee8296bb89314d1f6a3ae6a8bc38da04b6d2a9b437d0345fe9a602f8d7
4
- data.tar.gz: 335ddce29746496b1af17a48efde32d6fc6e1d550d2a0aef3d5e4b43b29c4539
3
+ metadata.gz: 25458d7e5d493725228b00afa9581b66fdb7f7fbddddbccfda80166e959504c3
4
+ data.tar.gz: db09f381eba03a2d4081e6bd4ae55f97d07832cce0380f807c9028254a9b5346
5
5
  SHA512:
6
- metadata.gz: '0970c8ecb6f21c0280097399235d0296efdec474d6509be710e4531a6e06df90e1b1ea80f966faec22aed0c4b64f7fb7bb2e75fa05c686fe8c5cef62349603e2'
7
- data.tar.gz: aa2309dd8ff068280533b2c7f50bc8a8e44d15ed36a3bcab4dc081a2013c8fef4ba2a8bab56ece05a96b974b31315b5fd041a742ad78e20ac4bad9e900109d90
6
+ metadata.gz: c9ae9a0efebfb4ad770df4273b379014c3621f38d073b79d2834ae0dc3ec3c168bbe673b1f001711bf6f143617736c1c3ef9699ce3e82b055fc1985af1e9bc24
7
+ data.tar.gz: 173629274ab52f763b90c12cbde27c73d7fd5c9d994c98138d8939f8954874c448e1b187bd813cee5c33c4d55d997314daf39d96c7077e194d0a661a311db0d0
data/.gitignore CHANGED
@@ -1,13 +1,43 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ Gemfile.lock
5
+ *.bundle
6
+ *.so
7
+ *.o
8
+ *.a
9
+ mkmf.log
10
+ app.rb
11
+ log/
12
+ *.swp
13
+
14
+ features
15
+ .envrc
16
+ .byebug_history
17
+ .ruby-version
18
+
19
+ ## from github ignore.
20
+
21
+ /.config
4
22
  /coverage/
5
- /doc/
23
+ /InstalledFiles
6
24
  /pkg/
7
- /spec/reports/
8
25
  /tmp/
26
+ /spec/reports/
27
+
28
+ ## Documentation cache and generated files:
29
+ /.yardoc/
30
+ /_yardoc/
31
+ /doc/
32
+ /rdoc/
33
+
34
+ ## Environment normalisation:
35
+ /.bundle/
36
+ /lib/bundler/man/
37
+ /vendor/
38
+ *.iml
9
39
 
10
40
  # rspec failure tracking
11
41
  .rspec_status
12
- .DS_Store
13
- *.gem
42
+
43
+ .DS_Store
@@ -15,7 +15,7 @@ module Bitbuckit
15
15
 
16
16
  def initialize(options = {})
17
17
  @access_token = options[:access_token]
18
- @refresh_tokeb = options[:refresh_token]
18
+ @refresh_token = options[:refresh_token]
19
19
  end
20
20
  end
21
21
  end
@@ -2,7 +2,7 @@ module Bitbuckit
2
2
  class Client
3
3
  module Commits
4
4
  def commits(user = nil, repo = nil, options = {})
5
- get "repositories/#{user}/#{repo}/commits/", options
5
+ paginate "repositories/#{user}/#{repo}/commits/", options
6
6
  end
7
7
  end
8
8
  end
@@ -2,11 +2,15 @@ module Bitbuckit
2
2
  class Client
3
3
  module Teams
4
4
  def teams(role = "member", options = {})
5
- paginate("teams", role: role)
5
+ paginate("teams", role: role, auto_paginate: true)
6
+ end
7
+
8
+ def team(username, options = {})
9
+ get "teams/#{username}", options
6
10
  end
7
11
 
8
12
  def team_repositories(team, options = {})
9
- paginate("repositories/#{team}")
13
+ paginate("repositories/#{team}", auto_paginate: true)
10
14
  end
11
15
  end
12
16
  end
@@ -6,7 +6,7 @@ module Bitbuckit
6
6
  include Bitbuckit::Authentication
7
7
 
8
8
  def get(url, options = {})
9
- request(:get, url, options).values
9
+ request(:get, url, options)
10
10
  end
11
11
 
12
12
  def post(url, options = {})
@@ -20,12 +20,14 @@ module Bitbuckit
20
20
  def paginate(url, options = {}, &block)
21
21
  data = request(:get, url, options.dup)
22
22
 
23
- while @last_response.data.next
24
- request(:get, @last_response.data.next, options.dup)
25
- if block_given?
26
- yield(data.values, @last_response.data.values)
27
- else
28
- data.values.concat(@last_response.data.values)
23
+ if options[:auto_paginate]
24
+ while @last_response.data.next
25
+ request(:get, @last_response.data.next, options.dup)
26
+ if block_given?
27
+ yield(data.values, @last_response.data.values)
28
+ else
29
+ data.values.concat(@last_response.data.values)
30
+ end
29
31
  end
30
32
  end
31
33
 
@@ -63,6 +65,8 @@ module Bitbuckit
63
65
  opts = { query: data }
64
66
 
65
67
  @last_response = response = agent.call(method, Addressable::URI.parse(path.to_s).normalize.to_s, data, opts)
68
+
69
+ puts response.inspect
66
70
  response.data
67
71
  end
68
72
  end
@@ -1,3 +1,3 @@
1
1
  module Bitbuckit
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitbuckit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Alves
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-31 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -85,7 +85,6 @@ files:
85
85
  - ".travis.yml"
86
86
  - CODE_OF_CONDUCT.md
87
87
  - Gemfile
88
- - Gemfile.lock
89
88
  - LICENSE.txt
90
89
  - README.md
91
90
  - Rakefile
@@ -1,45 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bitbuckit (0.1.0)
5
- sawyer (~> 0.8.0, >= 0.5.3)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.5.2)
11
- public_suffix (>= 2.0.2, < 4.0)
12
- diff-lcs (1.3)
13
- faraday (0.15.4)
14
- multipart-post (>= 1.2, < 3)
15
- multipart-post (2.0.0)
16
- public_suffix (3.0.3)
17
- rake (10.5.0)
18
- rspec (3.8.0)
19
- rspec-core (~> 3.8.0)
20
- rspec-expectations (~> 3.8.0)
21
- rspec-mocks (~> 3.8.0)
22
- rspec-core (3.8.0)
23
- rspec-support (~> 3.8.0)
24
- rspec-expectations (3.8.2)
25
- diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.8.0)
27
- rspec-mocks (3.8.0)
28
- diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.8.0)
30
- rspec-support (3.8.0)
31
- sawyer (0.8.1)
32
- addressable (>= 2.3.5, < 2.6)
33
- faraday (~> 0.8, < 1.0)
34
-
35
- PLATFORMS
36
- ruby
37
-
38
- DEPENDENCIES
39
- bitbuckit!
40
- bundler (~> 1.16)
41
- rake (~> 10.0)
42
- rspec (~> 3.0)
43
-
44
- BUNDLED WITH
45
- 1.16.2