Sha256: 8daf85a769d5164994aa92312abde434db353a194863ef20a92c552299fcac1f
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module Mushikago module Tombo # キャプチャリクエスト class CaptureRequest < Request def method_name; 'capture.json' end add_param :url add_param :image_format add_param :image_quality do |v| v.to_i.to_s end add_param :thumbnail do |v| (v ? 1 : 0).to_s end add_param :tags do |v| [v].flatten.compact.join(',') end # @param [String] url キャプチャ対象のURL # @param [Hash] options リクエストのオプション # @option options [String] :image_format('jpg') 画像のフォーマット(jpg,png) # @option options [Integer] :image_quality(80) 画像の品質(0-100) # @option options [Boolean] :thumbnail(0) サムネイル取得フラグ(false:取得しない,true:取得する) # @option options [String,Array] :tags タグ 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) @headers['Content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' end # @private def new_http_request Net::HTTP::Post.new(path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mushikago-sdk-0.1.8 | lib/mushikago/tombo/capture_request.rb |
mushikago-sdk-0.1.7 | lib/mushikago/tombo/capture_request.rb |