るりまサーチ

最速Rubyリファレンスマニュアル検索!
62件ヒット [1-62件を表示] (0.018秒)
トップページ > クエリ:body[x] > クエリ:fetch[x]

別のキーワード

  1. net/http body
  2. httprequest body
  3. net/http read_body
  4. httpresponse body
  5. httpresponse read_body

ライブラリ

クラス

キーワード

検索結果

Net::IMAP#fetch(set, attr) -> [Net::IMAP::FetchData] (18253.0)

FETCH コマンドを送り、メールボックス内のメッセージに 関するデータを取得します。

...
FETCH
コマンドを送り、メールボックス内のメッセージに
関するデータを取得します。

Net::IMAP#examine もしくは Net::IMAP#select で
指定したメールボックスを対象とします。

set で対象とするメッセージを指定します。
これには...
...ては Net::IMAP::FetchData#attr
を見てください。

例:

p imap.fetch(6..8, "UID")
#=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, #<Net::IMAP::FetchData seqno=7, attr={"UID"=>99}>, #<Net::IMAP::FetchData seqno=8, attr={"UID"=>100}>]
p imap.fetch(6, "BODY[HEADER.FIELDS (SUBJEC...
...T)]")
#=> [#<Net::IMAP::FetchData seqno=6, attr={"BODY[HEADER.FIELDS (SUBJECT)]"=>"Subject: test\r\n\r\n"}>]
data = imap.uid_fetch(98, ["RFC822.SIZE", "INTERNALDATE"])[0]
p data.seqno
#=> 6
p data.attr["RFC822.SIZE"]
#=> 611
p data.attr["INTERNALDATE"]
#=> "12-Oct-2000 22:40:59 +0900...

Net::IMAP::FetchData#attr -> { String => object } (3060.0)

各メッセージのアトリビュートの値をハッシュテーブルで返します。

...リビュートは以下の通りです。

: BODY
BODY
STRUCTURE の拡張データなしの形式。
Net::IMAP::BodyTypeBasic, Net::IMAP::BodyTypeText,
Net::IMAP::BodyTypeMessage, Net::IMAP::BodyTypeMultipart
のいずれか。
: BODY[<section>]<<partial>>
section で指定さ...
...の内容。文字列。
: BODY.PEEK[<section>]<<partial>>
section で指定されたセクションのメッセージボディの内容。文字列。
ただしこれで内容を見ても :Seen フラグを設定しない点が
BODY
[<section>]と同様
: BODYSTRUCTURE
MIME-IMB で...
...列。
: RFC822
BODY
[] と同じ。文字列。
: RFC822.HEADER
BODY
.PEEK[HEADER] と同じ。文字列。
: RFC822.SIZE
メッセージの 822 サイズ。整数。
: RFC822.TEXT
BODY
[TEXT] と同じ。文字列。
: UID
UID。整数。

詳しくは 2060 の FETCH command の...

net/http (54.0)

汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。

...tml')
}
puts res.body
//}

//emlist[例4: 上の例よりさらに汎用的な例][ruby]{
require 'net/http'

url = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
//}

==== フォ...
...{'q'=>'ruby', 'max'=>'50'})
puts res.body

#例2: 認証付きで POST する
res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'),
{'from'=>'2005-01-01', 'to'=>'2005-03-31'})
puts res.body

#例3: より細かく制御する
url = URI....
...==== リダイレクトに対応する
以下の例の fetch はリダイレクトに対応しています。
limit 回数以上リダイレクトしたらエラーにします。

//emlist[例][ruby]{
require 'net/http'
require 'uri'

def fetch(uri_str, limit = 10)
# You should choose better exc...

Data.define(*args) -> Class (42.0)

Data クラスに新しいサブクラスを作って、それを返します。

...Fetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)
fetch
er = HTTPFetcher.new
case fetch...
...er.get(url)
in HTTPFetcher::Response(body)
body

in HTTPFetcher::NotFound
:NotFound
end
end

p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジェクトのクラスを定義...

Data.define(*args) {|subclass| block } -> Class (42.0)

Data クラスに新しいサブクラスを作って、それを返します。

...Fetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)
fetch
er = HTTPFetcher.new
case fetch...
...er.get(url)
in HTTPFetcher::Response(body)
body

in HTTPFetcher::NotFound
:NotFound
end
end

p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジェクトのクラスを定義...

絞り込み条件を変える

net/imap (42.0)

このライブラリは Internet Message Access Protocol (IMAP) の クライアントライブラリです。2060 を元に 実装されています。

...imap.authenticate('LOGIN', 'joe_user', 'joes_password')
imap.examine('INBOX')
imap.search(["RECENT"]).each do |message_id|
envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
puts "#{envelope.from[0].name}: \t#{envelope.subject}"
end

2003年4月のメールをすべて...
...icate("cram-md5", "bar", "password")
imap.select("inbox")
fetch
_thread = Thread.start { imap.fetch(1..-1, "UID") }
search_result = imap.search(["BODY", "hello"])
fetch
_result = fetch_thread.value
imap.disconnect

とすると FETCH コマンドと SEARCH コマンドを並列に実行し...

NEWS for Ruby 2.5.0 (12.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...に更新しました。 13685

* Thread
* Thread#name= で設定した名前が Windows 10 で見えるようになりました
* Thread#fetch を追加 13009
* Thread.report_on_exception のデフォルト値がtrueになりました。
スレッドの終了時に捕捉して...
...cutive slashes to a single slash. 8352

* webrick
* Server Name Indication (SNI) サポートを追加 13729
* WEBrick::HTTPResponse#send_body_proc を追加 855
* RubyGem としてリリース 13173
* 意図しない振舞いを避けるため Kernel.#open を使用するのをや...