youtrack 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20fcd027f9f2ccbe21f3c3899ece54d81ffd667f
4
+ data.tar.gz: 418054623251575f8917b2a3c65ee9ec0001f0da
5
+ SHA512:
6
+ metadata.gz: 04739f2ccd49272e0542e32c347e5958c5d9e50e79085867ed687d7e360f619626e21c3b187dbb1d1753f6dabea07bf59a186165e59d4db32da5e8d2db7e3d08
7
+ data.tar.gz: 6bdac860776d6d68ba44bddfe934122650b278d16217751b8acc120e4f2e69d2a19262df1d714a929a24c425e0a34099d4aa8a0c4077d27d02a2dbc5a6c471da
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ *.swp
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - ruby-head
6
+ - jruby-19mode
7
+ - jruby-head
8
+ script:
9
+ - bundle exec rspec
10
+ - bundle exec cucumber
11
+
12
+ branches:
13
+ only:
14
+ - master
15
+
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: ruby-head
19
+ - rvm: jruby-head
20
+
21
+ notifications:
22
+ email:
23
+ - jwaterfaucett@gmail.com
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in youtrack.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 John Faucett
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.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Youtrack
2
+
3
+ youTrack REST API Client
4
+
5
+ [![Build Status](https://travis-ci.org/jwaterfaucett/youtrack.png)](https://travis-ci.org/jwaterfaucett/youtrack)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'youtrack'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install youtrack
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+
25
+ client = Youtrack::Client.new do |c|
26
+ c.url = "https://example.com"
27
+ c.login = "root"
28
+ c.password = "root"
29
+ end
30
+
31
+ ```
32
+
33
+ ## Issues
34
+
35
+ Any issues or bugs should be well documented submit as many details as possible.
36
+ The best issues have the following characteristics:
37
+
38
+ 1. Detail description with a title that conveys the problem well.
39
+ 2. Gists and/or failing tests that show under what conditions the problem occurs.
40
+ 3. Environment information, platform, gem version, etc.
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Write your feature in Cucumber.
47
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 5. Make sure your feature and (optional) Rspec test are green.
49
+ 6. Rebase from master.
50
+ 7. Push to the branch (`git push origin my-new-feature`)
51
+ 8. Create new Pull Request.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "cucumber/rake/task"
3
+ require "rspec/core/rake_task"
4
+
5
+ Cucumber::Rake::Task.new(:cucumber) do |t|
6
+ t.cucumber_opts = %w{--format pretty}
7
+ end
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ task default: :spec
@@ -0,0 +1,12 @@
1
+ Feature: New Client Session
2
+
3
+ In order to start a new session with the youTrack Server
4
+ As a Client
5
+ I should be able to connect to the remote host
6
+
7
+ Scenario: starting a new session
8
+ Given I create a new Client
9
+ When I set the Client url to point to the Server
10
+ And I enter the correct login credentials
11
+ And I connect
12
+ Then I should be connected to the Server
@@ -0,0 +1,25 @@
1
+
2
+ Given /^I create a new Client$/ do
3
+ @client = Youtrack::Client.new
4
+ end
5
+
6
+ Given /^I enter the correct login credentials$/ do
7
+ step "I set the Client#login= to <#{YServer::Login}>"
8
+ step "I set the Client#password= to <#{YServer::Password}>"
9
+ end
10
+
11
+ Given /^I set the Client url to point to the Server$/ do
12
+ @client.url = YServer::URL
13
+ end
14
+
15
+ Given /^I connect$/ do
16
+ @client.login!
17
+ end
18
+
19
+ Given /^I set the Client#([a-zA-Z_=]+) to <([a-zA-Z0-9_-]+)>$/ do |method, value|
20
+ @client.__send__(method, value)
21
+ end
22
+
23
+ Then /^I should be connected to the Server$/ do
24
+ @client.response.parsed_response["login"].should eq("ok")
25
+ end
@@ -0,0 +1,10 @@
1
+ require "youtrack"
2
+ require "webmock/cucumber"
3
+
4
+ module YServer
5
+ URL = "https://youtrackserver.com"
6
+ Login = "root"
7
+ Password = "root"
8
+ end
9
+
10
+
@@ -0,0 +1,20 @@
1
+ include WebMock::API
2
+
3
+ def server_url_for(endpoint, options={})
4
+ base = "#{YServer::URL}/rest/#{endpoint}"
5
+ if options[:query]
6
+ base += "?#{options[:query]}"
7
+ end
8
+ end
9
+
10
+
11
+ # STUBS
12
+
13
+ # login
14
+ stub_request(:post, server_url_for("login", query: "login=#{YServer::Password}&password=#{YServer::Login}"))
15
+ .to_return(
16
+ body: "<login>ok</login>",
17
+ headers: {
18
+ "Server" => "Jetty(6.1.23)",
19
+ "Content-Type" => "application/xml;charset=UTF-8"
20
+ })
@@ -0,0 +1 @@
1
+ World(YServer)
data/lib/youtrack.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "httparty"
2
+
3
+ module Youtrack
4
+ autoload :Client, "youtrack/client"
5
+ autoload :VERSION, "youtrack/version"
6
+ end
@@ -0,0 +1,36 @@
1
+ module Youtrack
2
+ class Client
3
+ include HTTParty
4
+
5
+ # holds the youTrack Server url
6
+ # defaults to nil
7
+ attr_accessor :url
8
+
9
+ # stores the Server login credential
10
+ # defaults to nil
11
+ attr_accessor :login
12
+
13
+ # stores the Server password credential
14
+ # defaulst to nil
15
+ attr_accessor :password
16
+
17
+ # stores the response object
18
+ attr_accessor :response
19
+
20
+ def initialize(options={})
21
+ end
22
+
23
+ def server_endpoint
24
+ @server_endpoint ||= File.join(url, "rest")
25
+ end
26
+
27
+ def credentials_hash
28
+ { login: login, password: password }
29
+ end
30
+
31
+ def login!
32
+ @response = self.class.post(server_endpoint + "/login", { query: credentials_hash })
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Youtrack
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require "webmock/rspec"
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
data/youtrack.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'youtrack/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "youtrack"
8
+ spec.version = Youtrack::VERSION
9
+ spec.authors = ["John Faucett"]
10
+ spec.email = ["jwaterfaucett@gmail.com"]
11
+ spec.description = %q{JetBrains youTrack Rest API Client in Ruby}
12
+ spec.summary = %q{A Ruby REST API Client for JetBrains youTrack software}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ # HARD DEPENDENCY
22
+ spec.add_dependency "httparty", "~> 0.12.0"
23
+
24
+ # DEVELOPMENT
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "cucumber", "~> 1.3.10"
28
+ spec.add_development_dependency "rspec", "~> 2.14.1"
29
+ spec.add_development_dependency "webmock", "~> 1.17.1"
30
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: youtrack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Faucett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.10
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.10
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.17.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.17.1
97
+ description: JetBrains youTrack Rest API Client in Ruby
98
+ email:
99
+ - jwaterfaucett@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - features/client/new_client_session.feature
112
+ - features/step_definitions/client/client_steps.rb
113
+ - features/support/env.rb
114
+ - features/support/webmock.rb
115
+ - features/support/world.rb
116
+ - lib/youtrack.rb
117
+ - lib/youtrack/client.rb
118
+ - lib/youtrack/version.rb
119
+ - spec/spec_helper.rb
120
+ - youtrack.gemspec
121
+ homepage: ''
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.0.3
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: A Ruby REST API Client for JetBrains youTrack software
145
+ test_files:
146
+ - features/client/new_client_session.feature
147
+ - features/step_definitions/client/client_steps.rb
148
+ - features/support/env.rb
149
+ - features/support/webmock.rb
150
+ - features/support/world.rb
151
+ - spec/spec_helper.rb