Module: Artisan::Query
- Defined in:
- lib/artisan/query.rb
Defined Under Namespace
Modules: Validation
Class Method Summary collapse
- .authenticate(username, password, address) ⇒ Object
- .get_backlog_stories(key, address) ⇒ Object
- .get_iterations(key, address) ⇒ Object
- .get_project(key, address) ⇒ Object
- .get_signoff_pdf(key, iteration_id, address) ⇒ Object
- .get_stories(key, address) ⇒ Object
- .get_stories_by_iteration(key, iteration_number, address) ⇒ Object
- .update_estimates(key, story, address) ⇒ Object
Class Method Details
.authenticate(username, password, address) ⇒ Object
74 75 76 77 78 |
# File 'lib/artisan/query.rb', line 74 def self.authenticate(username, password, address) response = HTTParty.get 'http://' + address + '/api/auth/authenticate', :headers => {'accept' => 'application/json'}, :query => {'username' => username, 'password' => password} Validation.validate_response response.code return response.body end |
.get_backlog_stories(key, address) ⇒ Object
62 63 64 65 66 |
# File 'lib/artisan/query.rb', line 62 def self.get_backlog_stories(key, address) response = HTTParty.get 'http://' + address + '/api/projects/stories/backlog', :headers => {'accept' => 'application/json'}, :query => {'key' => key} Validation.validate_response response.code return response.body end |
.get_iterations(key, address) ⇒ Object
11 12 13 14 15 |
# File 'lib/artisan/query.rb', line 11 def self.get_iterations(key, address) response = HTTParty.get 'http://' + address + '/api/projects/iterations', :headers => {'accept' => 'application/json'}, :query => {'key' => key} Validation.validate_response response.code return response.body end |
.get_project(key, address) ⇒ Object
5 6 7 8 9 |
# File 'lib/artisan/query.rb', line 5 def self.get_project(key, address) response = HTTParty.get 'http://' + address + '/api/projects', :headers => {'accept' => 'application/json'}, :query => {'key' => key} Validation.validate_response response.code return response.body end |
.get_signoff_pdf(key, iteration_id, address) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/artisan/query.rb', line 17 def self.get_signoff_pdf(key, iteration_id, address) response = HTTParty.get( 'http://' + address + '/api/reports', :headers => { 'accept' => 'application/pdf' }, :query => { 'key' => key, 'options' => { 'iteration_id' => iteration_id, 'show_owner' => '1', 'sections' => { 'Completed' => '1', 'Features' => '1', 'Tasks' => '1', 'Untagged' => '0' } } } ) Validation.validate_response response.code return response.body end |
.get_stories(key, address) ⇒ Object
56 57 58 59 60 |
# File 'lib/artisan/query.rb', line 56 def self.get_stories(key, address) response = HTTParty.get 'http://' + address + '/api/projects/stories', :headers => {'accept' => 'application/json'}, :query => {'key' => key} Validation.validate_response response.code return response.body end |
.get_stories_by_iteration(key, iteration_number, address) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/artisan/query.rb', line 41 def self.get_stories_by_iteration(key, iteration_number, address) response = HTTParty.get( 'http://' + address + '/api/projects/iterations/stories', :headers => { 'accept' => 'application/json' }, :query => { 'key' => key, 'iteration_number' => iteration_number } ) Validation.validate_response response.code return response.body end |
.update_estimates(key, story, address) ⇒ Object
68 69 70 71 72 |
# File 'lib/artisan/query.rb', line 68 def self.update_estimates(key, story, address) response = HTTParty.put 'http://' + address + '/api/projects/stories/' + story.number.to_s + '/estimates', :query => {:key => key}, :headers => {'accept' => 'application/json', 'content-type' => 'application/json'}, :body => {"optimistic" => story.optimistic, "realistic" => story.realistic, "pessimistic" => story.pessimistic}.to_json Validation.validate_response response.code return response.body end |