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, path, 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

- (CaptureRequest) initialize(url, options = {})

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)

    タグ

  • :useragent (String)

    ユーザエージェント



22
23
24
25
26
27
28
29
30
31
# File 'lib/mushikago/tombo/capture_request.rb', line 22

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.useragent = options[:useragent] if options.has_key?(:useragent)
  @headers['Content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'
end

Instance Method Details

- (Object) path



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

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