Class: Mushikago::Tombo::CaptureRequest

Inherits:
Http::PostRequest show all
Defined in:
lib/mushikago/tombo/capture_request.rb

Overview

キャプチャリクエスト

Instance Attribute Summary

Attributes inherited from Http::Request

#headers, #host, #params, #port

Instance Method Summary collapse

Methods inherited from Http::PostRequest

#http_method

Methods included from Auth::Signature

#add_signature!, #string_to_sign

Methods inherited from Http::Request

#[], #[]=, add_param, #to_http_request, #url_encoded_params

Constructor Details

#initialize(url, options = {}) ⇒ CaptureRequest

Returns a new instance of CaptureRequest.

Parameters:

  • url (String)

    キャプチャ対象のURL

  • options (Hash) (defaults to: {})

    リクエストのオプション

Options Hash (options):

  • :image_format('jpg') (String)

    画像のフォーマット(jpg,png)

  • :image_quality(80) (Integer)

    画像の品質(0-100)

  • :thumbnail(0) (Boolean)

    サムネイル取得フラグ(false:取得しない,true:取得する)

  • :tags (String, Array)

    タグ

  • :user_agent (String)

    ユーザエージェント

  • :delay_time (Integer)

    キャプチャまでの待ち時間

  • :display_width (Integer)

    仮想ブラウザの幅



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mushikago/tombo/capture_request.rb', line 26

def initialize url, options={}
  super(options)
  self.url = url
  self.image_format = options[:image_format] if options.has_key?(:image_format)
  self.image_quality = options[:image_quality] if options.has_key?(:image_quality)
  self.thumbnail = options[:thumbnail] if options.has_key?(:thumbnail)
  self.tags = options[:tags] if options.has_key?(:tags)
  self.user_agent = options[:user_agent] if options.has_key?(:user_agent)
  self.delay_time = options[:delay_time] if options.has_key?(:delay_time)
  self.display_width = options[:display_width] if options.has_key?(:display_width)
  @headers['Content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'
end

Instance Method Details

#pathObject



6
# File 'lib/mushikago/tombo/capture_request.rb', line 6

def path; '/1/tombo/capture' end