Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AlbumRequest
- REQUEST_HEADERS = {
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'User-Agent' => '...',
- 'Connection' => 'keep-alive',
- 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
- }
- OPTIONS = {
- timeout: 15,
- method: :post,
- headers: REQUEST_HEADERS
- }
- attr_reader :url
- def initailize(url)
- @url = url
- end
- def perform
- Typhoeus::Request.new(url, OPTIONS).run
- end
- end
- class SingleRequest
- REQUEST_HEADERS = {
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'User-Agent' => '...',
- 'Connection' => 'keep-alive',
- 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
- }
- OPTIONS = {
- timeout: 10,
- method: :get,
- headers: REQUEST_HEADERS
- }
- attr_reader :url
- def initialize(url)
- @url = url
- end
- def perform
- Typhoeus::Request.new(url, OPTIONS).run
- end
- end
Add Comment
Please, Sign In to add comment