Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 67 lines (57 sloc) 1.821 kb
0f2e8f98 »
2011-12-08 Clean up OAuth code
1 require 'pp'
1798ce29 »
2011-12-12 Renamed all references from JiraRuby to Jira
2 require './lib/jira'
0f2e8f98 »
2011-12-08 Clean up OAuth code
3
4 options = {
ca3b70f4 »
2011-12-09 Cleaned tasks, certs & keys now named consistently
5 :private_key_file => "rsakey.pem"
0f2e8f98 »
2011-12-08 Clean up OAuth code
6 }
7
8 CONSUMER_KEY = 'test'
9
c8c6a517 »
2011-12-19 Jira -> JIRA
10 client = JIRA::Client.new(CONSUMER_KEY, '', options)
0f2e8f98 »
2011-12-08 Clean up OAuth code
11
fc1873ba »
2011-12-12 Allow passing access token details to example.rb
12 if ARGV.length == 0
13 # If not passed any command line arguments, open a browser and prompt the
14 # user for the OAuth verifier.
15 request_token = client.request_token
16 puts "Opening #{request_token.authorize_url}"
17 system "open #{request_token.authorize_url}"
18
19 puts "Enter the oauth_verifier: "
20 oauth_verifier = gets.strip
21
22 access_token = client.init_access_token(:oauth_verifier => oauth_verifier)
23 puts "Access token: #{access_token.token} secret: #{access_token.secret}"
24 elsif ARGV.length == 2
25 # Otherwise assume the arguments are a previous access token and secret.
26 access_token = client.set_access_token(ARGV[0], ARGV[1])
27 else
28 # Script must be passed 0 or 2 arguments
29 raise "Usage: #{$0} [ token secret ]"
30 end
0f2e8f98 »
2011-12-08 Clean up OAuth code
31
9492af8b »
2011-12-12 Update example script
32 # Show all projects
33 projects = client.Project.all
5f300f4e »
2011-12-12 Create proxy instance methods to JSON attr hash.
34
35 projects.each do |project|
36 puts "Project -> key: #{project.key}, name: #{project.name}"
37 end
7fcac028 »
2011-12-14 Tests for DELETE /issue/{key}
38 issue = client.Issue.find('SAMPLEPROJECT-1')
b68b3ce0 »
2011-12-13 Implement basic Issue endpoint
39 pp issue
0f2e8f98 »
2011-12-08 Clean up OAuth code
40
9492af8b »
2011-12-12 Update example script
41 # # Find a specific project by key
7fcac028 »
2011-12-14 Tests for DELETE /issue/{key}
42 # # ------------------------------
9492af8b »
2011-12-12 Update example script
43 # project = client.Project.find('SAMPLEPROJECT')
44 # pp project
7fcac028 »
2011-12-14 Tests for DELETE /issue/{key}
45 #
46 # # Delete an issue
47 # # ---------------
48 # issue = client.Issue.find('SAMPLEPROJECT-2')
49 # if issue.delete
50 # puts "Delete of issue SAMPLEPROJECT-2 sucessful"
51 # else
52 # puts "Delete of issue SAMPLEPROJECT-2 failed"
53 # end
8d0b8380 »
2011-12-14 Implement Jira::Resource::Base#save (HTTP POST)
54 #
55 # # Create an issue
56 # # ---------------
57 # issue = client.Issue.build
e3c2805c »
2011-12-15 Require attrs on Jira::Resource::Base#save
58 # issue.save({"fields"=>{"summary"=>"blarg from in example.rb","project"=>{"id"=>"10001"},"issuetype"=>{"id"=>"3"}}})
8d0b8380 »
2011-12-14 Implement Jira::Resource::Base#save (HTTP POST)
59 # issue.fetch
60 # pp issue
e3c2805c »
2011-12-15 Require attrs on Jira::Resource::Base#save
61 #
62 # Update an issue
63 # ---------------
64 # issue = client.Issue.find("10002")
65 # issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}})
d1829692 »
2011-12-14 Extract JSON parsing into separate method.
66 # pp issue
Something went wrong with that request. Please try again.