[refs #374] Add publish_without_qa field, fix some specs, update docs for auth

This commit is contained in:
konstantin.grabar 2012-09-21 18:30:40 +04:00
parent a87662f1b0
commit 5bcebcf384
6 changed files with 23 additions and 8 deletions

View File

@ -54,6 +54,11 @@ Request without authorization will return error message:
<%= json(:error_auth) %>
<br/>
But if you set wrong pass or email you will receive this:
<%= json(:error_wrong_pass) %>
<br/>
Rate limit exceed will return this:
<%= json(:error_rate_limit) %>
@ -103,7 +108,11 @@ DELETE
## Authentication
Sory, where is no authentication at the moment :(
We use *http auth basic* for authentification:
<pre class="terminal">
$ curl --user myuser@gmail.com:mypass -i https://abf.rosalinux.ru/api/v1
</pre>
## Pagination

View File

@ -399,6 +399,10 @@ module GitHub
"error" => "You need to sign in or sign up before continuing."
}
ERROR_WRONG_PASS = {
"error" => "Invalid email or password."
}
ERROR_RATE_LIMIT = {
"message" => "403 Forbidden | Rate Limit Exceeded"
}
@ -525,6 +529,7 @@ module GitHub
"created_at" => "created at date and time",
"updated_at" => "updated at date and time",
"description" => "description",
"publish_without_qa" => "publication without QA",
"platform" => {
"id" => "platform id",
"name" => "platform name",
@ -540,6 +545,7 @@ module GitHub
{
"id" => 30,
"name" => "main",
"publish_without_qa" => true,
"platform" => {
"id" => 41,
"name" => "my_personal",

View File

@ -16,6 +16,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController
project = Project.find(params[:build_list][:project_id])
save_to_repository = Repository.find params[:build_list][:save_to_repository_id] #FIXME
params[:build_list][:save_to_platform_id] = save_to_repository.platform_id
params[:build_list][:auto_publish] = false unless save_to_repository.publish_without_qa?
build_list = project.build_lists.build(params[:build_list])
build_list.project_version = build_list.commit_hash

View File

@ -1,5 +1,5 @@
json.repository do |json|
json.(@repository, :id, :name, :description)
json.(@repository, :id, :name, :description, :publish_without_qa)
json.created_at @repository.created_at.to_i
json.updated_at @repository.updated_at.to_i
json.platform do |json_platform|

View File

@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20120914160741) do
t.integer "user_id", :null => false
t.string "kind"
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "advisories", :force => true do |t|
@ -327,11 +327,11 @@ ActiveRecord::Schema.define(:version => 20120914160741) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.string "srpm_content_type"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master"
t.boolean "is_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false
@ -409,7 +409,6 @@ ActiveRecord::Schema.define(:version => 20120914160741) do
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"

View File

@ -5,7 +5,7 @@ FactoryGirl.define do
#association :project
association :save_to_platform, :factory => :platform_with_repos
project { |bl| FactoryGirl.create(:project, :repositories => bl.save_to_platform.repositories) }
save_to_repository { |bl| bl.project.repositories.where(:id => bl.save_to_platform.repository_ids).first }
#save_to_repository { |bl| bl.project.repositories.where(:id => bl.save_to_platform.repository_ids).first }
association :arch
build_for_platform {|bl| bl.save_to_platform}
save_to_repository {|bl| bl.save_to_platform.repositories.first}