Class: Net::Session
Instance Attribute Summary (collapse)
-
- (Object) authorization
readonly
Returns the value of attribute authorization.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) authorize(options)
Sets the Basic authentication data to be used in all requests.
-
- (Object) header(field, value)
Sets a key/value pair header to be used in all requests in this session.
-
- (Hash) headers
Returns a hash containing key/value pairs of headers.
-
- (Session) initialize(base_url, &block)
constructor
A new instance of Session.
Constructor Details
- (Session) initialize(base_url, &block)
Returns a new instance of Session
5 6 7 8 9 10 |
# File 'flow/net/session.rb', line 5 def initialize(base_url, &block) @base_url = base_url @authorization = false @headers = [] self.instance_eval(&block) end |
Instance Attribute Details
- (Object) authorization (readonly)
Returns the value of attribute authorization
3 4 5 |
# File 'flow/net/session.rb', line 3 def @authorization end |
Class Method Details
+ (Object) build(base_url, &block)
12 13 14 |
# File 'flow/net/session.rb', line 12 def self.build(base_url, &block) new(base_url, &block) end |
Instance Method Details
- (Object) authorize(options)
Sets the Basic authentication data to be used in all requests
49 50 51 |
# File 'flow/net/session.rb', line 49 def () @authorization = Authorization.new() end |
- (Object) header(field, value)
Sets a key/value pair header to be used in all requests in this session
29 30 31 |
# File 'flow/net/session.rb', line 29 def header(field, value) @headers << Header.new(field, value) end |
- (Hash) headers
Returns a hash containing key/value pairs of headers
38 39 40 41 42 |
# File 'flow/net/session.rb', line 38 def headers hash = {} @headers.map {|header| hash[header.field] = header.value} hash end |