jira-ruby-1.4.3/ 0000755 0000041 0000041 00000000000 13167661427 013470 5 ustar www-data www-data jira-ruby-1.4.3/Rakefile 0000644 0000041 0000041 00000001360 13167661427 015135 0 ustar www-data www-data require 'bundler/gem_tasks' require 'rubygems' require 'rspec/core/rake_task' require 'rdoc/task' Dir.glob('lib/tasks/*.rake').each { |r| import r } task :default => [:test] task :test => [:prepare, :spec] desc 'Prepare and run rspec tests' task :prepare do rsa_key = File.expand_path('rsakey.pem') unless File.exists?(rsa_key) raise 'rsakey.pem does not exist, tests will fail. Run `rake jira:generate_public_cert` first' end end desc 'Run RSpec tests' #RSpec::Core::RakeTask.new(:spec) RSpec::Core::RakeTask.new(:spec) do |task| task.rspec_opts = ['--color', '--format', 'doc'] end Rake::RDocTask.new(:doc) do |rd| rd.main = 'README.rdoc' rd.rdoc_dir = 'doc' rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb') end jira-ruby-1.4.3/Gemfile 0000644 0000041 0000041 00000000244 13167661427 014763 0 ustar www-data www-data source "http://rubygems.org" group :development do gem 'wdm', '>= 0.1.0' if Gem.win_platform? end # Specify your gem's dependencies in jira_api.gemspec gemspec jira-ruby-1.4.3/example.rb 0000644 0000041 0000041 00000015171 13167661427 015455 0 ustar www-data www-data require 'pp' require './lib/jira-ruby' CONSUMER_KEY = 'test' SITE = 'https://test.jira.com' options = { :private_key_file => "rsakey.pem", :context_path => '', :consumer_key => CONSUMER_KEY, :site => SITE } client = JIRA::Client.new(options) if ARGV.length == 0 # If not passed any command line arguments, open a browser and prompt the # user for the OAuth verifier. request_token = client.request_token puts "Opening #{request_token.authorize_url}" system "open #{request_token.authorize_url}" puts "Enter the oauth_verifier: " oauth_verifier = gets.strip access_token = client.init_access_token(:oauth_verifier => oauth_verifier) puts "Access token: #{access_token.token} secret: #{access_token.secret}" elsif ARGV.length == 2 # Otherwise assume the arguments are a previous access token and secret. access_token = client.set_access_token(ARGV[0], ARGV[1]) else # Script must be passed 0 or 2 arguments raise "Usage: #{$0} [ token secret ]" end # Show all projects projects = client.Project.all projects.each do |project| puts "Project -> key: #{project.key}, name: #{project.name}" end issue = client.Issue.find('SAMPLEPROJECT-1') pp issue # # Handling fields by name, rather than by id # # ------------------------------------------ # Cache the Field list from the server client.Field.map_fields # This allows use of friendlier names for custom fields # Say that 'Special Field' is customfield_12345 # It becomes mapped to Special_Field which is usable as a method call # # Say that there is a second 'Special Field' is customfield_54321 # Names are deduplicated so the second 'Special Field' becomes Special_Field_54321 # # Names are massaged to get rid of special characters, and spaces # So 'Special & @ Field' becomes Special_____Field - not perfect, but usable old_way = issue.customfield_12345 new_way = issue.Special_Field (old_way == new_way) && puts 'much easier' # # You can also specify fields to be returned in the response # This is especially useful in regards to shortening JQL query response times if performance becomes an issue client.Issue.jql(a_normal_jql_search, fields:[:description, :summary, :Special_field, :created]) # Or you could always do it the old way - if you can remember the custom field numbers... client.Issue.jql(a_normal_jql_search, fields:[:description, :summary, :customfield_1234, :created]) # You can also specify the maximum number of results to be returned in the response, i.e. 500 client.Issue.jql(a_normal_jql_search, max_results: 500) # # Find a specific project by key # # ------------------------------ # project = client.Project.find('SAMPLEPROJECT') # pp project # project.issues.each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # List all Issues # # --------------- # client.Issue.all.each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # List issues by JQL query # # ------------------------ # client.Issue.jql('PROJECT = "SAMPLEPROJECT"', [comments, summary]).each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # Delete an issue # # --------------- # issue = client.Issue.find('SAMPLEPROJECT-2') # if issue.delete # puts "Delete of issue SAMPLEPROJECT-2 sucessful" # else # puts "Delete of issue SAMPLEPROJECT-2 failed" # end # # # Create an issue # # --------------- # issue = client.Issue.build # issue.save({"fields"=>{"summary"=>"blarg from in example.rb","project"=>{"id"=>"10001"},"issuetype"=>{"id"=>"3"}}}) # issue.fetch # pp issue # # # Update an issue # # --------------- # issue = client.Issue.find("10002") # issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}}) # pp issue # # # Transition an issue # # ------------------- # issue_transition = issue.transitions.build # issue_transition.save!('transition' => {'id' => transition_id}) # # # Change assignee # # ------------------- # issue.save({'fields' => {'assignee' => {'name' => person_name}}}) # # # Find a user # # ----------- # user = client.User.find('admin') # pp user # # # Get all issue watchers # # ---------------------- # issue = client.Issue.find("10002") # watchers = issue.watchers.all # watchers = client.Watcher.all(:issue => issue) # # Get all issue types # # ------------------- # issuetypes = client.Issuetype.all # pp issuetypes # # # Get a single issue type # # ----------------------- # issuetype = client.Issuetype.find('5') # pp issuetype # # # Get all comments for an issue # # ----------------------------- # issue.comments.each do |comment| # pp comment # end # # # Build and Save a comment # # ------------------------ # comment = issue.comments.build # comment.save!(:body => "New comment from example script") # # # Delete a comment from the collection # # ------------------------------------ # issue.comments.last.delete # # # Update an existing comment # # -------------------------- # issue.comments.first.save({"body" => "an updated comment frome example.rb"}) # List all available link types # ------------------------------ pp client.Issuelinktype.all # List issue's links # ------------------------- issue = client.Issue.find("10002") pp issue.issuelinks # Link two issues (on the same Jira instance) # -------------------------------------------- link = client.Issuelink.build link.save( { :type => {:name => 'Relates'}, :inwardIssue => {:key => 'AL-1'}, :outwardIssue => {:key => 'AL-2'} } ) # List issue's remote links # ------------------------- pp issue.remotelink.all # Link two remote issues (on the different Jira instance) # In order to add remote links, you have to add # Application Links between two Jira instances first. # More information: # https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links # http://stackoverflow.com/questions/29850252/jira-api-issuelink-connect-two-different-instances # ------------------------------------------------------- client_1 = JIRA::Client.new(options) client_2 = JIRA::Client.new(options) # you have to search for your app id here, instead of getting the first client_2_app_link = client_2.ApplicationLink.manifest issue_1 = client_1.Issue.find('BB-2') issue_2 = client_2.Issue.find('AA-1') remote_link = issue_2.remotelink.build remote_link.save( { :globalId => "appId=#{client_2_app_link.id}&issueId=#{issue_1.id}", :application => { :type => 'com.atlassian.jira', :name => client_2_app_link['name'] }, :relationship => 'relates to', :object => { :url => client_1.options[:site] + client_1.options[:context_path] + "/browse/#{issue_1.key}", :title => issue_1.key, } } ) jira-ruby-1.4.3/http-basic-example.rb 0000644 0000041 0000041 00000005456 13167661427 017516 0 ustar www-data www-data require 'rubygems' require 'pp' require 'jira-ruby' if ARGV.length == 0 # If not passed any command line arguments, prompt the # user for the username and password. puts "Enter the username: " username = gets.strip puts "Enter the password: " password = gets.strip elsif ARGV.length == 2 username, password = ARGV[0], ARGV[1] else # Script must be passed 0 or 2 arguments raise "Usage: #{$0} [ username password ]" end options = { :username => username, :password => password, :site => 'http://localhost:8080/', :context_path => '', :auth_type => :basic, :use_ssl => false } client = JIRA::Client.new(options) # Show all projects projects = client.Project.all projects.each do |project| puts "Project -> key: #{project.key}, name: #{project.name}" end # # Find a specific project by key # # ------------------------------ # project = client.Project.find('SAMPLEPROJECT') # pp project # project.issues.each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # List all Issues # # --------------- # client.Issue.all.each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # List issues by JQL query # # ------------------------ # client.Issue.jql('PROJECT = "SAMPLEPROJECT"', {fields: %w(summary status)}).each do |issue| # puts "#{issue.id} - #{issue.fields['summary']}" # end # # # Delete an issue # # --------------- # issue = client.Issue.find('SAMPLEPROJECT-2') # if issue.delete # puts "Delete of issue SAMPLEPROJECT-2 sucessful" # else # puts "Delete of issue SAMPLEPROJECT-2 failed" # end # # # Create an issue # # --------------- # issue = client.Issue.build # issue.save({"fields"=>{"summary"=>"blarg from in example.rb","project"=>{"id"=>"10001"},"issuetype"=>{"id"=>"3"}}}) # issue.fetch # pp issue # # # Update an issue # # --------------- # issue = client.Issue.find("10002") # issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}}) # pp issue # # # Find a user # # ----------- # user = client.User.find('admin') # pp user # # # Get all issue types # # ------------------- # issuetypes = client.Issuetype.all # pp issuetypes # # # Get a single issue type # # ----------------------- # issuetype = client.Issuetype.find('5') # pp issuetype # # # Get all comments for an issue # # ----------------------------- # issue.comments.each do |comment| # pp comment # end # # # Build and Save a comment # # ------------------------ # comment = issue.comments.build # comment.save!(:body => "New comment from example script") # # # Delete a comment from the collection # # ------------------------------------ # issue.comments.last.delete # # # Update an existing comment # # -------------------------- # issue.comments.first.save({"body" => "an updated comment frome example.rb"}) jira-ruby-1.4.3/.ruby-version 0000644 0000041 0000041 00000000006 13167661427 016131 0 ustar www-data www-data 2.3.3 jira-ruby-1.4.3/spec/ 0000755 0000041 0000041 00000000000 13167661427 014422 5 ustar www-data www-data jira-ruby-1.4.3/spec/spec_helper.rb 0000644 0000041 0000041 00000001137 13167661427 017242 0 ustar www-data www-data $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'bundler/setup' require 'webmock/rspec' Dir["./spec/support/**/*.rb"].each {|f| require f} require 'jira-ruby' RSpec.configure do |config| config.extend ClientsHelper end def get_mock_response(file, value_if_file_not_found = false) begin file.sub!('?', '_') # we have to replace this character on Windows machine File.read(File.join(File.dirname(__FILE__), 'mock_responses/', file)) rescue Errno::ENOENT => e raise e if value_if_file_not_found == false value_if_file_not_found end end jira-ruby-1.4.3/spec/integration/ 0000755 0000041 0000041 00000000000 13167661427 016745 5 ustar www-data www-data jira-ruby-1.4.3/spec/integration/attachment_spec.rb 0000644 0000041 0000041 00000001503 13167661427 022433 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Attachment do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:target) { JIRA::Resource::Attachment.new(client, :attrs => {'id' => '99999'}, :issue_id => '10002') } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/attachment/10000", 'size' => 15360, 'filename' => "ballmer.png" } end let(:belongs_to) { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '10002', 'fields' => { 'attachment' => {'attachments' => []} } }) } it_should_behave_like "a resource with a singular GET endpoint" it_should_behave_like "a resource with a DELETE endpoint" end end jira-ruby-1.4.3/spec/integration/transition_spec.rb 0000644 0000041 0000041 00000002372 13167661427 022502 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Transition do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { '10000' } let(:target) { JIRA::Resource::Transition.new(client, :attrs => {'id' => '99999'}, :issue_id => '10014') } let(:belongs_to) { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '10002', 'self' => "#{site_url}/jira/rest/api/2/issue/10002", 'fields' => { 'comment' => {'comments' => []} } }) } let(:expected_attributes) do { 'self' => "#{site_url}/jira/rest/api/2/issue/10002/transition/10000", 'id' => key } end let(:attributes_for_post) { { 'transition' => { 'id' => '42' } } } it_should_behave_like "a resource" describe "POST endpoint" do it "saves a new resource" do stub_request(:post, /#{described_class.collection_path(client, prefix)}$/) .with(:body => attributes_for_post.to_json) .to_return(:status => 200, :body => get_mock_from_path(:post)) subject = build_receiver.build expect(subject.save(attributes_for_post)).to be_truthy end end end end jira-ruby-1.4.3/spec/integration/priority_spec.rb 0000644 0000041 0000041 00000001124 13167661427 022163 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Priority do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "1" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/priority/1", 'id' => key, 'name' => 'Blocker' } end let(:expected_collection_length) { 5 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/watcher_spec.rb 0000644 0000041 0000041 00000003073 13167661427 021744 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Watcher do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:target) { JIRA::Resource::Watcher.new(client, :attrs => {'id' => '99999'}, :issue_id => '10002') } let(:belongs_to) { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '10002', 'fields' => { 'comment' => {'comments' => []} } }) } let(:expected_attributes) do { "self" => "http://localhost:2990/jira/rest/api/2/issue/10002/watchers", "isWatching": false, "watchCount": 1, "watchers": [ { "self": "http://www.example.com/jira/rest/api/2/user?username=admin", "name": "admin", "displayName": "admin", "active": false } ] } end describe "watchers" do it "should returns all the watchers" do stub_request(:get, site_url + "/jira/rest/api/2/issue/10002"). to_return(:status => 200, :body => get_mock_response('issue/10002.json')) stub_request(:get, site_url + "/jira/rest/api/2/issue/10002/watchers"). to_return(:status => 200, :body => get_mock_response('issue/10002/watchers.json')) issue = client.Issue.find("10002") watchers = client.Watcher.all(options = {:issue => issue}) expect(watchers.length).to eq(1) end end it_should_behave_like "a resource" end end jira-ruby-1.4.3/spec/integration/version_spec.rb 0000644 0000041 0000041 00000002134 13167661427 021771 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Version do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/version/10000", 'id' => key, 'description' => "Initial version" } end let(:attributes_for_post) { {"name" => "2.0", "project" => "SAMPLEPROJECT" } } let(:expected_attributes_from_post) { { "id" => "10001", "name" => "2.0" } } let(:attributes_for_put) { {"name" => "2.0.0" } } let(:expected_attributes_from_put) { { "id" => "10000", "name" => "2.0.0" } } it_should_behave_like "a resource" it_should_behave_like "a resource with a singular GET endpoint" it_should_behave_like "a resource with a DELETE endpoint" it_should_behave_like "a resource with a POST endpoint" it_should_behave_like "a resource with a PUT endpoint" it_should_behave_like "a resource with a PUT endpoint that rejects invalid fields" end end jira-ruby-1.4.3/spec/integration/webhook.rb 0000644 0000041 0000041 00000002005 13167661427 020725 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Webhook do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "2" } let(:expected_attributes) do {"name"=>"from API", "url"=>"http://localhost:3000/webhooks/1", "excludeBody"=>false, "filters"=>{"issue-related-events-section"=>""}, "events"=>[], "enabled"=>true, "self"=>"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser"=>"admin", "lastUpdatedDisplayName"=>"admin", "lastUpdated"=>1453306520188} end let(:expected_collection_length) { 1 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" it "returns a collection of components" do stub_request(:get, site_url + described_class.singular_path(client, key)). to_return(:status => 200, :body => get_mock_response('webhook/webhook.json')) end end end jira-ruby-1.4.3/spec/integration/issuetype_spec.rb 0000644 0000041 0000041 00000001126 13167661427 022336 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Issuetype do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "5" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/issuetype/5", 'id' => key, 'name' => 'Sub-task' } end let(:expected_collection_length) { 5 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/field_spec.rb 0000644 0000041 0000041 00000001441 13167661427 021367 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Field do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "1" } let(:expected_attributes) do { "id"=>key, "name"=>"Description", "custom"=>false, "orderable"=>true, "navigable"=>true, "searchable"=>true, "clauseNames"=>["description"], "schema"=> { "type"=>"string", "system"=>"description" } } end let(:expected_collection_length) { 2 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/user_spec.rb 0000644 0000041 0000041 00000001000 13167661427 021251 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::User do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "admin" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/user?username=admin", 'name' => key, 'emailAddress' => 'admin@example.com' } end it_should_behave_like "a resource" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/comment_spec.rb 0000644 0000041 0000041 00000002652 13167661427 021753 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Comment do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:target) { JIRA::Resource::Comment.new(client, :attrs => {'id' => '99999'}, :issue_id => '54321') } let(:expected_collection_length) { 2 } let(:belongs_to) { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '10002', 'fields' => { 'comment' => {'comments' => []} } }) } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10000", 'id' => key, 'body' => "This is a comment. Creative." } end let(:attributes_for_post) { { "body" => "new comment" } } let(:expected_attributes_from_post) { { "id" => "10001", "body" => "new comment"} } let(:attributes_for_put) { {"body" => "new body"} } let(:expected_attributes_from_put) { { "id" => "10000", "body" => "new body" } } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" it_should_behave_like "a resource with a DELETE endpoint" it_should_behave_like "a resource with a POST endpoint" it_should_behave_like "a resource with a PUT endpoint" end end jira-ruby-1.4.3/spec/integration/project_spec.rb 0000644 0000041 0000041 00000003174 13167661427 021757 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Project do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "SAMPLEPROJECT" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", 'key' => key, 'name' => "Sample Project for Developing RoR RESTful API" } end let(:expected_collection_length) { 1 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" describe "issues" do it "returns all the issues" do stub_request(:get, site_url + "/jira/rest/api/2/search?jql=project=\"SAMPLEPROJECT\""). to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.issues.json')) subject = client.Project.build('key' => key) issues = subject.issues expect(issues.length).to eq(11) issues.each do |issue| expect(issue.class).to eq(JIRA::Resource::Issue) expect(issue.expanded?).to be_falsey end end end it "returns a collection of components" do stub_request(:get, site_url + described_class.singular_path(client, key)). to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.json')) subject = client.Project.find(key) expect(subject.components.length).to eq(2) subject.components.each do |component| expect(component.class).to eq(JIRA::Resource::Component) end end end end jira-ruby-1.4.3/spec/integration/issue_spec.rb 0000644 0000041 0000041 00000006023 13167661427 021435 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Issue do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10002" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/issue/10002", 'key' => "SAMPLEPROJECT-1", 'expand' => "renderedFields,names,schema,transitions,editmeta,changelog" } end let(:attributes_for_post) { { 'foo' => 'bar' } } let(:expected_attributes_from_post) { { "id" => "10005", "key" => "SAMPLEPROJECT-4" } } let(:attributes_for_put) { { 'foo' => 'bar' } } let(:expected_attributes_from_put) { { 'foo' => 'bar' } } let(:expected_collection_length) { 11 } it_should_behave_like "a resource" it_should_behave_like "a resource with a singular GET endpoint" describe "GET all issues" do # JIRA::Resource::Issue.all uses the search endpoint let(:client) { client } let(:site_url) { site_url } let(:expected_attributes) { { "id"=>"10014", "self"=>"http://localhost:2990/jira/rest/api/2/issue/10014", "key"=>"SAMPLEPROJECT-13" } } before(:each) do stub_request(:get, site_url + "/jira/rest/api/2/search?expand=transitions.fields"). to_return(:status => 200, :body => get_mock_response('issue.json')) end it_should_behave_like "a resource with a collection GET endpoint" end it_should_behave_like "a resource with a DELETE endpoint" it_should_behave_like "a resource with a POST endpoint" it_should_behave_like "a resource with a PUT endpoint" it_should_behave_like "a resource with a PUT endpoint that rejects invalid fields" describe "errors" do before(:each) do stub_request(:get, site_url + "/jira/rest/api/2/issue/10002"). to_return(:status => 200, :body => get_mock_response('issue/10002.json')) stub_request(:put, site_url + "/jira/rest/api/2/issue/10002"). with(:body => '{"missing":"fields and update"}'). to_return(:status => 400, :body => get_mock_response('issue/10002.put.missing_field_update.json')) end it "fails to save when fields and update are missing" do subject = client.Issue.build('id' => '10002') subject.fetch expect(subject.save('missing' => 'fields and update')).to be_falsey end end describe "GET jql issues" do # JIRA::Resource::Issue.jql uses the search endpoint jql_query_string = "PROJECT = 'SAMPLEPROJECT'" let(:client) { client } let(:site_url) { site_url } let(:jql_query_string) { jql_query_string } let(:expected_attributes) { { "id"=>"10014", "self"=>"http://localhost:2990/jira/rest/api/2/issue/10014", "key"=>"SAMPLEPROJECT-13" } } it_should_behave_like "a resource with JQL inputs and a collection GET endpoint" end end end jira-ruby-1.4.3/spec/integration/resolution_spec.rb 0000644 0000041 0000041 00000001402 13167661427 022504 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Resolution do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "1" } let(:expected_attributes) do { 'self' => "http://www.example.com/jira/rest/api/2/resolution/1", 'id' => key, 'name' => 'Fixed', 'description' => 'A fix for this issue is checked into the tree and tested.', 'iconUrl' => 'http://www.example.com/jira/images/icons/status_resolved.gif' } end let(:expected_collection_length) { 2 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/issuelinktype_spec.rb 0000644 0000041 0000041 00000001241 13167661427 023212 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Issuelinktype do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:expected_attributes) do { 'id' => key, "self"=>"http://localhost:2990/jira/rest/api/2/issueLinkType/10000", "name"=>"Blocks", "inward"=>"is blocked by", "outward"=>"blocks" } end let(:expected_collection_length) { 3 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/rapidview_spec.rb 0000644 0000041 0000041 00000003423 13167661427 022300 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::RapidView do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { '1' } let(:expected_collection_length) { 1 } let(:expected_attributes) { { 'id' => 1, 'name' => 'SAMPLEPROJECT', 'canEdit' => true, 'sprintSupportEnabled' => true } } it_should_behave_like 'a resource' # TODO@Anton: Add json file # it_should_behave_like 'a resource with a singular GET endpoint' describe 'GET all rapidviews' do let(:client) { client } let(:site_url) { site_url } before(:each) do stub_request(:get, site_url + '/jira/rest/greenhopper/1.0/rapidview'). to_return(:status => 200, :body => get_mock_response('rapidview.json')) end it_should_behave_like 'a resource with a collection GET endpoint' end describe 'issues' do it 'should return all the issues' do stub_request( :get, site_url + '/jira/rest/greenhopper/1.0/xboard/plan/backlog/data?rapidViewId=1' ).to_return( :status => 200, :body => get_mock_response('rapidview/SAMPLEPROJECT.issues.json') ) stub_request( :get, site_url + '/jira/rest/api/2/search?jql=id IN(10000, 10001)' ).to_return( :status => 200, :body => get_mock_response('rapidview/SAMPLEPROJECT.issues.full.json') ) subject = client.RapidView.build('id' => 1) issues = subject.issues expect(issues.length).to eq(2) issues.each do |issue| expect(issue.class).to eq(JIRA::Resource::Issue) expect(issue.expanded?).to be_falsey end end end end end jira-ruby-1.4.3/spec/integration/status_spec.rb 0000644 0000041 0000041 00000001115 13167661427 021625 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Status do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "1" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/status/1", 'id' => key, 'name' => 'Open' } end let(:expected_collection_length) { 5 } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" end end jira-ruby-1.4.3/spec/integration/component_spec.rb 0000644 0000041 0000041 00000002207 13167661427 022307 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Component do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/component/10000", 'id' => key, 'name' => "Cheesecake" } end let(:attributes_for_post) { {"name" => "Test component", "project" => "SAMPLEPROJECT" } } let(:expected_attributes_from_post) { { "id" => "10001", "name" => "Test component" } } let(:attributes_for_put) { {"name" => "Jammy", "project" => "SAMPLEPROJECT" } } let(:expected_attributes_from_put) { { "id" => "10000", "name" => "Jammy" } } it_should_behave_like "a resource" it_should_behave_like "a resource with a singular GET endpoint" it_should_behave_like "a resource with a DELETE endpoint" it_should_behave_like "a resource with a POST endpoint" it_should_behave_like "a resource with a PUT endpoint" it_should_behave_like "a resource with a PUT endpoint that rejects invalid fields" end end jira-ruby-1.4.3/spec/integration/worklog_spec.rb 0000644 0000041 0000041 00000002614 13167661427 021773 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Worklog do with_each_client do |site_url, client| let(:client) { client } let(:site_url) { site_url } let(:key) { "10000" } let(:target) { JIRA::Resource::Worklog.new(client, :attrs => {'id' => '99999'}, :issue_id => '54321') } let(:expected_collection_length) { 3 } let(:belongs_to) { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '10002', 'fields' => { 'comment' => {'comments' => []} } }) } let(:expected_attributes) do { 'self' => "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000", 'id' => key, 'comment' => "Some epic work." } end let(:attributes_for_post) { {"timeSpent" => "2d"} } let(:expected_attributes_from_post) { { "id" => "10001", "timeSpent" => "2d"} } let(:attributes_for_put) { {"timeSpent" => "2d"} } let(:expected_attributes_from_put) { { "id" => "10001", "timeSpent" => "4d"} } it_should_behave_like "a resource" it_should_behave_like "a resource with a collection GET endpoint" it_should_behave_like "a resource with a singular GET endpoint" it_should_behave_like "a resource with a DELETE endpoint" it_should_behave_like "a resource with a POST endpoint" it_should_behave_like "a resource with a PUT endpoint" end end jira-ruby-1.4.3/spec/mock_responses/ 0000755 0000041 0000041 00000000000 13167661427 017454 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/user_username=admin.json 0000644 0000041 0000041 00000000742 13167661427 024335 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true, "timeZone": "Pacific/Auckland", "groups": { "size": 3, "items": [] }, "expand": "groups" } jira-ruby-1.4.3/spec/mock_responses/status.json 0000644 0000041 0000041 00000002776 13167661427 021706 0 ustar www-data www-data [ { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, { "self": "http://localhost:2990/jira/rest/api/2/status/3", "description": "This issue is being actively worked on at the moment by the assignee.", "iconUrl": "http://localhost:2990/jira/images/icons/status_inprogress.gif", "name": "In Progress", "id": "3" }, { "self": "http://localhost:2990/jira/rest/api/2/status/4", "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "iconUrl": "http://localhost:2990/jira/images/icons/status_reopened.gif", "name": "Reopened", "id": "4" }, { "self": "http://localhost:2990/jira/rest/api/2/status/5", "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "iconUrl": "http://localhost:2990/jira/images/icons/status_resolved.gif", "name": "Resolved", "id": "5" }, { "self": "http://localhost:2990/jira/rest/api/2/status/6", "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "iconUrl": "http://localhost:2990/jira/images/icons/status_closed.gif", "name": "Closed", "id": "6" } ] jira-ruby-1.4.3/spec/mock_responses/issue/ 0000755 0000041 0000041 00000000000 13167661427 020604 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/ 0000755 0000041 0000041 00000000000 13167661427 021246 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/transitions.json 0000644 0000041 0000041 00000002700 13167661427 024515 0 ustar www-data www-data { "expand": "transitions", "transitions": [ { "id": "41", "name": "Review", "to": { "self": "http://localhost:2990/rest/api/2/status/10006", "description": "", "iconUrl": "http://localhost:2990/images/icons/statuses/generic.png", "name": "Reviewable", "id": "10006" } }, { "id": "101", "name": "Stop Progress", "to": { "self": "http://localhost:2990/rest/api/2/status/10017", "description": "Mapping for Accepted in Pivotal Tracker", "iconUrl": "http://localhost:2990/images/icons/statuses/closed.png", "name": "Accepted", "id": "10017" } }, { "id": "21", "name": "Remove from Backlog", "to": { "self": "http://localhost:2990/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/images/icons/statuses/open.png", "name": "Open", "id": "1" } }, { "id": "71", "name": "Resolve", "to": { "self": "http://localhost:2990/rest/api/2/status/5", "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "iconUrl": "http://localhost:2990/images/icons/statuses/resolved.png", "name": "Resolved", "id": "5" } } ] } jira-ruby-1.4.3/spec/mock_responses/issue/10002/comment/ 0000755 0000041 0000041 00000000000 13167661427 022710 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/comment/10000.json 0000644 0000041 0000041 00000001777 13167661427 024257 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10000", "id": "10000", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "body": "This is a comment. Creative.", "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-11T10:02:14.430+1300", "updated": "2012-01-11T10:02:14.430+1300" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/comment/10000.put.json 0000644 0000041 0000041 00000001753 13167661427 025060 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10000", "id": "10000", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "body": "new body", "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-11T10:02:14.430+1300", "updated": "2012-01-12T14:37:41.933+1300" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/worklog.json 0000644 0000041 0000041 00000007040 13167661427 023626 0 ustar www-data www-data { "startAt": 0, "maxResults": 3, "total": 3, "worklogs": [ { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "comment": "Some epic work.", "created": "2012-01-11T13:33:25.604+1300", "updated": "2012-01-11T13:33:25.604+1300", "started": "2012-01-11T13:33:00.000+1300", "timeSpent": "18w 2d", "id": "10000" }, { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10001", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T16:08:58.529+1300", "updated": "2012-01-12T16:11:22.266+1300", "started": "2012-01-12T16:08:58.529+1300", "timeSpent": "4d", "id": "10001" }, { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10002", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T16:20:39.542+1300", "updated": "2012-01-12T16:20:39.542+1300", "started": "2012-01-12T16:20:39.541+1300", "timeSpent": "3d", "id": "10002" } ] } jira-ruby-1.4.3/spec/mock_responses/issue/10002/transitions.post.json 0000644 0000041 0000041 00000000001 13167661427 025471 0 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/attachments/ 0000755 0000041 0000041 00000000000 13167661427 023561 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/attachments/10000.json 0000644 0000041 0000041 00000001326 13167661427 025116 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/attachment/10000", "filename": "ballmer.png", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-11T10:54:50.875+1300", "size": 15360, "mimeType": "image/png", "properties": {}, "content": "http://localhost:2990/jira/secure/attachment/10000/ballmer.png", "thumbnail": "http://localhost:2990/jira/secure/thumbnail/10000/_thumb_10000.png" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/worklog/ 0000755 0000041 0000041 00000000000 13167661427 022732 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issue/10002/worklog/10000.json 0000644 0000041 0000041 00000002073 13167661427 024267 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "comment": "Some epic work.", "created": "2012-01-11T13:33:25.604+1300", "updated": "2012-01-11T13:33:25.604+1300", "started": "2012-01-11T13:33:00.000+1300", "timeSpent": "18w 2d", "id": "10000" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/worklog/10000.put.json 0000644 0000041 0000041 00000002027 13167661427 025075 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10001", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T16:08:58.529+1300", "updated": "2012-01-12T16:11:22.266+1300", "started": "2012-01-12T16:08:58.529+1300", "timeSpent": "4d", "id": "10001" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/comment.post.json 0000644 0000041 0000041 00000001756 13167661427 024600 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10001", "id": "10001", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "body": "new comment", "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T14:29:59.209+1300", "updated": "2012-01-12T14:29:59.209+1300" } jira-ruby-1.4.3/spec/mock_responses/issue/10002/watchers.json 0000644 0000041 0000041 00000000526 13167661427 023764 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/watchers", "isWatching": false, "watchCount": 1, "watchers": [ { "self": "http://www.example.com/jira/rest/api/2/user?username=admin", "name": "admin", "displayName": "admin", "active": false } ] } jira-ruby-1.4.3/spec/mock_responses/issue/10002/comment.json 0000644 0000041 0000041 00000004437 13167661427 023613 0 ustar www-data www-data { "startAt": 0, "maxResults": 2, "total": 2, "comments": [ { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10000", "id": "10000", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "body": "This is a comment. Creative.", "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-11T10:02:14.430+1300", "updated": "2012-01-12T15:15:13.074+1300" }, { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/comment/10001", "id": "10001", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "body": "new comment", "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T14:29:59.209+1300", "updated": "2012-01-12T14:29:59.209+1300" } ] } jira-ruby-1.4.3/spec/mock_responses/issue/10002/worklog.post.json 0000644 0000041 0000041 00000002027 13167661427 024612 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10001", "author": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "updateAuthor": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "created": "2012-01-12T16:08:58.529+1300", "updated": "2012-01-12T16:08:58.529+1300", "started": "2012-01-12T16:08:58.529+1300", "timeSpent": "2d", "id": "10001" } jira-ruby-1.4.3/spec/mock_responses/issue/10002.invalid.put.json 0000644 0000041 0000041 00000000157 13167661427 024400 0 ustar www-data www-data { "errorMessages": [], "errors": { "invalid": "Field 'invalid' is not valid for this operation." } } jira-ruby-1.4.3/spec/mock_responses/issue/10002.put.missing_field_update.json 0000644 0000041 0000041 00000000130 13167661427 027117 0 ustar www-data www-data { "errorMessages": [ "one of 'fields' or 'update' required" ], "errors": {} } jira-ruby-1.4.3/spec/mock_responses/issue/10002.json 0000644 0000041 0000041 00000007437 13167661427 022154 0 ustar www-data www-data { "expand": "renderedFields,names,schema,transitions,editmeta,changelog", "id": "10002", "self": "http://localhost:2990/jira/rest/api/2/issue/10002", "key": "SAMPLEPROJECT-1", "fields": { "summary": "Sample Issue", "progress": { "progress": 0, "total": 0 }, "timetracking": {}, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T10:26:06.030+1300", "created": "2011-12-14T10:26:06.030+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": "2011-12-14", "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/watchers", "watchCount": 0, "isWatching": false }, "worklog": { "startAt": 0, "maxResults": 0, "total": 0, "worklogs": [] }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "workratio": -1, "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "attachment": [], "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [ { "self": "http://localhost:2990/jira/rest/api/2/component/10001", "id": "10001", "name": "Jamflam" }, { "self": "http://localhost:2990/jira/rest/api/2/component/10000", "id": "10000", "name": "Jammy", "description": "Description!" } ], "comment": { "startAt": 0, "maxResults": 0, "total": 0, "comments": [] }, "timeoriginalestimate": null, "aggregatetimespent": null } } jira-ruby-1.4.3/spec/mock_responses/component/ 0000755 0000041 0000041 00000000000 13167661427 021456 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/component/10000.json 0000644 0000041 0000041 00000002446 13167661427 023017 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/component/10000", "id": "10000", "name": "Cheesecake", "description": "Description!", "lead": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "assigneeType": "PROJECT_DEFAULT", "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "realAssigneeType": "PROJECT_DEFAULT", "realAssignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "isAssigneeTypeValid": true } jira-ruby-1.4.3/spec/mock_responses/component/10000.put.json 0000644 0000041 0000041 00000002441 13167661427 023621 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/component/10000", "id": "10000", "name": "Jammy", "description": "Description!", "lead": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "assigneeType": "PROJECT_DEFAULT", "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "realAssigneeType": "PROJECT_DEFAULT", "realAssignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "isAssigneeTypeValid": true } jira-ruby-1.4.3/spec/mock_responses/component/10000.invalid.put.json 0000644 0000041 0000041 00000000370 13167661427 025245 0 ustar www-data www-data { "errorMessages": [ "Unrecognized field \"invalid\" (Class com.atlassian.jira.rest.v2.issue.component.ComponentBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@70faf7c7; line: 1, column: 2]" ] } jira-ruby-1.4.3/spec/mock_responses/resolution.json 0000644 0000041 0000041 00000000760 13167661427 022555 0 ustar www-data www-data [ { "self": "http://www.example.com/jira/rest/api/2/resolution/1", "description": "A fix for this issue is checked into the tree and tested.", "iconUrl": "http://www.example.com/jira/images/icons/status_resolved.gif", "name": "Fixed", "id": "1" }, { "self": "http://www.example.com/jira/rest/api/2/resolution/3", "description": "This is what it is supposed to do.", "name": "Works as designed", "id": "3" } ] jira-ruby-1.4.3/spec/mock_responses/version.post.json 0000644 0000041 0000041 00000000220 13167661427 023012 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/version/10001", "id": "10001", "name": "2.0", "archived": false, "released": false } jira-ruby-1.4.3/spec/mock_responses/field.json 0000644 0000041 0000041 00000001206 13167661427 021431 0 ustar www-data www-data [ { "id": "1", "name": "Description", "custom": false, "orderable": true, "navigable": true, "searchable": true, "clauseNames": [ "description" ], "schema": { "type": "string", "system": "description" } }, { "id": "2", "name": "Summary", "custom": false, "orderable": true, "navigable": true, "searchable": true, "clauseNames": [ "summary" ], "schema": { "type": "string", "system": "summary" } } ] jira-ruby-1.4.3/spec/mock_responses/priority.json 0000644 0000041 0000041 00000002675 13167661427 022242 0 ustar www-data www-data [ { "self": "http://localhost:2990/jira/rest/api/2/priority/1", "statusColor": "#cc0000", "description": "Blocks development and/or testing work, production could not run.", "iconUrl": "http://localhost:2990/jira/images/icons/priority_blocker.gif", "name": "Blocker", "id": "1" }, { "self": "http://localhost:2990/jira/rest/api/2/priority/2", "statusColor": "#ff0000", "description": "Crashes, loss of data, severe memory leak.", "iconUrl": "http://localhost:2990/jira/images/icons/priority_critical.gif", "name": "Critical", "id": "2" }, { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "statusColor": "#009900", "description": "Major loss of function.", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, { "self": "http://localhost:2990/jira/rest/api/2/priority/4", "statusColor": "#006600", "description": "Minor loss of function, or other problem where easy workaround is present.", "iconUrl": "http://localhost:2990/jira/images/icons/priority_minor.gif", "name": "Minor", "id": "4" }, { "self": "http://localhost:2990/jira/rest/api/2/priority/5", "statusColor": "#003300", "description": "Cosmetic problem like misspelled words or misaligned text", "iconUrl": "http://localhost:2990/jira/images/icons/priority_trivial.gif", "name": "Trivial", "id": "5" } ] jira-ruby-1.4.3/spec/mock_responses/webhook/ 0000755 0000041 0000041 00000000000 13167661427 021112 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/webhook/webhook.json 0000644 0000041 0000041 00000000526 13167661427 023446 0 ustar www-data www-data {"name":"from API", "url":"http://localhost:3000/webhooks/1", "excludeBody":false, "filters":{"issue-related-events-section":""}, "events":[], "enabled":true, "self":"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser":"admin", "lastUpdatedDisplayName":"admin", "lastUpdated":1453306520188 } jira-ruby-1.4.3/spec/mock_responses/issuetype.json 0000644 0000041 0000041 00000002544 13167661427 022406 0 ustar www-data www-data [ { "self": "http://localhost:2990/jira/rest/api/2/issuetype/5", "id": "5", "description": "The sub-task of the issue", "iconUrl": "http://localhost:2990/jira/images/icons/issue_subtask.gif", "name": "Sub-task", "subtask": true }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/4", "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "iconUrl": "http://localhost:2990/jira/images/icons/improvement.gif", "name": "Improvement", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/1", "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "iconUrl": "http://localhost:2990/jira/images/icons/bug.gif", "name": "Bug", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/2", "id": "2", "description": "A new feature of the product, which has yet to be developed.", "iconUrl": "http://localhost:2990/jira/images/icons/newfeature.gif", "name": "New Feature", "subtask": false } ] jira-ruby-1.4.3/spec/mock_responses/component.post.json 0000644 0000041 0000041 00000001652 13167661427 023341 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/component/10001", "id": "10001", "name": "Test component", "assigneeType": "PROJECT_DEFAULT", "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "realAssigneeType": "PROJECT_DEFAULT", "realAssignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "isAssigneeTypeValid": true } jira-ruby-1.4.3/spec/mock_responses/status/ 0000755 0000041 0000041 00000000000 13167661427 020777 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/status/1.json 0000644 0000041 0000041 00000000374 13167661427 022036 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" } jira-ruby-1.4.3/spec/mock_responses/issueLinkType.json 0000644 0000041 0000041 00000001146 13167661427 023161 0 ustar www-data www-data { "issueLinkTypes": [ { "id": "10000", "name": "Blocks", "inward": "is blocked by", "outward": "blocks", "self": "http://localhost:2990/jira/rest/api/2/issueLinkType/10000" }, { "id": "10400", "name": "Cloners", "inward": "is cloned by", "outward": "clones", "self": "http://localhost:2990/jira/rest/api/2/issueLinkType/10400" }, { "id": "10401", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates", "self": "http://localhost:2990/jira/rest/api/2/issueLinkType/10401" } ] } jira-ruby-1.4.3/spec/mock_responses/issue.json 0000644 0000041 0000041 00000117257 13167661427 021514 0 ustar www-data www-data { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 11, "issues": [ { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10014", "self": "http://localhost:2990/jira/rest/api/2/issue/10014", "key": "SAMPLEPROJECT-13", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-13/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:35:06.000+1300", "created": "2011-12-15T15:35:06.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-13/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10013", "self": "http://localhost:2990/jira/rest/api/2/issue/10013", "key": "SAMPLEPROJECT-12", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-12/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:34:58.000+1300", "created": "2011-12-15T15:34:58.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-12/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10012", "self": "http://localhost:2990/jira/rest/api/2/issue/10012", "key": "SAMPLEPROJECT-11", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-11/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:34:48.000+1300", "created": "2011-12-15T15:34:48.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-11/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10011", "self": "http://localhost:2990/jira/rest/api/2/issue/10011", "key": "SAMPLEPROJECT-10", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-10/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:11:57.000+1300", "created": "2011-12-15T15:11:57.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-10/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10010", "self": "http://localhost:2990/jira/rest/api/2/issue/10010", "key": "SAMPLEPROJECT-9", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-9/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:11:45.000+1300", "created": "2011-12-15T15:11:45.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-9/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10009", "self": "http://localhost:2990/jira/rest/api/2/issue/10009", "key": "SAMPLEPROJECT-8", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-8/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T14:19:49.000+1300", "created": "2011-12-15T14:19:49.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-8/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10008", "self": "http://localhost:2990/jira/rest/api/2/issue/10008", "key": "SAMPLEPROJECT-7", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-7/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:50:38.000+1300", "created": "2011-12-14T14:50:38.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-7/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10007", "self": "http://localhost:2990/jira/rest/api/2/issue/10007", "key": "SAMPLEPROJECT-6", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-6/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:49:35.000+1300", "created": "2011-12-14T14:49:35.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-6/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10006", "self": "http://localhost:2990/jira/rest/api/2/issue/10006", "key": "SAMPLEPROJECT-5", "fields": { "summary": "blah", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-5/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:46:58.000+1300", "created": "2011-12-14T14:46:58.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-5/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10005", "self": "http://localhost:2990/jira/rest/api/2/issue/10005", "key": "SAMPLEPROJECT-4", "fields": { "summary": "blah", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-4/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T12:11:48.000+1300", "created": "2011-12-14T12:11:48.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-4/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10002", "self": "http://localhost:2990/jira/rest/api/2/issue/10002", "key": "SAMPLEPROJECT-1", "fields": { "summary": "MOOOOOOARRR NINJAAAA!", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:37:33.000+1300", "created": "2011-12-14T10:26:06.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": "2011-12-14", "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } } ] } jira-ruby-1.4.3/spec/mock_responses/issueLinkType/ 0000755 0000041 0000041 00000000000 13167661427 022264 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issueLinkType/10000.json 0000644 0000041 0000041 00000000242 13167661427 023615 0 ustar www-data www-data { "id": "10000", "self": "http://localhost:2990/jira/rest/api/2/issueLinkType/10000", "name": "Blocks", "inward": "is blocked by", "outward": "blocks" } jira-ruby-1.4.3/spec/mock_responses/project.json 0000644 0000041 0000041 00000000635 13167661427 022021 0 ustar www-data www-data [ { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } } ] jira-ruby-1.4.3/spec/mock_responses/priority/ 0000755 0000041 0000041 00000000000 13167661427 021335 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/priority/1.json 0000644 0000041 0000041 00000000442 13167661427 022370 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/priority/1", "statusColor": "#cc0000", "description": "Blocks development and/or testing work, production could not run.", "iconUrl": "http://localhost:2990/jira/images/icons/priority_blocker.gif", "name": "Blocker", "id": "1" } jira-ruby-1.4.3/spec/mock_responses/rapidview.json 0000644 0000041 0000041 00000000216 13167661427 022340 0 ustar www-data www-data { "views": [ { "id": 1, "name": "SAMPLEPROJECT", "canEdit": true, "sprintSupportEnabled": true } ] } jira-ruby-1.4.3/spec/mock_responses/rapidview/ 0000755 0000041 0000041 00000000000 13167661427 021446 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/rapidview/SAMPLEPROJECT.issues.json 0000644 0000041 0000041 00000006054 13167661427 025670 0 ustar www-data www-data { "sprintMarkersMigrated": true, "issues": [ { "id": 10000, "key": "SAM-1", "hidden": false, "typeName": "Story", "typeId": "10001", "summary": "Test issue 1", "typeUrl": "http://localhost:2990/jira/images/icons/ico_story.png", "priorityUrl": "http://localhost:2990/jira/images/icons/priorities/major.png", "priorityName": "Major", "done": false, "assignee": "admin", "assigneeName": "admin", "hasCustomUserAvatar": false, "autoUserAvatar": { "letter": "a", "color": "#f691b2" }, "color": "#cc0000", "estimateStatistic": { "statFieldId": "customfield_10002", "statFieldValue": {} }, "statusId": "1", "statusName": "Open", "statusUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "status": { "id": "1", "name": "Open", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "statusCategory": { "id": "2", "key": "new", "colorName": "blue-gray" } }, "fixVersions": [], "projectId": 10000, "linkedPagesCount": 0 }, { "id": 10001, "key": "SAM-2", "hidden": false, "typeName": "Story", "typeId": "10001", "summary": "Test issue 2", "typeUrl": "http://localhost:2990/jira/images/icons/ico_story.png", "priorityUrl": "http://localhost:2990/jira/images/icons/priorities/major.png", "priorityName": "Major", "done": false, "assignee": "admin", "assigneeName": "admin", "hasCustomUserAvatar": false, "autoUserAvatar": { "letter": "a", "color": "#f691b2" }, "color": "#cc0000", "estimateStatistic": { "statFieldId": "customfield_10002", "statFieldValue": {} }, "statusId": "1", "statusName": "Open", "statusUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "status": { "id": "1", "name": "Open", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "statusCategory": { "id": "2", "key": "new", "colorName": "blue-gray" } }, "fixVersions": [], "projectId": 10000, "linkedPagesCount": 0 } ], "rankCustomFieldId": 10009, "sprints": [], "supportsPages": false, "projects": [ { "id": 10000, "key": "SAM", "name": "SAMPLEPROJECT" } ], "epicData": { "epics": [], "canEditEpics": false, "supportsPages": false }, "canManageSprints": true, "maxIssuesExceeded": false, "queryResultLimit": 2147483647, "versionData": { "versionsPerProject": { "10000": [] }, "canCreateVersion": true } } jira-ruby-1.4.3/spec/mock_responses/rapidview/SAMPLEPROJECT.issues.full.json 0000644 0000041 0000041 00000032072 13167661427 026630 0 ustar www-data www-data { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 2, "issues": [ { "expand": "editmeta,renderedFields,transitions,changelog,operations", "id": "10001", "self": "http://localhost:2990/jira/rest/api/2/issue/10001", "key": "SAM-2", "fields": { "summary": "Test issue 2", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/10001", "id": "10001", "description": "", "iconUrl": "http://localhost:2990/jira/images/icons/ico_story.png", "name": "Story", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAM-2/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "creator": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "created": "2014-07-18T23:30:43.000+0700", "updated": "2014-07-18T23:30:44.000+0700", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priorities/major.png", "name": "Major", "id": "3" }, "duedate": null, "customfield_10001": null, "customfield_10002": null, "customfield_10003": null, "issuelinks": [], "customfield_10004": null, "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAM-2/watchers", "watchCount": 1, "isWatching": true }, "customfield_10000": null, "subtasks": [], "customfield_10009": "0|100004:", "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "name": "Open", "id": "1", "statusCategory": { "self": "http://localhost:2990/jira/rest/api/2/statuscategory/2", "id": 2, "key": "new", "colorName": "blue-gray", "name": "New" } }, "labels": [], "customfield_10005": null, "workratio": -1, "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/10000", "id": "10000", "key": "SAM", "name": "SAMPLEPROJECT", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=xsmall&pid=10000&avatarId=10011", "24x24": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10000&avatarId=10011", "32x32": "http://localhost:2990/jira/secure/projectavatar?size=medium&pid=10000&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10000&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "lastViewed": "2014-07-18T23:30:43.561+0700", "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog,operations", "id": "10000", "self": "http://localhost:2990/jira/rest/api/2/issue/10000", "key": "SAM-1", "fields": { "summary": "Test issue 1", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/10001", "id": "10001", "description": "", "iconUrl": "http://localhost:2990/jira/images/icons/ico_story.png", "name": "Story", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAM-1/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "creator": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "created": "2014-07-18T23:30:26.000+0700", "updated": "2014-07-18T23:30:26.000+0700", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priorities/major.png", "name": "Major", "id": "3" }, "duedate": null, "customfield_10001": null, "customfield_10002": null, "customfield_10003": null, "issuelinks": [], "customfield_10004": null, "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAM-1/watchers", "watchCount": 1, "isWatching": true }, "customfield_10000": null, "subtasks": [], "customfield_10009": "0|100000:", "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/statuses/open.png", "name": "Open", "id": "1", "statusCategory": { "self": "http://localhost:2990/jira/rest/api/2/statuscategory/2", "id": 2, "key": "new", "colorName": "blue-gray", "name": "New" } }, "labels": [], "customfield_10005": null, "workratio": -1, "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=xsmall&avatarId=10122", "24x24": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "32x32": "http://localhost:2990/jira/secure/useravatar?size=medium&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/10000", "id": "10000", "key": "SAM", "name": "SAMPLEPROJECT", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=xsmall&pid=10000&avatarId=10011", "24x24": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10000&avatarId=10011", "32x32": "http://localhost:2990/jira/secure/projectavatar?size=medium&pid=10000&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10000&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "lastViewed": "2014-07-18T23:30:28.576+0700", "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } } ] } jira-ruby-1.4.3/spec/mock_responses/rapidview/SAMPLEPROJECT.json 0000644 0000041 0000041 00000000133 13167661427 024346 0 ustar www-data www-data { "id": 1, "name": "SAMPLEPROJECT", "canEdit": true, "sprintSupportEnabled": true } jira-ruby-1.4.3/spec/mock_responses/webhook.json 0000644 0000041 0000041 00000000527 13167661427 022011 0 ustar www-data www-data [{"name":"from API", "url":"http://localhost:3000/webhooks/1", "excludeBody":false, "filters":{"issue-related-events-section":""}, "events":[], "enabled":true, "self":"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser":"admin", "lastUpdatedDisplayName":"admin", "lastUpdated":1453306520188} ] jira-ruby-1.4.3/spec/mock_responses/issuetype/ 0000755 0000041 0000041 00000000000 13167661427 021506 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/issuetype/5.json 0000644 0000041 0000041 00000000360 13167661427 022544 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/issuetype/5", "id": "5", "description": "The sub-task of the issue", "iconUrl": "http://localhost:2990/jira/images/icons/issue_subtask.gif", "name": "Sub-task", "subtask": true } jira-ruby-1.4.3/spec/mock_responses/sprint/ 0000755 0000041 0000041 00000000000 13167661427 020773 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/sprint/1_issues.json 0000644 0000041 0000041 00000010457 13167661427 023430 0 ustar www-data www-data { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 1, "issues": [ { "expand": "", "id": "10001", "self": "http://www.example.com/jira/rest/agile/1.0/board/92/issue/10001", "key": "HSP-1", "fields": { "flagged": true, "sprint": { "id": 37, "self": "http://www.example.com/jira/rest/agile/1.0/sprint/13", "state": "future", "name": "sprint 2" }, "closedSprints": [ { "id": 37, "self": "http://www.example.com/jira/rest/agile/1.0/sprint/23", "state": "closed", "name": "sprint 1", "startDate": "2015-04-11T15:22:00.000+10:00", "endDate": "2015-04-20T01:22:00.000+10:00", "completeDate": "2015-04-20T11:04:00.000+10:00" } ], "description": "example bug report", "project": { "self": "http://www.example.com/jira/rest/api/2/project/EX", "id": "10000", "key": "EX", "name": "Example", "avatarUrls": { "48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10000", "24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10000", "16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000", "32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10000" }, "projectCategory": { "self": "http://www.example.com/jira/rest/api/2/projectCategory/10000", "id": "10000", "name": "FIRST", "description": "First Project Category" } }, "comment": [ { "self": "http://www.example.com/jira/rest/api/2/issue/10010/comment/10000", "id": "10000", "author": { "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "name": "fred", "displayName": "Fred F. User", "active": false }, "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", "updateAuthor": { "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "name": "fred", "displayName": "Fred F. User", "active": false }, "created": "2016-06-22T11:49:57.797+0200", "updated": "2016-06-22T11:49:57.800+0200", "visibility": { "type": "role", "value": "Administrators" } } ], "epic": { "id": 37, "self": "http://www.example.com/jira/rest/agile/1.0/epic/23", "name": "epic 1", "summary": "epic 1 summary", "color": { "key": "color_4" }, "done": true }, "worklog": [ { "self": "http://www.example.com/jira/rest/api/2/issue/10010/worklog/10000", "author": { "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "name": "fred", "displayName": "Fred F. User", "active": false }, "updateAuthor": { "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "name": "fred", "displayName": "Fred F. User", "active": false }, "comment": "I did some work here.", "updated": "2016-06-22T11:49:57.804+0200", "visibility": { "type": "group", "value": "jira-developers" }, "started": "2016-06-22T11:49:57.804+0200", "timeSpent": "3h 20m", "timeSpentSeconds": 12000, "id": "100028", "issueId": "10002" } ], "updated": 1, "timetracking": { "originalEstimate": "10m", "remainingEstimate": "3m", "timeSpent": "6m", "originalEstimateSeconds": 600, "remainingEstimateSeconds": 200, "timeSpentSeconds": 400 } } } ] } jira-ruby-1.4.3/spec/mock_responses/board/ 0000755 0000041 0000041 00000000000 13167661427 020543 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/board/1.json 0000644 0000041 0000041 00000001521 13167661427 021575 0 ustar www-data www-data { "maxResults": 50, "startAt": 0, "isLast": true, "values": [ { "id": 1, "self": "https://test.com/jira/rest/agile/1.0/sprint/1", "state": "closed", "name": "Test Sprint 1", "startDate": "2016-05-03T01:45:17.624-04:00", "endDate": "2016-05-06T13:30:00.000-04:00", "completeDate": "2016-05-08T04:05:31.959-04:00", "originBoardId": 1 }, { "id": 2, "self": "https://test.com/jira/rest/agile/1.0/sprint/2", "state": "active", "name": "Test Sprint 2", "startDate": "2016-12-12T04:42:46.184-05:00", "endDate": "2017-01-02T13:56:00.000-05:00", "originBoardId": 1 }, { "id": 3, "self": "https://test.com/jira/rest/agile/1.0/sprint/2", "state": "future", "name": "Test Sprint 2", "originBoardId": 1 } ] } jira-ruby-1.4.3/spec/mock_responses/board/1_issues.json 0000644 0000041 0000041 00000003750 13167661427 023176 0 ustar www-data www-data { "expand": "schema,names", "startAt": 0, "maxResults": 1000, "total": 9, "issues": [ { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10546", "self": "https://jira.example.com/rest/agile/1.0/issue/10546", "key": "SBT-1" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10547", "self": "https://jira.example.com/rest/agile/1.0/issue/10547", "key": "SBT-2" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10556", "self": "https://jira.example.com/rest/agile/1.0/issue/10556", "key": "SBT-11" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10557", "self": "https://jira.example.com/rest/agile/1.0/issue/10557", "key": "SBT-12" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10558", "self": "https://jira.example.com/rest/agile/1.0/issue/10558", "key": "SBT-13" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10559", "self": "https://jira.example.com/rest/agile/1.0/issue/10559", "key": "SBT-14" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10600", "self": "https://jira.example.com/rest/agile/1.0/issue/10600", "key": "SBT-16" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10601", "self": "https://jira.example.com/rest/agile/1.0/issue/10601", "key": "SBT-17" }, { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "10604", "self": "https://jira.example.com/rest/agile/1.0/issue/10604", "key": "SBT-19" } ] } jira-ruby-1.4.3/spec/mock_responses/project/ 0000755 0000041 0000041 00000000000 13167661427 021122 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/project/SAMPLEPROJECT.issues.json 0000644 0000041 0000041 00000117257 13167661427 025354 0 ustar www-data www-data { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 11, "issues": [ { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10014", "self": "http://localhost:2990/jira/rest/api/2/issue/10014", "key": "SAMPLEPROJECT-13", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-13/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:35:06.000+1300", "created": "2011-12-15T15:35:06.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-13/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10013", "self": "http://localhost:2990/jira/rest/api/2/issue/10013", "key": "SAMPLEPROJECT-12", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-12/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:34:58.000+1300", "created": "2011-12-15T15:34:58.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-12/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10012", "self": "http://localhost:2990/jira/rest/api/2/issue/10012", "key": "SAMPLEPROJECT-11", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-11/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:34:48.000+1300", "created": "2011-12-15T15:34:48.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-11/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10011", "self": "http://localhost:2990/jira/rest/api/2/issue/10011", "key": "SAMPLEPROJECT-10", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-10/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:11:57.000+1300", "created": "2011-12-15T15:11:57.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-10/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10010", "self": "http://localhost:2990/jira/rest/api/2/issue/10010", "key": "SAMPLEPROJECT-9", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-9/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:11:45.000+1300", "created": "2011-12-15T15:11:45.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-9/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10009", "self": "http://localhost:2990/jira/rest/api/2/issue/10009", "key": "SAMPLEPROJECT-8", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-8/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T14:19:49.000+1300", "created": "2011-12-15T14:19:49.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-8/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10008", "self": "http://localhost:2990/jira/rest/api/2/issue/10008", "key": "SAMPLEPROJECT-7", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-7/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:50:38.000+1300", "created": "2011-12-14T14:50:38.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-7/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10007", "self": "http://localhost:2990/jira/rest/api/2/issue/10007", "key": "SAMPLEPROJECT-6", "fields": { "summary": "blarg from in example.rb", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-6/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:49:35.000+1300", "created": "2011-12-14T14:49:35.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-6/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10006", "self": "http://localhost:2990/jira/rest/api/2/issue/10006", "key": "SAMPLEPROJECT-5", "fields": { "summary": "blah", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-5/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T14:46:58.000+1300", "created": "2011-12-14T14:46:58.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-5/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10005", "self": "http://localhost:2990/jira/rest/api/2/issue/10005", "key": "SAMPLEPROJECT-4", "fields": { "summary": "blah", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-4/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-14T12:11:48.000+1300", "created": "2011-12-14T12:11:48.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": null, "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-4/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } }, { "expand": "editmeta,renderedFields,transitions,changelog", "id": "10002", "self": "http://localhost:2990/jira/rest/api/2/issue/10002", "key": "SAMPLEPROJECT-1", "fields": { "summary": "MOOOOOOARRR NINJAAAA!", "progress": { "progress": 0, "total": 0 }, "issuetype": { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, "votes": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/votes", "votes": 0, "hasVoted": false }, "resolution": null, "fixVersions": [], "resolutiondate": null, "timespent": null, "reporter": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "aggregatetimeoriginalestimate": null, "updated": "2011-12-15T15:37:33.000+1300", "created": "2011-12-14T10:26:06.000+1300", "description": null, "priority": { "self": "http://localhost:2990/jira/rest/api/2/priority/3", "iconUrl": "http://localhost:2990/jira/images/icons/priority_major.gif", "name": "Major", "id": "3" }, "duedate": "2011-12-14", "issuelinks": [], "watches": { "self": "http://localhost:2990/jira/rest/api/2/issue/SAMPLEPROJECT-1/watchers", "watchCount": 0, "isWatching": false }, "subtasks": [], "status": { "self": "http://localhost:2990/jira/rest/api/2/status/1", "description": "The issue is open and ready for the assignee to start work on it.", "iconUrl": "http://localhost:2990/jira/images/icons/status_open.gif", "name": "Open", "id": "1" }, "labels": [], "assignee": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "workratio": -1, "aggregatetimeestimate": null, "project": { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "name": "Sample Project for Developing RoR RESTful API", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } }, "versions": [], "environment": null, "timeestimate": null, "aggregateprogress": { "progress": 0, "total": 0 }, "components": [], "timeoriginalestimate": null, "aggregatetimespent": null } } ] } jira-ruby-1.4.3/spec/mock_responses/project/SAMPLEPROJECT.json 0000644 0000041 0000041 00000005606 13167661427 024034 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT", "id": "10001", "key": "SAMPLEPROJECT", "lead": { "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", "name": "admin", "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122", "48x48": "http://localhost:2990/jira/secure/useravatar?avatarId=10122" }, "displayName": "admin", "active": true }, "components": [ { "self": "http://localhost:2990/jira/rest/api/2/component/10001", "id": "10001", "name": "Jamflam", "isAssigneeTypeValid": false }, { "self": "http://localhost:2990/jira/rest/api/2/component/10000", "id": "10000", "name": "Jammy", "description": "Description!", "isAssigneeTypeValid": false } ], "issueTypes": [ { "self": "http://localhost:2990/jira/rest/api/2/issuetype/1", "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "iconUrl": "http://localhost:2990/jira/images/icons/bug.gif", "name": "Bug", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/2", "id": "2", "description": "A new feature of the product, which has yet to be developed.", "iconUrl": "http://localhost:2990/jira/images/icons/newfeature.gif", "name": "New Feature", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/3", "id": "3", "description": "A task that needs to be done.", "iconUrl": "http://localhost:2990/jira/images/icons/task.gif", "name": "Task", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/4", "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "iconUrl": "http://localhost:2990/jira/images/icons/improvement.gif", "name": "Improvement", "subtask": false }, { "self": "http://localhost:2990/jira/rest/api/2/issuetype/5", "id": "5", "description": "The sub-task of the issue", "iconUrl": "http://localhost:2990/jira/images/icons/issue_subtask.gif", "name": "Sub-task", "subtask": true } ], "assigneeType": "PROJECT_LEAD", "versions": [], "name": "Sample Project for Developing RoR RESTful API", "roles": { "Users": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT/role/10000", "Administrators": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT/role/10002", "Developers": "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT/role/10001" }, "avatarUrls": { "16x16": "http://localhost:2990/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011", "48x48": "http://localhost:2990/jira/secure/projectavatar?pid=10001&avatarId=10011" } } jira-ruby-1.4.3/spec/mock_responses/issue.post.json 0000644 0000041 0000041 00000000157 13167661427 022466 0 ustar www-data www-data { "id": "10005", "key": "SAMPLEPROJECT-4", "self": "http://localhost:2990/jira/rest/api/2/issue/10005" } jira-ruby-1.4.3/spec/mock_responses/field/ 0000755 0000041 0000041 00000000000 13167661427 020537 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/field/1.json 0000644 0000041 0000041 00000000360 13167661427 021571 0 ustar www-data www-data { "id": "1", "name": "Description", "custom": false, "orderable": true, "navigable": true, "searchable": true, "clauseNames": [ "description" ], "schema": { "type": "string", "system": "description" } } jira-ruby-1.4.3/spec/mock_responses/jira/ 0000755 0000041 0000041 00000000000 13167661427 020401 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/jira/rest/ 0000755 0000041 0000041 00000000000 13167661427 021356 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/jira/rest/webhooks/ 0000755 0000041 0000041 00000000000 13167661427 023177 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/jira/rest/webhooks/1.0/ 0000755 0000041 0000041 00000000000 13167661427 023475 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/jira/rest/webhooks/1.0/webhook/ 0000755 0000041 0000041 00000000000 13167661427 025133 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/jira/rest/webhooks/1.0/webhook/2.json 0000644 0000041 0000041 00000000526 13167661427 026172 0 ustar www-data www-data {"name":"from API", "url":"http://localhost:3000/webhooks/1", "excludeBody":false, "filters":{"issue-related-events-section":""}, "events":[], "enabled":true, "self":"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser":"admin", "lastUpdatedDisplayName":"admin", "lastUpdated":1453306520188 } jira-ruby-1.4.3/spec/mock_responses/jira/rest/webhooks/1.0/webhook.json 0000644 0000041 0000041 00000000530 13167661427 026024 0 ustar www-data www-data [{"name":"from API", "url":"http://localhost:3000/webhooks/1", "excludeBody":false, "filters":{"issue-related-events-section":""}, "events":[], "enabled":true, "self":"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser":"admin", "lastUpdatedDisplayName":"admin", "lastUpdated":1453306520188 }] jira-ruby-1.4.3/spec/mock_responses/version/ 0000755 0000041 0000041 00000000000 13167661427 021141 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/version/10000.json 0000644 0000041 0000041 00000000411 13167661427 022470 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/version/10000", "id": "10000", "description": "Initial version", "name": "1.0", "overdue": false, "userReleaseDate": "12/Jan/12", "archived": false, "releaseDate": "2012-01-12", "released": false } jira-ruby-1.4.3/spec/mock_responses/version/10000.put.json 0000644 0000041 0000041 00000000222 13167661427 023277 0 ustar www-data www-data { "self": "http://localhost:2990/jira/rest/api/2/version/10000", "id": "10000", "name": "2.0.0", "archived": false, "released": false } jira-ruby-1.4.3/spec/mock_responses/version/10000.invalid.put.json 0000644 0000041 0000041 00000000362 13167661427 024731 0 ustar www-data www-data { "errorMessages": [ "Unrecognized field \"chump\" (Class com.atlassian.jira.rest.v2.issue.version.VersionBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4264a42e; line: 1, column: 2]" ] } jira-ruby-1.4.3/spec/mock_responses/resolution/ 0000755 0000041 0000041 00000000000 13167661427 021657 5 ustar www-data www-data jira-ruby-1.4.3/spec/mock_responses/resolution/1.json 0000644 0000041 0000041 00000000410 13167661427 022705 0 ustar www-data www-data { "self": "http://www.example.com/jira/rest/api/2/resolution/1", "description": "A fix for this issue is checked into the tree and tested.", "iconUrl": "http://www.example.com/jira/images/icons/status_resolved.gif", "name": "Fixed", "id": "1" } jira-ruby-1.4.3/spec/support/ 0000755 0000041 0000041 00000000000 13167661427 016136 5 ustar www-data www-data jira-ruby-1.4.3/spec/support/matchers/ 0000755 0000041 0000041 00000000000 13167661427 017744 5 ustar www-data www-data jira-ruby-1.4.3/spec/support/matchers/have_many.rb 0000644 0000041 0000041 00000000455 13167661427 022244 0 ustar www-data www-data RSpec::Matchers.define :have_many do |collection, klass| match do |actual| expect(actual.send(collection).class).to eq(JIRA::HasManyProxy) expect(actual.send(collection).length).to be > 0 actual.send(collection).each do |member| expect(member.class).to eq(klass) end end end jira-ruby-1.4.3/spec/support/matchers/have_attributes.rb 0000644 0000041 0000041 00000000404 13167661427 023460 0 ustar www-data www-data RSpec::Matchers.define :have_attributes do |expected| match do |actual| expected.each do |key, value| expect(actual.attrs[key]).to eq(value) end end failure_message do |actual| "expected #{actual.attrs} to match #{expected}" end end jira-ruby-1.4.3/spec/support/matchers/have_one.rb 0000644 0000041 0000041 00000000211 13167661427 022047 0 ustar www-data www-data RSpec::Matchers.define :have_one do |resource, klass| match do |actual| expect(actual.send(resource).class).to eq(klass) end end jira-ruby-1.4.3/spec/support/shared_examples/ 0000755 0000041 0000041 00000000000 13167661427 021302 5 ustar www-data www-data jira-ruby-1.4.3/spec/support/shared_examples/integration.rb 0000644 0000041 0000041 00000014653 13167661427 024163 0 ustar www-data www-data require 'cgi' def get_mock_from_path(method, options = {}) if defined? belongs_to prefix = belongs_to.path_component + '/' else prefix = '' end if options[:url] url = options[:url] elsif options[:key] url = described_class.singular_path(client, options[:key], prefix) else url = described_class.collection_path(client, prefix) end file_path = url.sub(client.options[:rest_base_path], '') file_path = file_path + '.' + options[:suffix] if options[:suffix] file_path = file_path + '.' + method.to_s unless method == :get value_if_not_found = options.keys.include?(:value_if_not_found) ? options[:value_if_not_found] : false get_mock_response("#{file_path}.json", value_if_not_found) end def class_basename described_class.name.split('::').last end def options options = {} if defined? belongs_to options[belongs_to.to_sym] = belongs_to end options end def prefix prefix = '/' if defined? belongs_to prefix = belongs_to.path_component + '/' end prefix end def build_receiver if defined?(belongs_to) belongs_to.send(described_class.endpoint_name.pluralize.to_sym) else client.send(class_basename) end end shared_examples "a resource" do it "gracefully handles non-json responses" do if defined? target subject = target else subject = client.send(class_basename).build(described_class.key_attribute.to_s => '99999') end stub_request(:put, site_url + subject.url). to_return(:status => 405, :body => "
Some HTML") expect(subject.save('foo' => 'bar')).to be_falsey expect(lambda do expect(subject.save!('foo' => 'bar')).to be_falsey end).to raise_error(JIRA::HTTPError) end end shared_examples "a resource with a collection GET endpoint" do it "should get the collection" do stub_request(:get, site_url + described_class.collection_path(client)). to_return(:status => 200, :body => get_mock_from_path(:get)) collection = build_receiver.all expect(collection.length).to eq(expected_collection_length) expect(collection.first).to have_attributes(expected_attributes) end end shared_examples "a resource with JQL inputs and a collection GET endpoint" do it "should get the collection" do stub_request( :get, site_url + client.options[:rest_base_path] + '/search?jql=' + CGI.escape(jql_query_string) ).to_return(:status => 200, :body => get_mock_response('issue.json')) collection = build_receiver.jql(jql_query_string) expect(collection.length).to eq(expected_collection_length) expect(collection.first).to have_attributes(expected_attributes) end end shared_examples "a resource with a singular GET endpoint" do it "GETs a single resource" do # E.g., for JIRA::Resource::Project, we need to call # client.Project.find() stub_request(:get, site_url + described_class.singular_path(client, key, prefix)). to_return(:status => 200, :body => get_mock_from_path(:get, :key => key)) subject = client.send(class_basename).find(key, options) expect(subject).to have_attributes(expected_attributes) end it "builds and fetches a single resource" do # E.g., for JIRA::Resource::Project, we need to call # client.Project.build('key' => 'ABC123') stub_request(:get, site_url + described_class.singular_path(client, key, prefix)). to_return(:status => 200, :body => get_mock_from_path(:get, :key => key)) subject = build_receiver.build(described_class.key_attribute.to_s => key) subject.fetch expect(subject).to have_attributes(expected_attributes) end it "handles a 404" do stub_request(:get, site_url + described_class.singular_path(client, '99999', prefix)). to_return(:status => 404, :body => '{"errorMessages":["'+class_basename+' Does Not Exist"],"errors": {}}') expect( lambda do client.send(class_basename).find('99999', options) end).to raise_exception(JIRA::HTTPError) end end shared_examples "a resource with a DELETE endpoint" do it "deletes a resource" do # E.g., for JIRA::Resource::Project, we need to call # client.Project.delete() stub_request(:delete, site_url + described_class.singular_path(client, key, prefix)). to_return(:status => 204, :body => nil) subject = build_receiver.build(described_class.key_attribute.to_s => key) expect(subject.delete).to be_truthy end end shared_examples "a resource with a POST endpoint" do it "saves a new resource" do stub_request(:post, site_url + described_class.collection_path(client, prefix)). to_return(:status => 201, :body => get_mock_from_path(:post)) subject = build_receiver.build expect(subject.save(attributes_for_post)).to be_truthy expected_attributes_from_post.each do |method_name, value| expect(subject.send(method_name)).to eq(value) end end end shared_examples "a resource with a PUT endpoint" do it "saves an existing component" do stub_request(:get, site_url + described_class.singular_path(client, key, prefix)). to_return(:status => 200, :body => get_mock_from_path(:get, :key =>key)) stub_request(:put, site_url + described_class.singular_path(client, key, prefix)). to_return(:status => 200, :body => get_mock_from_path(:put, :key => key, :value_if_not_found => nil)) subject = build_receiver.build(described_class.key_attribute.to_s => key) subject.fetch expect(subject.save(attributes_for_put)).to be_truthy expected_attributes_from_put.each do |method_name, value| expect(subject.send(method_name)).to eq(value) end end end shared_examples 'a resource with a PUT endpoint that rejects invalid fields' do it "fails to save with an invalid field" do stub_request(:get, site_url + described_class.singular_path(client, key)). to_return(:status => 200, :body => get_mock_from_path(:get, :key => key)) stub_request(:put, site_url + described_class.singular_path(client, key)). to_return(:status => 400, :body => get_mock_from_path(:put, :key => key, :suffix => "invalid")) subject = client.send(class_basename).build(described_class.key_attribute.to_s => key) subject.fetch expect(subject.save('fields'=> {'invalid' => 'field'})).to be_falsey expect(lambda do subject.save!('fields'=> {'invalid' => 'field'}) end).to raise_error(JIRA::HTTPError) end end jira-ruby-1.4.3/spec/support/clients_helper.rb 0000644 0000041 0000041 00000001012 13167661427 021455 0 ustar www-data www-data module ClientsHelper def with_each_client clients = {} oauth_client = JIRA::Client.new({ :consumer_key => 'foo', :consumer_secret => 'bar' }) oauth_client.set_access_token('abc', '123') clients["http://localhost:2990"] = oauth_client basic_client = JIRA::Client.new({ :username => 'foo', :password => 'bar', :auth_type => :basic, :use_ssl => false }) clients["http://foo:bar@localhost:2990"] = basic_client clients.each do |site_url, client| yield site_url, client end end end jira-ruby-1.4.3/spec/jira/ 0000755 0000041 0000041 00000000000 13167661427 015347 5 ustar www-data www-data jira-ruby-1.4.3/spec/jira/resource/ 0000755 0000041 0000041 00000000000 13167661427 017176 5 ustar www-data www-data jira-ruby-1.4.3/spec/jira/resource/user_factory_spec.rb 0000644 0000041 0000041 00000001406 13167661427 023243 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::UserFactory do let(:client) { instance_double('Client', options: { rest_base_path: '/jira/rest/api/2' }) } subject { JIRA::Resource::UserFactory.new(client) } describe "#myself" do let(:response) { instance_double( 'Response', body: get_mock_response('user_username=admin.json') ) } let(:user) { subject.myself } before(:each) do allow(client).to receive(:get).with( '/jira/rest/api/2/myself' ).and_return(response) end it "returns a JIRA::Resource::User with correct attrs" do expect(user).to be_a(JIRA::Resource::User) expect(user.name).to eq('admin') expect(user.emailAddress).to eq('admin@example.com') end end end jira-ruby-1.4.3/spec/jira/resource/attachment_spec.rb 0000644 0000041 0000041 00000004436 13167661427 022674 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Attachment do let(:client) { double( 'client', :options => { :rest_base_path => '/jira/rest/api/2' }, :request_client => double( :options => { :username => 'username', :password => 'password' } ) ) } describe "relationships" do subject { JIRA::Resource::Attachment.new(client, :issue => JIRA::Resource::Issue.new(client), :attrs => { 'author' => {'foo' => 'bar'} }) } it "has the correct relationships" do expect(subject).to have_one(:author, JIRA::Resource::User) expect(subject.author.foo).to eq('bar') end end describe '#meta' do let(:response) { double( 'response', :body => '{"enabled":true,"uploadLimit":10485760}' ) } it 'returns meta information about attachment upload' do expect(client).to receive(:get).with('/jira/rest/api/2/attachment/meta').and_return(response) JIRA::Resource::Attachment.meta(client) end subject { JIRA::Resource::AttachmentFactory.new(client) } it 'delegates #meta to to target class' do expect(subject).to respond_to(:meta) end end describe '#save!' do it 'successfully update the attachment' do basic_auth_http_conn = double() response = double( body: [ { "id": 10001, "self": "http://www.example.com/jira/rest/api/2.0/attachments/10000", "filename": "picture.jpg", "created": "2017-07-19T12:23:06.572+0000", "size": 23123, "mimeType": "image/jpeg", } ].to_json ) allow(client.request_client).to receive(:basic_auth_http_conn).and_return(basic_auth_http_conn) allow(basic_auth_http_conn).to receive(:request).and_return(response) issue = JIRA::Resource::Issue.new(client) path_to_file = './spec/mock_responses/issue.json' attachment = JIRA::Resource::Attachment.new(client, issue: issue) attachment.save!('file' => path_to_file) expect(attachment.filename).to eq 'picture.jpg' expect(attachment.mimeType).to eq 'image/jpeg' expect(attachment.size).to eq 23123 end end end jira-ruby-1.4.3/spec/jira/resource/agile_spec.rb 0000644 0000041 0000041 00000013435 13167661427 021624 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Agile do let(:client) do client = double(options: {rest_base_path: '/jira/rest/api/2', context_path: '/jira'}) allow(client).to receive(:Issue).and_return(JIRA::Resource::IssueFactory.new(client)) client end let(:response) { double } describe '#all' do it 'should query url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.all(client) end end describe '#get_backlog_issues' do it 'should query the url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/backlog?maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_backlog_issues(client, 1) end end describe '#get_board_issues' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/issue?').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1_issues.json')) expect(client).to receive(:get).with('/jira/rest/api/2/search?jql=id+IN%2810546%2C+10547%2C+10556%2C+10557%2C+10558%2C+10559%2C+10600%2C+10601%2C+10604%29').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1_issues.json')) issues = JIRA::Resource::Agile.get_board_issues(client, 1) expect(issues).to be_an(Array) expect(issues.size).to eql(9) issues.each do |issue| expect(issue.class).to eq(JIRA::Resource::Issue) expect(issue.expanded?).to be_falsey end end it 'should query correct url with parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/issue?startAt=50').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1_issues.json')) expect(client).to receive(:get).with('/jira/rest/api/2/search?jql=id+IN%2810546%2C+10547%2C+10556%2C+10557%2C+10558%2C+10559%2C+10600%2C+10601%2C+10604%29').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1_issues.json')) issues = JIRA::Resource::Agile.get_board_issues(client, 1, startAt: 50) expect(issues).to be_an(Array) expect(issues.size).to eql(9) issues.each do |issue| expect(issue.class).to eq(JIRA::Resource::Issue) expect(issue.expanded?).to be_falsey end end end describe '#get_sprints' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/sprint?maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_sprints(client, 1) end it 'should query correct url with parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/sprint?startAt=50&maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_sprints(client, 1, startAt: 50) end it 'should work with pagination starting at 0' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/sprint?maxResults=1&startAt=0').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_sprints(client, 1, maxResults: 1, startAt: 0) end it 'should work with pagination not starting at 0' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/sprint?maxResults=1&startAt=1').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_sprints(client, 1, maxResults: 1, startAt: 1) end end describe '#get_sprint_issues' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/sprint/1/issue?maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('sprint/1_issues.json')) JIRA::Resource::Agile.get_sprint_issues(client, 1) end it 'should query correct url with parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/sprint/1/issue?startAt=50&maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('sprint/1_issues.json')) JIRA::Resource::Agile.get_sprint_issues(client, 1, startAt: 50) end end describe '#get_projects_full' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/project/full').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_projects_full(client, 1) end end describe '#get_projects' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/project?maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_projects(client, 1) end it 'should query correct url with parameters' do expect(client).to receive(:get).with('/jira/rest/agile/1.0/board/1/project?startAt=50&maxResults=100').and_return(response) expect(response).to receive(:body).and_return(get_mock_response('board/1.json')) JIRA::Resource::Agile.get_projects(client, 1, startAt: 50) end end end jira-ruby-1.4.3/spec/jira/resource/field_spec.rb 0000644 0000041 0000041 00000012627 13167661427 021630 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Field do let(:cache) { OpenStruct.new } let(:client) do client = double(options: {rest_base_path: '/jira/rest/api/2'} ) field = JIRA::Resource::FieldFactory.new(client) allow(client).to receive(:Field).and_return(field) allow(client).to receive(:cache).and_return(cache) # info about all fields on the client allow(client.Field).to receive(:all).and_return([ JIRA::Resource::Field.new(client, :attrs => {'id' =>"customfield_10666", "name" => "Priority", "custom" => true, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["cf[10666]","Priority"], "schema" =>{"type" => "string", "custom" => "com.atlassian.jira.plugin.system.customfieldtypes:select","customId" => 10666}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"issuekey", "name" => "Key", "custom" => false, "orderable" => false, "navigable" => true, "searchable" => false, "clauseNames" => ["id","issue","issuekey","key"]}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"priority", "name" => "Priority", "custom" => false, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["priority"], "schema" =>{"type" => "priority", "system" => "priority"}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"summary", "name" => "Summary", "custom" => false, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["summary"], "schema" =>{"type" => "string", "system" => "summary"}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"issuetype", "name" => "Issue Type", "custom" => false, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["issuetype","type"], "schema" =>{"type" => "issuetype", "system" => "issuetype"}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"customfield_10111", "name" => "SingleWord", "custom" => true, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["cf[10111]","SingleWord"], "schema" =>{"type" => "string", "custom" => "com.atlassian.jira.plugin.system.customfieldtypes:select","customId" => 10111}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"customfield_10222", "name" => "Multi Word", "custom" => true, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["cf[10222]","Multi Word"], "schema" =>{"type" => "string", "custom" => "com.atlassian.jira.plugin.system.customfieldtypes:select","customId" => 10222}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"customfield_10333", "name" => "Why/N@t", "custom" => true, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["cf[10333]","Why/N@t"], "schema" =>{"type" => "string", "custom" => "com.atlassian.jira.plugin.system.customfieldtypes:select","customId" => 10333}}), JIRA::Resource::Field.new(client, :attrs => {'id' =>"customfield_10444", "name" => "SingleWord", "custom" => true, "orderable" => true, "navigable" => true, "searchable" => true, "clauseNames" => ["cf[10444]","SingleWord"], "schema" =>{"type" => "string", "custom" => "com.atlassian.jira.plugin.system.customfieldtypes:select","customId" => 10444}}) ]) client end describe "field_mappings" do shared_context "mapped or not" do subject { JIRA::Resource::Field.new(client, :attrs => { 'priority' => 1, 'customfield_10111' => 'data_in_custom_field', 'customfield_10222' => 'multi word custom name', 'customfield_10333' => 'complex custom name', 'customfield_10444' => 'duplicated custom name', 'customfield_10666' => 'duplicate of a system name', }) } it "can find a standard field by id" do expect(subject.priority).to eq(1) end it "can find a custom field by customfield_##### name" do expect(subject.customfield_10111).to eq('data_in_custom_field') end it "is not confused by common attribute keys" do expect{subject.name}.to raise_error(NoMethodError) expect{subject.custom}.to raise_error(NoMethodError) expect(subject.id).to eq(nil) # picks up ID from the parent - end end context "before fields are mapped" do include_context "mapped or not" it "can find a standard field by id" do expect(subject.priority).to eq(1) end it "cannot find a standard field by name before mapping" do expect{subject.Priority}.to raise_error(NoMethodError) end it "can find a custom field by customfield_##### name" do expect(subject.customfield_10111).to eq('data_in_custom_field') end it "is not confused by common attribute keys and raises error" do expect{subject.name}.to raise_error(NoMethodError) expect{subject.custom}.to raise_error(NoMethodError) expect(subject.id).to eq(nil) # picks up ID from the parent - end end context "after fields are mapped" do include_context "mapped or not" it "warns of duplicate fields" do expect{client.Field.map_fields}.to output(/renaming as Priority_10666/).to_stderr expect{client.Field.map_fields}.to output(/renaming as SingleWord_10444/).to_stderr end end end end jira-ruby-1.4.3/spec/jira/resource/filter_spec.rb 0000644 0000041 0000041 00000005606 13167661427 022031 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Filter do let(:client) do client = double() allow(client).to receive(:Issue).and_return(JIRA::Resource::IssueFactory.new(self)) client end let(:collection_path) { '/rest/api/2/filter' } let(:jira_user) do { :self => "https://localhost/rest/api/2/user?username=ljharb", :name => 'ljharb', :avatarUrls => { '16x16' => 'https://localhost/secure/useravatar?size=small&ownerId=ljharb&avatarId=1', '48x48' => 'https://localhost/secure/useravatar?ownerId=ljharb&avatarId=1' }, :displayName => 'Jordan Harband', :active => true } end let(:filter_attrs) do { :self => "https://localhost#{collection_path}/42", :id => 42, :name => 'Resolved Tickets', :description => '', :owner => jira_user, :jql => '"Git Repository" ~ jira-ruby AND status = Resolved', :viewUrl => 'https://localhost/secure/IssueNavigator.jspa?mode=hide&requestId=42', :searchUrl => 'https://localhost/rest/api/2/search?jql=%22Git+Repository%22+~+jira-ruby+AND+status+%3D+Resolved', :favourite => false, :sharePermissions => [ { :id => 123, :type => 'global' } ], :subscriptions => { :size => 0, :items => [] } } end let(:filter_response) do response = double() allow(response).to receive(:body).and_return(filter_attrs.to_json) response end let(:filter) do expect(client).to receive(:get).with("#{collection_path}/42").and_return(filter_response) allow(JIRA::Resource::Filter).to receive(:collection_path).and_return(collection_path) JIRA::Resource::Filter.find(client, 42) end let(:jql_issue) do { :id => '663147', :self => 'https://localhost/rest/api/2/issue/663147', :key => "JIRARUBY-2386", :fields => { :reporter => jira_user, :created => '2013-12-11T23:28:02.000+0000', :assignee => jira_user } } end let(:jql_attrs) do { :startAt => 0, :maxResults => 50, :total => 2, :issues => [jql_issue] } end let(:issue_jql_response) do response = double() allow(response).to receive(:body).and_return(jql_attrs.to_json) response end it "can be found by ID" do expect(JSON.parse(filter.attrs.to_json)).to eql(JSON.parse(filter_attrs.to_json)) end it "returns issues" do expect(filter).to be_present allow(client).to receive(:options).and_return({ :rest_base_path => 'localhost' }) expect(client).to receive(:get). with("localhost/search?jql=#{CGI.escape(filter.jql)}"). and_return(issue_jql_response) issues = filter.issues expect(issues).to be_an(Array) expect(issues.size).to eql(1) expected_issue = client.Issue.build(JSON.parse(jql_issue.to_json)) expect(issues.first.attrs).to eql(expected_issue.attrs) end end jira-ruby-1.4.3/spec/jira/resource/project_factory_spec.rb 0000644 0000041 0000041 00000000464 13167661427 023736 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::ProjectFactory do let(:client) { double() } subject { JIRA::Resource::ProjectFactory.new(client) } it "initializes correctly" do expect(subject.class).to eq(JIRA::Resource::ProjectFactory) expect(subject.client).to eq(client) end end jira-ruby-1.4.3/spec/jira/resource/issuelink_spec.rb 0000644 0000041 0000041 00000000357 13167661427 022550 0 ustar www-data www-data # require 'spec_helper' # # describe JIRA::Resource::Issuelink do # let(:client) { double() } # # describe "links" do # subject { # JIRA::Resource::Issuelink.new(client, :attrs => { # # } # ) # } # end # end jira-ruby-1.4.3/spec/jira/resource/project_spec.rb 0000644 0000041 0000041 00000010512 13167661427 022202 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Project do let(:client) { double("client", :options => { :rest_base_path => '/jira/rest/api/2' }) } describe "relationships" do subject { JIRA::Resource::Project.new(client, :attrs => { 'lead' => {'foo' => 'bar'}, 'issueTypes' => [{'foo' =>'bar'},{'baz' => 'flum'}], 'versions' => [{'foo' =>'bar'},{'baz' => 'flum'}], }) } it "has the correct relationships" do expect(subject).to have_one(:lead, JIRA::Resource::User) expect(subject.lead.foo).to eq('bar') expect(subject).to have_many(:issuetypes, JIRA::Resource::Issuetype) expect(subject.issuetypes.length).to eq(2) expect(subject).to have_many(:versions, JIRA::Resource::Version) expect(subject.versions.length).to eq(2) end end describe "issues" do subject { JIRA::Resource::Project.new(client, :attrs => { 'key' => 'test' }) } it "returns issues" do response_body = '{"expand":"schema,names","startAt":0,"maxResults":1,"total":1,"issues":[{"expand":"editmeta,renderedFields,transitions,changelog,operations","id":"53062","self":"/rest/api/2/issue/53062","key":"test key","fields":{"summary":"test summary"}}]}' response = double("response", :body => response_body) issue_factory = double("issue factory") expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=project%3D%22test%22') .and_return(response) expect(client).to receive(:Issue).and_return(issue_factory) expect(issue_factory).to receive(:build) .with(JSON.parse(response_body)["issues"][0]) subject.issues end context "with changelog" do it "returns issues" do response_body = '{"expand":"schema,names","startAt":0,"maxResults":1,"total":1,"issues":[{"expand":"editmeta,renderedFields,transitions,changelog,operations","id":"53062","self":"/rest/api/2/issue/53062","key":"test key","fields":{"summary":"test summary"},"changelog":{}}]}' response = double("response", :body => response_body) issue_factory = double("issue factory") expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=project%3D%22test%22&expand=changelog&startAt=1&maxResults=100') .and_return(response) expect(client).to receive(:Issue).and_return(issue_factory) expect(issue_factory).to receive(:build) .with(JSON.parse(response_body)["issues"][0]) subject.issues({expand:'changelog', startAt:1, maxResults:100}) end end end describe 'users' do let(:project) { JIRA::Resource::Project.new(client, attrs: { 'key' => project_key }) } let(:project_key) { SecureRandom.hex } let(:response) { double('response', body: '[{}]') } context 'pagination' do before(:each) do user_factory = double('user factory') expect(client).to receive(:User).and_return(user_factory) expect(user_factory).to receive(:build).with(any_args) end it 'doesn\'t use pagination parameters by default' do expect(client).to receive(:get) .with("/jira/rest/api/2/user/assignable/search?project=#{project_key}") .and_return(response) project.users end it 'accepts start_at option' do start_at = rand(1000) expect(client).to receive(:get) .with("/jira/rest/api/2/user/assignable/search?project=#{project_key}&startAt=#{start_at}") .and_return(response) project.users(start_at: start_at) end it 'accepts max_results option' do max_results = rand(1000) expect(client).to receive(:get) .with("/jira/rest/api/2/user/assignable/search?project=#{project_key}&maxResults=#{max_results}") .and_return(response) project.users(max_results: max_results) end it 'accepts start_at and max_results options' do start_at = rand(1000) max_results = rand(1000) expect(client).to receive(:get) .with("/jira/rest/api/2/user/assignable/search?project=#{project_key}&startAt=#{start_at}&maxResults=#{max_results}") .and_return(response) project.users(start_at: start_at, max_results: max_results) end end end end jira-ruby-1.4.3/spec/jira/resource/issue_spec.rb 0000644 0000041 0000041 00000020454 13167661427 021672 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Issue do class JIRAResourceDelegation < SimpleDelegator # :nodoc: end let(:client) do client = double(options: {rest_base_path: '/jira/rest/api/2'} ) allow(client).to receive(:Field).and_return(JIRA::Resource::FieldFactory.new(client)) allow(client).to receive(:cache).and_return(OpenStruct.new) client end describe "#respond_to?" do describe "when decorated by SimpleDelegator" do before(:each) do response = double() allow(response).to receive(:body).and_return('{"key":"foo","id":"101"}') allow(JIRA::Resource::Issue).to receive(:collection_path).and_return('/jira/rest/api/2/issue') allow(client).to receive(:get).with('/jira/rest/api/2/issue/101'). and_return(response) issue = JIRA::Resource::Issue.find(client,101) @decorated = JIRAResourceDelegation.new( issue ) end it "responds to key" do expect(@decorated.respond_to?(:key)).to eq(true) end it "does not raise an error" do expect { @issue.respond_to?(:project) }.not_to raise_error end end end it "should find all issues" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues":[{"id":"1","summary":"Bugs Everywhere"}]}') expect(client).to receive(:get).with('/jira/rest/api/2/search?expand=transitions.fields'). and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with({"id"=>"1","summary"=>"Bugs Everywhere"}) issues = JIRA::Resource::Issue.all(client) end it "should find an issue by key or id" do response = double() allow(response).to receive(:body).and_return('{"key":"foo","id":"101"}') allow(JIRA::Resource::Issue).to receive(:collection_path).and_return('/jira/rest/api/2/issue') expect(client).to receive(:get).with('/jira/rest/api/2/issue/foo'). and_return(response) expect(client).to receive(:get).with('/jira/rest/api/2/issue/101'). and_return(response) issue_from_id = JIRA::Resource::Issue.find(client,101) issue_from_key = JIRA::Resource::Issue.find(client,'foo') expect(issue_from_id.attrs).to eq(issue_from_key.attrs) end it "should search an issue with a jql query string" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues": {"key":"foo"}}') expect(client).to receive(:get).with('/jira/rest/api/2/search?jql=foo+bar'). and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with(["key", "foo"]).and_return('') expect(JIRA::Resource::Issue.jql(client,'foo bar')).to eq(['']) end it "should search an issue with a jql query string and fields" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues": {"key":"foo"}}') expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=foo+bar&fields=foo,bar') .and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with(["key", "foo"]).and_return('') expect(JIRA::Resource::Issue.jql(client, 'foo bar', fields: ['foo','bar'])).to eq(['']) end it "should search an issue with a jql query string, start at, and maxResults" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues": {"key":"foo"}}') expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=foo+bar&startAt=1&maxResults=3') .and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with(["key", "foo"]).and_return('') expect(JIRA::Resource::Issue.jql(client,'foo bar', start_at: 1, max_results: 3)).to eq(['']) end it "should search an issue with a jql query string and maxResults equals zero and should return the count of tickets" do response = double() issue = double() allow(response).to receive(:body).and_return('{"total": 1, "issues": []}') expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=foo+bar&maxResults=0') .and_return(response) expect(JIRA::Resource::Issue.jql(client,'foo bar', max_results: 0)).to eq(1) end it "should search an issue with a jql query string and string expand" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues": {"key":"foo"}}') expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=foo+bar&expand=transitions') .and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with(["key", "foo"]).and_return('') expect(JIRA::Resource::Issue.jql(client,'foo bar', expand: 'transitions')).to eq(['']) end it "should search an issue with a jql query string and array expand" do response = double() issue = double() allow(response).to receive(:body).and_return('{"issues": {"key":"foo"}}') expect(client).to receive(:get) .with('/jira/rest/api/2/search?jql=foo+bar&expand=transitions') .and_return(response) expect(client).to receive(:Issue).and_return(issue) expect(issue).to receive(:build).with(["key", "foo"]).and_return('') expect(JIRA::Resource::Issue.jql(client,'foo bar', expand: %w(transitions))).to eq(['']) end it 'should return meta data available for editing an issue' do subject = JIRA::Resource::Issue.new(client, :attrs => {'fields' => {'key' =>'TST=123'}}) response = double() allow(response).to receive(:body).and_return( '{"fields":{"summary":{"required":true,"name":"Summary","operations":["set"]}}}' ) expect(client).to receive(:get) .with('/jira/rest/api/2/issue/TST=123/editmeta') .and_return(response) expect(subject.editmeta).to eq({'summary' => {'required' => true, 'name' => 'Summary', 'operations' => ['set']}}) end it "provides direct accessors to the fields" do subject = JIRA::Resource::Issue.new(client, :attrs => {'fields' => {'foo' =>'bar'}}) expect(subject).to respond_to(:foo) expect(subject.foo).to eq('bar') end describe "relationships" do subject { JIRA::Resource::Issue.new(client, :attrs => { 'id' => '123', 'fields' => { 'reporter' => {'foo' => 'bar'}, 'assignee' => {'foo' => 'bar'}, 'project' => {'foo' => 'bar'}, 'priority' => {'foo' => 'bar'}, 'issuetype' => {'foo' => 'bar'}, 'status' => {'foo' => 'bar'}, 'components' => [{'foo' => 'bar'}, {'baz' => 'flum'}], 'versions' => [{'foo' => 'bar'}, {'baz' => 'flum'}], 'comment' => { 'comments' => [{'foo' => 'bar'}, {'baz' => 'flum'}]}, 'attachment' => [{'foo' => 'bar'}, {'baz' => 'flum'}], 'worklog' => { 'worklogs' => [{'foo' => 'bar'}, {'baz' => 'flum'}]}, } }) } it "has the correct relationships" do expect(subject).to have_one(:reporter, JIRA::Resource::User) expect(subject.reporter.foo).to eq('bar') expect(subject).to have_one(:assignee, JIRA::Resource::User) expect(subject.assignee.foo).to eq('bar') expect(subject).to have_one(:project, JIRA::Resource::Project) expect(subject.project.foo).to eq('bar') expect(subject).to have_one(:issuetype, JIRA::Resource::Issuetype) expect(subject.issuetype.foo).to eq('bar') expect(subject).to have_one(:priority, JIRA::Resource::Priority) expect(subject.priority.foo).to eq('bar') expect(subject).to have_one(:status, JIRA::Resource::Status) expect(subject.status.foo).to eq('bar') expect(subject).to have_many(:components, JIRA::Resource::Component) expect(subject.components.length).to eq(2) expect(subject).to have_many(:comments, JIRA::Resource::Comment) expect(subject.comments.length).to eq(2) expect(subject).to have_many(:attachments, JIRA::Resource::Attachment) expect(subject.attachments.length).to eq(2) expect(subject).to have_many(:versions, JIRA::Resource::Version) expect(subject.attachments.length).to eq(2) expect(subject).to have_many(:worklogs, JIRA::Resource::Worklog) expect(subject.worklogs.length).to eq(2) end end end jira-ruby-1.4.3/spec/jira/resource/createmeta_spec.rb 0000644 0000041 0000041 00000023447 13167661427 022661 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Createmeta do let(:client) { double( 'client', :options => { :rest_base_path => '/jira/rest/api/2' } ) } let(:response) { double( 'response', :body => '{"expand":"projects","projects":[{"self":"http://localhost:2029/rest/api/2/project/TST","id":"10200","key":"test_key","name":"Test Name"}]}' ) } describe 'general' do it 'should query correct url without parameters' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta').and_return(response) JIRA::Resource::Createmeta.all(client) end it 'should query correct url with `expand` parameter' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields').and_return(response) JIRA::Resource::Createmeta.all(client, :expand => 'projects.issuetypes.fields') end it 'should query correct url with `foo` parameter' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?foo=bar').and_return(response) JIRA::Resource::Createmeta.all(client, :foo => 'bar') end it 'should return an array of createmeta objects' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta').and_return(response) createmetas = JIRA::Resource::Createmeta.all(client) expect(createmetas).to be_an Array createmeta = createmetas.first expect(createmeta.id).to eq '10200' expect(createmeta.key).to eq 'test_key' expect(createmeta.name).to eq 'Test Name' end end describe 'projectKeys' do it 'should query correct url when only one `projectKeys` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1').and_return(response) JIRA::Resource::Createmeta.all( client, :projectKeys => 'PROJECT_1', ) end it 'should query correct url when multiple `projectKeys` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPROJECT_2').and_return(response) JIRA::Resource::Createmeta.all( client, :projectKeys => ['PROJECT_1', 'PROJECT_2'], ) end it 'should query correct url when only one `projectKeys` given as Project' do prj = JIRA::Resource::Project.new(client) allow(prj).to receive(:key).and_return('PRJ') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ').and_return(response) JIRA::Resource::Createmeta.all( client, :projectKeys => prj, ) end it 'should query correct url when multiple `projectKeys` given as Project' do prj_1 = JIRA::Resource::Project.new(client) allow(prj_1).to receive(:key).and_return('PRJ_1') prj_2 = JIRA::Resource::Project.new(client) allow(prj_2).to receive(:key).and_return('PRJ_2') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ_2%2CPRJ_1').and_return(response) JIRA::Resource::Createmeta.all( client, :projectKeys => [prj_2, prj_1], ) end it 'should query correct url when multiple `projectKeys` given as different types' do prj_5 = JIRA::Resource::Project.new(client) allow(prj_5).to receive(:key).and_return('PRJ_5') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPRJ_5').and_return(response) JIRA::Resource::Createmeta.all( client, :projectKeys => ['PROJECT_1', prj_5], ) end end describe 'projectIds' do it 'should query correct url when only one `projectIds` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101').and_return(response) JIRA::Resource::Createmeta.all( client, :projectIds => '10101', ) end it 'should query correct url when multiple `projectIds` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C20202').and_return(response) JIRA::Resource::Createmeta.all( client, :projectIds => ['10101', '20202'], ) end it 'should query correct url when only one `projectIds` given as Project' do prj = JIRA::Resource::Project.new(client) allow(prj).to receive(:id).and_return('30303') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=30303').and_return(response) JIRA::Resource::Createmeta.all( client, :projectIds => prj, ) end it 'should query correct url when multiple `projectIds` given as Project' do prj_1 = JIRA::Resource::Project.new(client) allow(prj_1).to receive(:id).and_return('30303') prj_2 = JIRA::Resource::Project.new(client) allow(prj_2).to receive(:id).and_return('50505') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=50505%2C30303').and_return(response) JIRA::Resource::Createmeta.all( client, :projectIds => [prj_2, prj_1], ) end it 'should query correct url when multiple `projectIds` given as different types' do prj_5 = JIRA::Resource::Project.new(client) allow(prj_5).to receive(:id).and_return('60606') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C60606').and_return(response) JIRA::Resource::Createmeta.all( client, :projectIds => ['10101', prj_5], ) end end describe 'issuetypeNames' do it 'should query correct url when only one `issuetypeNames` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeNames => 'Feature', ) end it 'should query correct url when multiple `issuetypeNames` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CBug').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeNames => ['Feature', 'Bug'], ) end it 'should query correct url when only one `issuetypeNames` given as Issuetype' do issue_type = JIRA::Resource::Issuetype.new(client) allow(issue_type).to receive(:name).and_return('Epic') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Epic').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeNames => issue_type, ) end it 'should query correct url when multiple `issuetypeNames` given as Issuetype' do issue_type_1 = JIRA::Resource::Issuetype.new(client) allow(issue_type_1).to receive(:name).and_return('Epic') issue_type_2 = JIRA::Resource::Issuetype.new(client) allow(issue_type_2).to receive(:name).and_return('Sub-Task') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Sub-Task%2CEpic').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeNames => [issue_type_2, issue_type_1], ) end it 'should query correct url when multiple `issuetypeNames` given as different types' do issue_type = JIRA::Resource::Issuetype.new(client) allow(issue_type).to receive(:name).and_return('Epic') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CEpic').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeNames => ['Feature', issue_type], ) end end describe 'issuetypeIds' do it 'should query correct url when only one `issuetypeIds` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeIds => '10101', ) end it 'should query correct url when multiple `issuetypeIds` given as string' do expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C20202').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeIds => ['10101', '20202'], ) end it 'should query correct url when only one `issuetypeIds` given as Issuetype' do issue_type = JIRA::Resource::Issuetype.new(client) allow(issue_type).to receive(:id).and_return('30303') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=30303').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeIds => issue_type, ) end it 'should query correct url when multiple `issuetypeIds` given as Issuetype' do issue_type_1 = JIRA::Resource::Issuetype.new(client) allow(issue_type_1).to receive(:id).and_return('30303') issue_type_2 = JIRA::Resource::Issuetype.new(client) allow(issue_type_2).to receive(:id).and_return('50505') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=50505%2C30303').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeIds => [issue_type_2, issue_type_1], ) end it 'should query correct url when multiple `issuetypeIds` given as different types' do issue_type = JIRA::Resource::Issuetype.new(client) allow(issue_type).to receive(:id).and_return('30303') expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C30303').and_return(response) JIRA::Resource::Createmeta.all( client, :issuetypeIds => ['10101', issue_type], ) end end end jira-ruby-1.4.3/spec/jira/resource/worklog_spec.rb 0000644 0000041 0000041 00000001134 13167661427 022220 0 ustar www-data www-data require 'spec_helper' describe JIRA::Resource::Worklog do let(:client) { double() } describe "relationships" do subject { JIRA::Resource::Worklog.new(client, :issue_id => '99999', :attrs => { 'author' => {'foo' => 'bar'}, 'updateAuthor' => {'foo' => 'bar'} }) } it "has the correct relationships" do expect(subject).to have_one(:author, JIRA::Resource::User) expect(subject.author.foo).to eq('bar') expect(subject).to have_one(:update_author, JIRA::Resource::User) expect(subject.update_author.foo).to eq('bar') end end end jira-ruby-1.4.3/spec/jira/has_many_proxy_spec.rb 0000644 0000041 0000041 00000002506 13167661427 021751 0 ustar www-data www-data require 'spec_helper' describe JIRA::HasManyProxy do class Foo ; end subject { JIRA::HasManyProxy.new(parent, Foo, collection) } let(:parent) { double("parent") } let(:collection) { double("collection") } it "has a target class" do expect(subject.target_class).to eq(Foo) end it "has a parent" do expect(subject.parent).to eq(parent) end it "has a collection" do expect(subject.collection).to eq(collection) end it "can build a new instance" do client = double('client') foo = double('foo') allow(parent).to receive(:client).and_return(client) allow(parent).to receive(:to_sym).and_return(:parent) expect(Foo).to receive(:new).with(client, :attrs => {'foo' => 'bar'}, :parent => parent).and_return(foo) expect(collection).to receive(:<<).with(foo) expect(subject.build('foo' => 'bar')).to eq(foo) end it "can get all the instances" do foo = double('foo') client = double('client') allow(parent).to receive(:client).and_return(client) allow(parent).to receive(:to_sym).and_return(:parent) expect(Foo).to receive(:all).with(client, :parent => parent).and_return(foo) expect(subject.all).to eq(foo) end it "delegates missing methods to the collection" do expect(collection).to receive(:missing_method) subject.missing_method end end jira-ruby-1.4.3/spec/jira/http_error_spec.rb 0000644 0000041 0000041 00000001111 13167661427 021070 0 ustar www-data www-data require 'spec_helper' describe JIRA::HTTPError do let(:response) { response = double("response") allow(response).to receive(:code).and_return(401) allow(response).to receive(:message).and_return("A MESSAGE WOO") response } subject { described_class.new(response) } it "takes the response object as an argument" do expect(subject.response).to eq(response) end it "has a code method" do expect(subject.code).to eq(response.code) end it "returns code and class from message" do expect(subject.message).to eq(response.message) end end jira-ruby-1.4.3/spec/jira/base_factory_spec.rb 0000644 0000041 0000041 00000002462 13167661427 021353 0 ustar www-data www-data require 'spec_helper' describe JIRA::BaseFactory do class JIRA::Resource::FooFactory < JIRA::BaseFactory ; end class JIRA::Resource::Foo ; end let(:client) { double() } subject { JIRA::Resource::FooFactory.new(client) } it "initializes correctly" do expect(subject.class).to eq(JIRA::Resource::FooFactory) expect(subject.client).to eq(client) expect(subject.target_class).to eq(JIRA::Resource::Foo) end it "proxies all to the target class" do expect(JIRA::Resource::Foo).to receive(:all).with(client) subject.all end it "proxies find to the target class" do expect(JIRA::Resource::Foo).to receive(:find).with(client, 'FOO') subject.find('FOO') end it "returns the target class" do expect(subject.target_class).to eq(JIRA::Resource::Foo) end it "proxies build to the target class" do attrs = double() expect(JIRA::Resource::Foo).to receive(:build).with(client, attrs) subject.build(attrs) end it "proxies collection path to the target class" do expect(JIRA::Resource::Foo).to receive(:collection_path).with(client) subject.collection_path end it "proxies singular path to the target class" do expect(JIRA::Resource::Foo).to receive(:singular_path).with(client, 'FOO') subject.singular_path('FOO') end end jira-ruby-1.4.3/spec/jira/client_spec.rb 0000644 0000041 0000041 00000021611 13167661427 020165 0 ustar www-data www-data require 'spec_helper' # We have three forms of authentication with two clases to represent the client for those different authentications. # Some behaviours are shared across all three types of authentication. these are captured here. RSpec.shared_examples 'Client Common Tests' do it { is_expected.to be_a JIRA::Client } it 'freezes the options once initialised' do expect(subject.options).to be_frozen end it 'prepends context path to rest base_path' do options = [:rest_base_path] defaults = JIRA::Client::DEFAULT_OPTIONS options.each { |key| expect(subject.options[key]).to eq(defaults[:context_path] + defaults[key]) } end it 'merges headers' do expect(subject.send(:merge_default_headers, {})).to eq({'Accept' => 'application/json'}) end describe 'http methods' do it 'merges default headers' do # stubbed response for generic client request method expect(subject).to receive(:request).exactly(5).times.and_return(successful_response) # response for merging headers for http methods with no body expect(subject).to receive(:merge_default_headers).exactly(3).times.with({}) # response for merging headers for http methods with body expect(subject).to receive(:merge_default_headers).exactly(2).times.with(content_type_header) [:delete, :get, :head].each { |method| subject.send(method, '/path', {}) } [:post, :put].each {|method| subject.send(method, '/path', '', content_type_header)} end it 'calls the generic request method' do [:delete, :get, :head].each do |method| expect(subject).to receive(:request).with(method, '/path', nil, headers).and_return(successful_response) subject.send(method, '/path', {}) end [:post, :put].each do |method| expect(subject).to receive(:request).with(method, '/path', '', merged_headers) subject.send(method, '/path', '', {}) end end end describe 'Resource Factories' do it 'gets all projects' do expect(JIRA::Resource::Project).to receive(:all).with(subject).and_return([]) expect(subject.Project.all).to eq([]) end it 'finds a single project' do find_result = double expect(JIRA::Resource::Project).to receive(:find).with(subject, '123').and_return(find_result) expect(subject.Project.find('123')).to eq(find_result) end end end RSpec.shared_examples 'HttpClient tests' do it 'makes a valid request' do [:delete, :get, :head].each do |method| expect(subject.request_client).to receive(:make_request).with(method, '/path', nil, headers).and_return(successful_response) subject.send(method, '/path', headers) end [:post, :put].each do |method| expect(subject.request_client).to receive(:make_request).with(method, '/path', '', merged_headers).and_return(successful_response) subject.send(method, '/path', '', headers) end end end describe JIRA::Client do let(:request) { subject.request_client.class } let(:successful_response) do response = double('response') allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(true) response end let(:content_type_header) { {'Content-Type' => 'application/json'} } let(:headers) { {'Accept' => 'application/json'} } let(:merged_headers) { headers.merge(content_type_header) } context 'behaviour that applies to all client classes irrespective of authentication method' do it 'allows the overriding of some options' do client = JIRA::Client.new({:consumer_key => 'foo', :consumer_secret => 'bar', :site => 'http://foo.com/'}) expect(client.options[:site]).to eq('http://foo.com/') expect(JIRA::Client::DEFAULT_OPTIONS[:site]).not_to eq('http://foo.com/') end end context 'with basic http authentication' do subject { JIRA::Client.new(username: 'foo', password: 'bar', auth_type: :basic) } before(:each) do stub_request(:get, 'https://foo:bar@localhost:2990/jira/rest/api/2/project') .to_return(status: 200, body: '[]', headers: {} ) stub_request(:get, 'https://foo:badpassword@localhost:2990/jira/rest/api/2/project'). to_return(status: 401, headers: {} ) end include_examples 'Client Common Tests' include_examples 'HttpClient tests' specify { expect(subject.request_client).to be_a JIRA::HttpClient } it 'sets the username and password' do expect(subject.options[:username]).to eq('foo') expect(subject.options[:password]).to eq('bar') end it 'fails with wrong user name and password' do bad_login = JIRA::Client.new(username: 'foo', password: 'badpassword', auth_type: :basic) expect(bad_login.authenticated?).to be_falsey expect{bad_login.Project.all}.to raise_error JIRA::HTTPError end it 'only returns a true for #authenticated? once we have requested some data' do expect(subject.authenticated?).to be_falsey expect(subject.Project.all).to be_empty expect(subject.authenticated?).to be_truthy end end context 'with cookie authentication' do subject { JIRA::Client.new(username: 'foo', password: 'bar', auth_type: :cookie) } let(:session_cookie) { '6E3487971234567896704A9EB4AE501F' } let(:session_body) do { 'session': {'name' => "JSESSIONID", 'value' => session_cookie }, 'loginInfo': {'failedLoginCount' => 1, 'loginCount' => 2, 'lastFailedLoginTime' => (DateTime.now - 2).iso8601, 'previousLoginTime' => (DateTime.now - 5).iso8601 } } end before(:each) do # General case of API call with no authentication, or wrong authentication stub_request(:post, 'https://localhost:2990/jira/rest/auth/1/session'). to_return(status: 401, headers: {} ) # Now special case of API with correct authentication. This gets checked first by RSpec. stub_request(:post, 'https://localhost:2990/jira/rest/auth/1/session') .with(body: '{"username":"foo","password":"bar"}') .to_return(status: 200, body: session_body.to_json, headers: { 'Set-Cookie': "JSESSIONID=#{session_cookie}; Path=/; HttpOnly"}) stub_request(:get, 'https://localhost:2990/jira/rest/api/2/project') .with(headers: { cookie: "JSESSIONID=#{session_cookie}" } ) .to_return(status: 200, body: '[]', headers: {} ) end include_examples 'Client Common Tests' include_examples 'HttpClient tests' specify { expect(subject.request_client).to be_a JIRA::HttpClient } it 'authenticates with a correct username and password' do expect(subject).to be_authenticated expect(subject.Project.all).to be_empty end it 'does not authenticate with an incorrect username and password' do bad_client = JIRA::Client.new(username: 'foo', password: 'bad_password', auth_type: :cookie) expect(bad_client).not_to be_authenticated end it 'destroys the username and password once authenticated' do expect(subject.options[:username]).to be_nil expect(subject.options[:password]).to be_nil end end context 'oath2 authentication' do subject { JIRA::Client.new(consumer_key: 'foo', consumer_secret: 'bar') } include_examples 'Client Common Tests' specify { expect(subject.request_client).to be_a JIRA::OauthClient } it 'allows setting an access token' do token = double expect(OAuth::AccessToken).to receive(:new).with(subject.consumer, 'foo', 'bar').and_return(token) expect(subject.authenticated?).to be_falsey access_token = subject.set_access_token('foo', 'bar') expect(access_token).to eq(token) expect(subject.access_token).to eq(token) expect(subject.authenticated?).to be_truthy end it 'allows initializing the access token' do request_token = OAuth::RequestToken.new(subject.consumer) allow(subject.consumer).to receive(:get_request_token).and_return(request_token) mock_access_token = double expect(request_token).to receive(:get_access_token).with(:oauth_verifier => 'abc123').and_return(mock_access_token) subject.init_access_token(:oauth_verifier => 'abc123') expect(subject.access_token).to eq(mock_access_token) end specify 'that has specific default options' do [:signature_method, :private_key_file].each do |key| expect(subject.options[key]).to eq(JIRA::Client::DEFAULT_OPTIONS[key]) end end describe 'that call a oauth client' do specify 'which makes a request' do [:delete, :get, :head].each do |method| expect(subject.request_client).to receive(:make_request).with(method, '/path', nil, headers).and_return(successful_response) subject.send(method, '/path', {}) end [:post, :put].each do |method| expect(subject.request_client).to receive(:make_request).with(method, '/path', '', merged_headers).and_return(successful_response) subject.send(method, '/path', '', {}) end end end end end jira-ruby-1.4.3/spec/jira/request_client_spec.rb 0000644 0000041 0000041 00000000675 13167661427 021744 0 ustar www-data www-data require 'spec_helper' describe JIRA::RequestClient do it "raises an exception for non success responses" do response = double() allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(false) rc = JIRA::RequestClient.new expect(rc).to receive(:make_request).with(:get, '/foo', '', {}).and_return(response) expect { rc.request(:get, '/foo', '', {}) }.to raise_exception(JIRA::HTTPError) end end jira-ruby-1.4.3/spec/jira/base_spec.rb 0000644 0000041 0000041 00000052625 13167661427 017632 0 ustar www-data www-data require 'spec_helper' describe JIRA::Base do class JIRADelegation < SimpleDelegator # :nodoc: end class JIRA::Resource::Deadbeef < JIRA::Base # :nodoc: end class JIRA::Resource::HasOneExample < JIRA::Base # :nodoc: has_one :deadbeef has_one :muffin, :class => JIRA::Resource::Deadbeef has_one :brunchmuffin, :class => JIRA::Resource::Deadbeef, :nested_under => 'nested' has_one :breakfastscone, :class => JIRA::Resource::Deadbeef, :nested_under => ['nested','breakfastscone'] has_one :irregularly_named_thing, :class => JIRA::Resource::Deadbeef, :attribute_key => 'irregularlyNamedThing' end class JIRA::Resource::HasManyExample < JIRA::Base # :nodoc: has_many :deadbeefs has_many :brunchmuffins, :class => JIRA::Resource::Deadbeef, :nested_under => 'nested' has_many :breakfastscones, :class => JIRA::Resource::Deadbeef, :nested_under => ['nested','breakfastscone'] has_many :irregularly_named_things, :class => JIRA::Resource::Deadbeef, :attribute_key => 'irregularlyNamedThings' end let(:client) { double("client") } let(:attrs) { Hash.new } subject { JIRA::Resource::Deadbeef.new(client, :attrs => attrs) } let(:decorated) { JIRADelegation.new(subject) } describe "#respond_to?" do describe "when decorated using SimpleDelegator" do it "responds to client" do expect(decorated.respond_to?(:client)).to eq(true) end it "does not raise an error" do expect { decorated.respond_to?(:client) }.not_to raise_error end end end it "assigns the client and attrs" do expect(subject.client).to eq(client) expect(subject.attrs).to eq(attrs) end it "returns all the deadbeefs" do response = double() expect(response).to receive(:body).and_return('[{"self":"http://deadbeef/","id":"98765"}]') expect(client).to receive(:get).with('/jira/rest/api/2/deadbeef').and_return(response) expect(JIRA::Resource::Deadbeef).to receive(:collection_path).and_return('/jira/rest/api/2/deadbeef') deadbeefs = JIRA::Resource::Deadbeef.all(client) expect(deadbeefs.length).to eq(1) first = deadbeefs.first expect(first.class).to eq(JIRA::Resource::Deadbeef) expect(first.attrs['self']).to eq('http://deadbeef/') expect(first.attrs['id']).to eq('98765') expect(first.expanded?).to be_falsey end it "finds a deadbeef by id" do response = instance_double("Response", body: '{"self":"http://deadbeef/","id":"98765"}') expect(client).to receive(:get).with('/jira/rest/api/2/deadbeef/98765').and_return(response) expect(JIRA::Resource::Deadbeef).to receive(:collection_path).and_return('/jira/rest/api/2/deadbeef') deadbeef = JIRA::Resource::Deadbeef.find(client, '98765') expect(deadbeef.client).to eq(client) expect(deadbeef.attrs['self']).to eq('http://deadbeef/') expect(deadbeef.attrs['id']).to eq('98765') expect(deadbeef.expanded?).to be_truthy end it "finds a deadbeef containing changelog by id" do response = instance_double( "Response", body: '{"self":"http://deadbeef/","id":"98765","changelog":{"histories":[]}}' ) expect(client).to receive(:get).with('/jira/rest/api/2/deadbeef/98765?expand=changelog').and_return(response) expect(JIRA::Resource::Deadbeef).to receive(:collection_path).and_return('/jira/rest/api/2/deadbeef') deadbeef = JIRA::Resource::Deadbeef.find(client, '98765', {expand:'changelog'}) expect(deadbeef.client).to eq(client) expect(deadbeef.attrs['self']).to eq('http://deadbeef/') expect(deadbeef.attrs['id']).to eq('98765') expect(deadbeef.expanded?).to be_truthy expect(deadbeef.attrs['changelog']['histories']).to eq([]) end it "builds a deadbeef" do deadbeef = JIRA::Resource::Deadbeef.build(client, 'id' => "98765" ) expect(deadbeef.expanded?).to be_falsey expect(deadbeef.client).to eq(client) expect(deadbeef.attrs['id']).to eq('98765') end it "returns the endpoint name" do expect(subject.class.endpoint_name).to eq('deadbeef') end it "returns the path_component" do attrs['id'] = '123' expect(subject.path_component).to eq('/deadbeef/123') end it "returns the path component for unsaved instances" do expect(subject.path_component).to eq('/deadbeef') end it "converts to a symbol" do expect(subject.to_sym).to eq(:deadbeef) end describe "collection_path" do before(:each) do expect(client).to receive(:options).and_return(:rest_base_path => '/deadbeef/bar') end it "returns the collection_path" do expect(subject.collection_path).to eq('/deadbeef/bar/deadbeef') end it "returns the collection_path with a prefix" do expect(subject.collection_path('/baz/')).to eq('/deadbeef/bar/baz/deadbeef') end it "has a class method that returns the collection_path" do expect(subject.class.collection_path(client)).to eq('/deadbeef/bar/deadbeef') end end it "parses json" do expect(described_class.parse_json('{"foo":"bar"}')).to eq({"foo" => "bar"}) end describe "dynamic instance methods" do let(:attrs) { {'foo' => 'bar', 'flum' => 'goo', 'object_id' => 'dummy'} } subject { JIRA::Resource::Deadbeef.new(client, :attrs => attrs) } it "responds to each of the top level attribute names" do expect(subject).to respond_to(:foo) expect(subject).to respond_to('flum') expect(subject).to respond_to(:object_id) expect(subject.foo).to eq('bar') expect(subject.flum).to eq('goo') # Should not override existing method names, but should still allow # access to their values via the attrs[] hash expect(subject.object_id).not_to eq('dummy') expect(subject.attrs['object_id']).to eq('dummy') end end describe "fetch" do subject { JIRA::Resource::Deadbeef.new(client, :attrs => {'id' => '98765'}) } describe "not cached" do before(:each) do response = instance_double("Response", body: '{"self":"http://deadbeef/","id":"98765"}') expect(client).to receive(:get).with('/jira/rest/api/2/deadbeef/98765').and_return(response) expect(JIRA::Resource::Deadbeef).to receive(:collection_path).and_return('/jira/rest/api/2/deadbeef') end it "sets expanded to true after fetch" do expect(subject.expanded?).to be_falsey subject.fetch expect(subject.expanded?).to be_truthy end it "performs a fetch" do expect(subject.expanded?).to be_falsey subject.fetch expect(subject.self).to eq("http://deadbeef/") expect(subject.id).to eq("98765") end it "performs a fetch if already fetched and force flag is true" do subject.expanded = true subject.fetch(true) end end describe "cached" do it "doesn't perform a fetch if already fetched" do subject.expanded = true expect(client).not_to receive(:get) subject.fetch end end context "with expand parameter 'changelog'" do it "fetchs changelogs '" do response = instance_double( "Response", body: '{"self":"http://deadbeef/","id":"98765","changelog":{"histories":[]}}' ) expect(client).to receive(:get).with('/jira/rest/api/2/deadbeef/98765?expand=changelog').and_return(response) expect(JIRA::Resource::Deadbeef).to receive(:collection_path).and_return('/jira/rest/api/2/deadbeef') subject.fetch(false, {expand:'changelog'}) expect(subject.self).to eq("http://deadbeef/") expect(subject.id).to eq("98765") expect(subject.changelog['histories']).to eq([]) end end end describe "save" do let(:response) { double() } subject { JIRA::Resource::Deadbeef.new(client) } before(:each) do expect(subject).to receive(:url).and_return('/foo/bar') end it "POSTs a new record" do response = instance_double("Response", body: '{"id":"123"}') allow(subject).to receive(:new_record?) { true } expect(client).to receive(:post).with('/foo/bar','{"foo":"bar"}').and_return(response) expect(subject.save("foo" => "bar")).to be_truthy expect(subject.id).to eq("123") expect(subject.expanded).to be_falsey end it "PUTs an existing record" do response = instance_double("Response", body: nil) allow(subject).to receive(:new_record?) { false } expect(client).to receive(:put).with('/foo/bar','{"foo":"bar"}').and_return(response) expect(subject.save("foo" => "bar")).to be_truthy expect(subject.expanded).to be_falsey end it "merges attrs on save" do response = instance_double("Response", body: nil) expect(client).to receive(:post).with('/foo/bar','{"foo":{"fum":"dum"}}').and_return(response) subject.attrs = {"foo" => {"bar" => "baz"}} subject.save({"foo" => {"fum" => "dum"}}) expect(subject.foo).to eq({"bar" => "baz", "fum" => "dum"}) end it "returns false when an invalid field is set" do # The JIRA REST API apparently ignores fields that you aren't allowed to set manually response = instance_double("Response", body: '{"errorMessages":["blah"]}', status: 400) allow(subject).to receive(:new_record?) { false } expect(client).to receive(:put).with('/foo/bar','{"invalid_field":"foobar"}').and_raise(JIRA::HTTPError.new(response)) expect(subject.save("invalid_field" => "foobar")).to be_falsey end it "returns false with exception details when non json response body (unauthorized)" do # Unauthorized requests return a non-json body. This makes sure we can handle non-json bodies on HTTPError response = double("Response", body: 'totally invalid json', code: 401, message: "Unauthorized") expect(client).to receive(:post).with('/foo/bar','{"foo":"bar"}').and_raise(JIRA::HTTPError.new(response)) expect(subject.save("foo" => "bar")).to be_falsey expect(subject.attrs["exception"]["code"]).to eq(401) expect(subject.attrs["exception"]["message"]).to eq("Unauthorized") end end describe "save!" do let(:response) { double() } subject { JIRA::Resource::Deadbeef.new(client) } before(:each) do expect(subject).to receive(:url).and_return('/foo/bar') end it "POSTs a new record" do response = instance_double("Response", body: '{"id":"123"}') allow(subject).to receive(:new_record?) { true } expect(client).to receive(:post).with('/foo/bar','{"foo":"bar"}').and_return(response) expect(subject.save!("foo" => "bar")).to be_truthy expect(subject.id).to eq("123") expect(subject.expanded).to be_falsey end it "PUTs an existing record" do response = instance_double("Response", body: nil) allow(subject).to receive(:new_record?) { false } expect(client).to receive(:put).with('/foo/bar','{"foo":"bar"}').and_return(response) expect(subject.save!("foo" => "bar")).to be_truthy expect(subject.expanded).to be_falsey end it "throws an exception when an invalid field is set" do response = instance_double("Response", body: '{"errorMessages":["blah"]}', status: 400) allow(subject).to receive(:new_record?) { false } expect(client).to receive(:put).with('/foo/bar','{"invalid_field":"foobar"}').and_raise(JIRA::HTTPError.new(response)) expect(lambda{ subject.save!("invalid_field" => "foobar") }).to raise_error(JIRA::HTTPError) end end describe "set_attrs" do it "merges hashes correctly when clobber is true (default)" do subject.attrs = {"foo" => {"bar" => "baz"}} subject.set_attrs({"foo" => {"fum" => "dum"}}) expect(subject.foo).to eq({"fum" => "dum"}) end it "merges hashes correctly when clobber is false" do subject.attrs = {"foo" => {"bar" => "baz"}} subject.set_attrs({"foo" => {"fum" => "dum"}}, false) expect(subject.foo).to eq({"bar" => "baz", "fum" => "dum"}) end end describe "delete" do before(:each) do expect(client).to receive(:delete).with('/foo/bar') allow(subject).to receive(:url) { '/foo/bar' } end it "flags itself as deleted" do expect(subject.deleted?).to be_falsey subject.delete expect(subject.deleted?).to be_truthy end it "sends a DELETE request" do subject.delete end end describe "new_record?" do it "returns true for new_record? when new object" do subject.attrs['id'] = nil expect(subject.new_record?).to be_truthy end it "returns false for new_record? when id is set" do subject.attrs['id'] = '123' expect(subject.new_record?).to be_falsey end end describe "has_errors?" do it "returns true when the response contains errors" do attrs["errors"] = {"invalid" => "Field invalid"} expect(subject.has_errors?).to be_truthy end it "returns false when the response does not contain any errors" do expect(subject.has_errors?).to be_falsey end end describe 'url' do before(:each) do allow(client).to receive(:options) { {:rest_base_path => '/foo/bar'} } end it "returns self as the URL if set" do attrs['self'] = 'http://foo/bar' expect(subject.url).to eq("http://foo/bar") end it "generates the URL from id if self not set" do attrs['self'] = nil attrs['id'] = '98765' expect(subject.url).to eq("/foo/bar/deadbeef/98765") end it "generates the URL from collection_path if self and id not set" do attrs['self'] = nil attrs['id'] = nil expect(subject.url).to eq("/foo/bar/deadbeef") end it "has a class method for the collection path" do expect(JIRA::Resource::Deadbeef.collection_path(client)).to eq("/foo/bar/deadbeef") #Should accept an optional prefix (flum in this case) expect(JIRA::Resource::Deadbeef.collection_path(client, '/flum/')).to eq("/foo/bar/flum/deadbeef") end it "has a class method for the singular path" do expect(JIRA::Resource::Deadbeef.singular_path(client, 'abc123')).to eq("/foo/bar/deadbeef/abc123") #Should accept an optional prefix (flum in this case) expect(JIRA::Resource::Deadbeef.singular_path(client, 'abc123', '/flum/')).to eq("/foo/bar/flum/deadbeef/abc123") end end it "returns the formatted attrs from to_s" do subject.attrs['foo'] = 'bar' subject.attrs['dead'] = 'beef' expect(subject.to_s).to match(/#