Module: Artisan::Query

Defined in:
lib/artisan/query.rb

Defined Under Namespace

Modules: Validation

Class Method Summary collapse

Class Method Details

.get_project(key, address = 'artisan.8thlight.com') ⇒ Object



5
6
7
8
9
# File 'lib/artisan/query.rb', line 5

def self.get_project(key, address = 'artisan.8thlight.com')
  response = HTTParty.get 'http://' + address + '/api/projects', :headers => {'accept' => 'application/json'}, :query => {'key' => key}
  Validation.validate_response response.code
  return response.body
end

.update_estimates(key, story, address = 'artisan.8thlight.com') ⇒ Object



11
12
13
14
15
# File 'lib/artisan/query.rb', line 11

def self.update_estimates(key, story, address = 'artisan.8thlight.com')
  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
end