Closed echan00 closed 4 years ago
Did you figure it out @echan00? For the next person.
I didn't figure out how to implement the do block syntax, but the one liner version that will do the same thing is below:
desc "Process an array of texts.", {
headers: {
"api_key" => {description: "API Key (provided)", required: true},
"api_secret" => {description: 'API Secret (provided)', required: true},
},
summary: 'Process texts',
detail: "Process an array of source texts by providing authentication details and source ID. \n
All texts must be encoded UTF-8",
failure: [ { code: 400, message: 'Invalid request.'}, { code: 401, message: 'Unauthorized. Invalid API key or secret.' } ],
success: {message: '-'}
}
params do
requires :text, type: Array[String], desc: 'Source Texts (array of strings)', documentation: { default: "Hello World" }
requires :src_id, type: Integer, desc: 'Source ID', documentation: { default: 3 }
end
I'd like to add header parameters to the endpoint below:
I see in the documentation this is how you do it with one line:
Since I have other information in the endpoint, how do I do this in a do block? I've been looking at this all day but can't figure out the correct syntax.