Test deploy of first_party_farmware resource. CC: @connorRigby

pull/1369/head
Rick Carlino 2019-08-14 11:37:44 -05:00
parent 0026ccc5a3
commit bff47bef86
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,32 @@
module Api
class FirstPartyFarmwareController < Api::AbstractController
UPDATED_AT = Date.parse("2019-08-06T18:31:28.099Z")
STUBS = {
"take-photo" => "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/packages/take-photo/manifest_v2.json",
"camera-calibration" => "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/packages/camera-calibration/manifest_v2.json",
"plant-detection" => "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/packages/plant-detection/manifest_v2.json",
"historical-camera-calibration" => "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/packages/historical-camera-calibration/manifest_v2.json",
"historical-plant-detection" => "https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests/master/packages/historical-plant-detection/manifest_v2.json",
}
.to_a
.each_with_index
.map do |(package, url), id|
{
id: (id + 1).to_s,
created_at: UPDATED_AT,
updated_at: UPDATED_AT,
url: url,
package: package,
package_error: nil,
}.with_indifferent_access
end.index_by { |x| x.fetch(:id) }
def index
render json: STUBS
end
def show
render json: STUBS.fetch(params[:id])
end
end
end

View File

@ -11,6 +11,7 @@ FarmBot::Application.routes.draw do
diagnostic_dumps: [:create, :destroy, :index],
farm_events: [:create, :destroy, :index, :show, :update],
farmware_envs: [:create, :destroy, :index, :show, :update],
first_party_farmwares: [:show, :index],
global_bulletins: [:show],
images: [:create, :destroy, :index, :show],
password_resets: [:create, :update],