pra 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 990d69dd58accffc7a9a697b26589334785b0eed
4
+ data.tar.gz: e075ae03f303e947c04b7275d22cb3b58a72e03f
5
+ SHA512:
6
+ metadata.gz: e6fc9ec8e865363b814e8e453a8918aeb1a483dae88ac5ad3fc37d64b5c410e7c7eb0cda259ef90f71e293eb518fd579f4a6f2369601f08c57b4f8e1f6ecdf33
7
+ data.tar.gz: f8b78ff247073c23f30e38df0a3601a6493a3c4490748572dc7d9eec0fefdee879fa9ec4293a0ac34094bddaa4b52435f10222064c4a6f900f673f84d0084c9c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ pra
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
data/ChangeLog.md ADDED
@@ -0,0 +1,22 @@
1
+ # ChangeLog
2
+
3
+ The following are lists of the notable changes included with each release.
4
+ This is inteded to help keep people informed about notable changes between
5
+ versions as well as provide a rough history.
6
+
7
+ #### Next Release
8
+
9
+ #### v0.1.1
10
+
11
+ * Fixed up the gemspec to include homepage on rubygems.org
12
+
13
+ #### v0.1.0
14
+
15
+ This is the first public release. It includes the following:
16
+
17
+ * Added ability to open selected pull request
18
+ * Made Pull Requests in the list selectable
19
+ * Listing of Pull Requests found to be open
20
+ * Support for pulling Pull Requests from GitHub
21
+ * Support for pulling Pull Requests from Stash
22
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in clipuller.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,47 @@
1
+ Copyright (c) 2013 Andrew De Ponte, ReachLocal, Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ Dependency License
25
+
26
+ rest-client
27
+
28
+ Released under the MIT License: www.opensource.org/licenses/mit-license.php
29
+
30
+ launchy
31
+
32
+ ISC LICENSE - http://opensource.org/licenses/isc-license.txt
33
+
34
+ Copyright (c) 2007-2013 Jeremy Hinegardner
35
+
36
+ Permission to use, copy, modify, and/or distribute this software for any
37
+ purpose with or without fee is hereby granted, provided that the above
38
+ copyright notice and this permission notice appear in all copies.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
41
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
42
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
43
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
44
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
45
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
46
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
47
+
data/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # pra - The Pull-Request Aggregator
2
+
3
+ `pra` is a command line tool designed to allow developers to see the
4
+ current state of open pull-requests across multiple services. Currently, it
5
+ supports the following services:
6
+
7
+ - [GitHub](http://github.com)
8
+ - [Stash](http://www.atlassian.com/software/stash)
9
+
10
+ ## Installation
11
+
12
+ You can easily install `pra` with the following command:
13
+
14
+ $ gem install pra
15
+
16
+ ## Configuration
17
+
18
+ `pra` requires one configuration, `~/.pra.json`, to exist in your home
19
+ directory. The following is an example config that can be used as a starter.
20
+ *Note:* You will need to replace **your.username**, **your.password**,
21
+ **your.stash.server**, and the **repositories** sections of each of the pull
22
+ sources.
23
+
24
+ {
25
+ "pull_sources": [
26
+ {
27
+ "type": "stash",
28
+ "config": {
29
+ "protocol": "https",
30
+ "host": "your.stash.server",
31
+ "username": "your.username",
32
+ "password": "your.password",
33
+ "repositories": [
34
+ { "project_slug": "CAP", "repository_slug": "capture_api" },
35
+ { "project_slug": "RELENG", "repository_slug": "ramboo" }
36
+ ]
37
+ }
38
+ },
39
+ {
40
+ "type": "github",
41
+ "config": {
42
+ "protocol": "https",
43
+ "host": "api.github.com",
44
+ "username": "your.username",
45
+ "password": "your.password",
46
+ "repositories": [
47
+ { "owner": "reachlocal", "repository": "snapdragon" },
48
+ { "owner": "brewster", "repository": "cequel" }
49
+ ]
50
+ }
51
+ }
52
+ ]
53
+ }
54
+
55
+ I suggest copying and pasting the above starter file into your `~/.pra.json`
56
+ file to get you started. Then simply replace the appropriate fields and the
57
+ **repositories** sections for all the pull sources with the repository
58
+ information for the repositories you want to watch for open pull requests.
59
+
60
+ ## Usage
61
+
62
+ Once you have configured `pra` as described above you can launch it by simply
63
+ running the following command:
64
+
65
+ pra
66
+
67
+ Once it launches, it will use the information provided in the `~/.pra.json`
68
+ configuration file to fetch all the open pull requests and display them. Once,
69
+ the pull requests are displayed you can perorm any of the following actions.
70
+
71
+ ### Move Selection Up
72
+
73
+ To move the selection up simply press either the `k` or the `up arrow` key.
74
+
75
+ ### Move Selection Down
76
+
77
+ To move the selection down simply press either the `j` or `down arrow` key.
78
+
79
+ ### Open Selected Pull Request
80
+
81
+ If you would like to open the currently selected pull request in your default
82
+ browser you can press either the `o` or `enter` key.
83
+
84
+ ### Quit
85
+
86
+ If you decide you have had enough and want to exit `pra` press the `q` key.
87
+
88
+ ## Contributing
89
+
90
+ If you would like to contribute to the `pra` project. You can do so in the
91
+ following areas:
92
+
93
+ ### Bug Reporting
94
+
95
+ As with all software I am sure `pra` will have some bugs. I would very much
96
+ appreciate any contributions of bug reports. These can be reported on the
97
+ [issues page](http://github.com/reachlocal/pra/issues) of the project.
98
+
99
+ ### Feature Requests
100
+
101
+ The current state of `pra` is just the MVP (minimum viable product). This
102
+ means there is always room for growth. If you would like to contribute your
103
+ thoughts on features that you would like `pra` to have you can submit them on
104
+ the [issues page](http://github.com/reachlocal/pra/issues) of the project.
105
+
106
+ ### Improve Documentation
107
+
108
+ If you would like to contribute documentation improvements you should follow
109
+ the directions below.
110
+
111
+ 1. Fork it
112
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
113
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
114
+ 4. Push to the branch (`git push origin my-new-feature`)
115
+ 5. Create new Pull Request
116
+
117
+ ### Writing Code
118
+
119
+ If you want to contribute by writing code for `pra` you need to know the
120
+ following:
121
+
122
+ ##### Overview
123
+
124
+ 1. Fork it
125
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
126
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
127
+ 4. Push to the branch (`git push origin my-new-feature`)
128
+ 5. Create new Pull Request
129
+
130
+ ##### RVM
131
+
132
+ We use [RVM](http://rvm.io/) with `pra` to encapsulate the dependency gems in our
133
+ development environments. Therefore, we have the `.ruby-version` and
134
+ `.ruby-gemset` files in the repository which define the current version of
135
+ ruby and the gemset that we are developing with.
136
+
137
+ You should have [RVM](http://rvm.io) installed of course and when you change
138
+ into the project root directory it should switch to the proper ruby version if
139
+ you have it intsalled via [RVM](http://rvm.io). It should also create and
140
+ switch to the proper gemset.
141
+
142
+ If the proper version of ruby is NOT installed via [RVM](http://rvm.io) you
143
+ should first install that version of ruby and then change out of the project
144
+ root directory, then change back into it and verify that you are in the
145
+ proper ruby version and gemset. This can be done with the following command.
146
+
147
+ rvm current
148
+
149
+ The above command should have output the following
150
+
151
+ ruby-2.0.0-p247@pra
152
+
153
+ ##### Bundler
154
+
155
+ We use [Bundler](http://bundler.io/) to manage the development dependencies of
156
+ `pra`. Once you got setup with [RVM](http://rvm.io) as described above you
157
+ should be able to install all the development dependencies using the following
158
+ command:
159
+
160
+ bundle
161
+
162
+ ##### Test Driven Development
163
+
164
+ I eveloped `pra` using the TDD methodology with
165
+ [RSpec](http://www.relishapp.com/rspec) as the testing tool of choice.
166
+ Therefore, if you are going to contribute code to `pra` please TDD your code
167
+ changes using [RSpec](http://www.relishapp.com/rspec). If you do not submit
168
+ your changes with test coverage your request will likely be denied requesting
169
+ you add appropriate test coverage.
170
+
171
+ ##### Run Development Version Manually
172
+
173
+ If you have setup [RVM](http://rvm.io) as described above and installed the
174
+ development dependencies using [Bundler](http://bundler.io/) as described
175
+ above you should be able to run the development version of `pra` by running
176
+ the following command:
177
+
178
+ ./bin/pra
179
+
180
+ *Note:* The above of course assumes that you have a `~/.pra.json` file
181
+ already configured.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/pra ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/../lib')
4
+
5
+ require 'rubygems'
6
+
7
+ require 'pra/app'
8
+
9
+ app = Pra::App.new
10
+ app.run
data/lib/pra/app.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'thread'
2
+
3
+ require 'pra/window_system_factory'
4
+ require 'pra/pull_request_service'
5
+
6
+ Thread.abort_on_exception=true
7
+
8
+ module Pra
9
+ class App
10
+ def run
11
+ @window_system = Pra::WindowSystemFactory.build('curses')
12
+ @window_system.setup
13
+
14
+ spawn_pull_request_fetcher
15
+
16
+ @window_system.run_loop
17
+ end
18
+
19
+ def spawn_pull_request_fetcher
20
+ Thread.new { pull_request_fetcher_thread }
21
+ end
22
+
23
+ def fetch_and_refresh_pull_requests
24
+ @window_system.fetching_pull_requests
25
+ pull_requests = Pra::PullRequestService.fetch_pull_requests
26
+ @window_system.refresh_pull_requests(pull_requests)
27
+ Kernel.sleep(5 * 60)
28
+ end
29
+
30
+ def pull_request_fetcher_thread
31
+ while( true ) do
32
+ fetch_and_refresh_pull_requests
33
+ end
34
+ end
35
+ end
36
+ end
data/lib/pra/config.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'json'
2
+
3
+ module Pra
4
+ class Config
5
+ def initialize(initial_config = {})
6
+ @initial_config = initial_config
7
+ end
8
+
9
+ def self.load_config
10
+ return self.new(self.parse_config_file)
11
+ end
12
+
13
+ def self.parse_config_file
14
+ self.json_parse(self.read_config_file)
15
+ end
16
+
17
+ def self.read_config_file
18
+ file = File.open(self.config_path, "r")
19
+ contents = file.read
20
+ file.close
21
+ return contents
22
+ end
23
+
24
+ def self.config_path
25
+ return File.join(self.users_home_directory, '.pra.json')
26
+ end
27
+
28
+ def self.users_home_directory
29
+ return ENV['HOME']
30
+ end
31
+
32
+ def self.json_parse(content)
33
+ return JSON.parse(content)
34
+ end
35
+
36
+ def pull_sources
37
+ @initial_config["pull_sources"]
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,124 @@
1
+ require 'pra/window_system'
2
+ require 'launchy'
3
+ require 'curses'
4
+ require 'thread'
5
+
6
+ module Pra
7
+ class CursesWindowSystem < Pra::WindowSystem
8
+ ENTER_KEY = 10
9
+
10
+ def initialize
11
+ @selected_pull_request_index = 0
12
+ @current_pull_requests = []
13
+ @previous_number_of_pull_requests = 0
14
+ @state_lock = Mutex.new
15
+ end
16
+
17
+ def setup
18
+ initialize_screen_settings
19
+ display_instructions
20
+ output_string(3, 0, "0 Pull Requests")
21
+ end
22
+
23
+ def fetching_pull_requests
24
+ output_string(3, 0, "Fetching pull requests...")
25
+ end
26
+
27
+ def refresh_pull_requests(pull_requests)
28
+ @previous_number_of_pull_requests = @current_pull_requests.length
29
+
30
+ @state_lock.synchronize {
31
+ @current_pull_requests = pull_requests.dup
32
+ }
33
+ draw_current_pull_requests
34
+ end
35
+
36
+ def run_loop
37
+ c = Curses.getch()
38
+ while (c != 'q') do
39
+ case c
40
+ when 'j', Curses::Key::DOWN
41
+ move_selection_down
42
+ draw_current_pull_requests
43
+ when 'k', Curses::Key::UP
44
+ move_selection_up
45
+ draw_current_pull_requests
46
+ when 'o', ENTER_KEY
47
+ @state_lock.synchronize {
48
+ Launchy.open(@current_pull_requests[@selected_pull_request_index].link)
49
+ }
50
+ end
51
+ c = Curses.getch()
52
+ end
53
+
54
+ Curses.close_screen
55
+ end
56
+
57
+ private
58
+
59
+ def initialize_screen_settings
60
+ Curses.noecho # do not show typed keys
61
+ Curses.init_screen
62
+ Curses.stdscr.keypad(true)
63
+ Curses.start_color
64
+ Curses.curs_set(0)
65
+ Curses.init_pair(1, Curses::COLOR_CYAN, Curses::COLOR_BLACK)
66
+ end
67
+
68
+ def output_string(row, col, str)
69
+ Curses.setpos(row, col)
70
+ Curses.clrtoeol
71
+ Curses.addstr(str)
72
+ Curses.refresh
73
+ end
74
+
75
+ def output_highlighted_string(row, col, str)
76
+ Curses.attron(Curses.color_pair(1)|Curses::A_NORMAL) {
77
+ output_string(row, col, str)
78
+ }
79
+ end
80
+
81
+ def display_instructions
82
+ output_string(0, 0, "Pra: Helping you own pull requests")
83
+ output_string(1, 0, "quit: q, up: k|#{"\u25B2".encode("UTF-8")}, down: j|#{"\u25BC".encode("UTF-8")}, open: o|#{"\u21A9".encode("UTF-8")}")
84
+ end
85
+
86
+ def move_selection_up
87
+ @state_lock.synchronize {
88
+ if @selected_pull_request_index > 0
89
+ @selected_pull_request_index -= 1
90
+ end
91
+ }
92
+ end
93
+
94
+ def move_selection_down
95
+ @state_lock.synchronize {
96
+ if @selected_pull_request_index < @current_pull_requests.length-1
97
+ @selected_pull_request_index += 1
98
+ end
99
+ }
100
+ end
101
+
102
+ def draw_current_pull_requests
103
+ @state_lock.synchronize {
104
+ output_string(3, 0, "#{@current_pull_requests.length} Pull Requests")
105
+ output_string(5, 0, "repository title from_reference to_reference author service")
106
+ output_string(6, 0, "--------------------------------------------------------------------------------------------------------------------------------")
107
+
108
+ (7...7+@previous_number_of_pull_requests).each do |i|
109
+ Curses.setpos(i,0)
110
+ Curses.clrtoeol
111
+ Curses.refresh
112
+ end
113
+
114
+ @current_pull_requests.each_with_index do |pull_request, index|
115
+ if index == @selected_pull_request_index
116
+ output_highlighted_string(7 + index, 0, "#{pull_request.repository.ljust(15)[0..14]}\t#{pull_request.title.ljust(20)[0..19]}\t#{pull_request.from_reference.ljust(20)[0..19]}\t#{pull_request.to_reference.ljust(20)[0..19]}\t#{pull_request.author.ljust(20)[0..19]}\t#{pull_request.service_id.ljust(10)[0..9]}")
117
+ else
118
+ output_string(7 + index, 0, "#{pull_request.repository.ljust(15)[0..14]}\t#{pull_request.title.ljust(20)[0..19]}\t#{pull_request.from_reference.ljust(20)[0..19]}\t#{pull_request.to_reference.ljust(20)[0..19]}\t#{pull_request.author.ljust(20)[0..19]}\t#{pull_request.service_id.ljust(10)[0..9]}")
119
+ end
120
+ end
121
+ }
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,36 @@
1
+ require 'pra/pull_source'
2
+ require 'pra/pull_request'
3
+ require 'rest_client'
4
+ require 'json'
5
+
6
+ module Pra
7
+ class GithubPullSource < Pra::PullSource
8
+ def pull_requests
9
+ requests = []
10
+ repositories.each do |repo_config|
11
+ requests.concat(get_repo_pull_requests(repo_config))
12
+ end
13
+ return requests
14
+ end
15
+
16
+ def repositories
17
+ @config["repositories"]
18
+ end
19
+
20
+ def get_repo_pull_requests(repository_config)
21
+ requests = []
22
+ JSON.parse(rest_api_pull_request_resource(repository_config).get).each do |request|
23
+ requests << Pra::PullRequest.new(title: request["title"], from_reference: request["head"]["label"], to_reference: request["base"]["label"], author: request["user"]["login"], link: request['html_url'], service_id: 'github', repository: repository_config["repository"])
24
+ end
25
+ return requests
26
+ end
27
+
28
+ def rest_api_pull_request_url(repository_config)
29
+ "#{@config['protocol']}://#{@config['host']}/repos/#{repository_config["owner"]}/#{repository_config["repository"]}/pulls"
30
+ end
31
+
32
+ def rest_api_pull_request_resource(repository_config)
33
+ RestClient::Resource.new(rest_api_pull_request_url(repository_config), user: @config['username'], password: @config['password'], content_type: :json, accept: :json)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ module Pra
2
+ class PullRequest
3
+ attr_accessor :title, :from_reference, :to_reference, :author, :link, :service_id, :repository
4
+
5
+ def initialize(attributes={})
6
+ @title = attributes[:title]
7
+ @from_reference = attributes[:from_reference]
8
+ @to_reference = attributes[:to_reference]
9
+ @author = attributes[:author]
10
+ @link = attributes[:link]
11
+ @service_id = attributes[:service_id]
12
+ @repository = attributes[:repository]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ require 'pra/config'
2
+ require 'pra/pull_source_factory'
3
+
4
+ module Pra
5
+ module PullRequestService
6
+ def self.fetch_pull_requests
7
+ pull_requests = []
8
+ pull_sources.each do |pull_source|
9
+ pull_requests.concat(pull_source.pull_requests)
10
+ end
11
+ return pull_requests
12
+ end
13
+
14
+ def self.pull_sources
15
+ config = Pra::Config.load_config
16
+ return map_config_to_pull_sources(config)
17
+ end
18
+
19
+ def self.map_config_to_pull_sources(config)
20
+ sources = []
21
+ config.pull_sources.each do |pull_source_config|
22
+ sources << Pra::PullSourceFactory.build_pull_source(pull_source_config)
23
+ end
24
+ return sources
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ module Pra
2
+ class PullSource
3
+ class NotImplemented < RuntimeError; end
4
+
5
+ def initialize(config = {})
6
+ @config = config
7
+ end
8
+
9
+ # This method is a pure virtual method and is intended to implemented by
10
+ # all inheriting classes. It is responsible for obtaining and returning
11
+ # the opened pull requests from the pull source. Note: These should be
12
+ # returned as an array of Pra::PullRequest instances.
13
+ def pull_requests
14
+ raise NotImplemented, "The 'pull_requests' method needs to be implemented by the inheriting class"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ require 'pra/stash_pull_source'
2
+ require 'pra/github_pull_source'
3
+
4
+ module Pra
5
+ module PullSourceFactory
6
+ def self.build_pull_source(pull_source_config)
7
+ klass = map_type_to_klass(pull_source_config["type"])
8
+ klass.new(pull_source_config["config"])
9
+ end
10
+
11
+ def self.map_type_to_klass(type)
12
+ case type
13
+ when 'stash'
14
+ return StashPullSource
15
+ when 'github'
16
+ return GithubPullSource
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,36 @@
1
+ require 'pra/pull_source'
2
+ require 'pra/pull_request'
3
+ require 'rest_client'
4
+ require 'json'
5
+
6
+ module Pra
7
+ class StashPullSource < Pra::PullSource
8
+ def pull_requests
9
+ requests = []
10
+ repositories.each do |repo_config|
11
+ requests.concat(get_repo_pull_requests(repo_config))
12
+ end
13
+ return requests
14
+ end
15
+
16
+ def repositories
17
+ @config["repositories"]
18
+ end
19
+
20
+ def get_repo_pull_requests(repository_config)
21
+ requests = []
22
+ JSON.parse(rest_api_pull_request_resource(repository_config).get)["values"].each do |request|
23
+ requests << Pra::PullRequest.new(title: request["title"], from_reference: request["fromRef"]["id"], to_reference: request["toRef"]["id"], author: request["author"]["user"]["name"], link: "#{@config['protocol']}://#{@config['host']}#{request['link']['url']}", service_id: 'stash', repository: repository_config["repository_slug"])
24
+ end
25
+ return requests
26
+ end
27
+
28
+ def rest_api_pull_request_url(repository_config)
29
+ "#{@config['protocol']}://#{@config['host']}/rest/api/1.0/projects/#{repository_config["project_slug"]}/repos/#{repository_config["repository_slug"]}/pull-requests"
30
+ end
31
+
32
+ def rest_api_pull_request_resource(repository_config)
33
+ RestClient::Resource.new(rest_api_pull_request_url(repository_config), user: @config['username'], password: @config['password'], content_type: :json, accept: :json)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Pra
2
+ VERSION = "0.1.1"
3
+ end