Method: Viddler::Request#set
- Defined in:
- lib/viddler/request.rb
permalink #set(container, &declarations) ⇒ Object
Use this method to setup your request’s payload and headers.
Example:
request.set :headers do |h|
h.content_type = 'application/ufo'
end
request.set :params do |p|
p.sessionid = '12323'
p.api_key = '13123
end
45 46 47 48 49 |
# File 'lib/viddler/request.rb', line 45 def set(container, &declarations) struct = OpenStruct.new declarations.call(struct) send("#{container}=", struct.table) end |