class BBS2ch::Connection

Attributes

conn[RW]

Public Class Methods

new(url) click to toggle source
# File lib/bbs2ch/connection.rb, line 3
def initialize(url)
  @conn = Faraday.new(url: url) do |faraday|
    # faraday.request  :url_encoded             # form-encode POST params
    # faraday.response :logger                  # log requests to STDOUT
    faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
  end

  @conn.headers[:user_agent] = 'Monazilla/1.00 (bbs2ch-rubygems/0.1.0)'
end

Public Instance Methods

response_body() click to toggle source
# File lib/bbs2ch/connection.rb, line 15
def response_body
  @conn.get.body.toutf8
end