Class: WebClient
- Defined in:
- lib/commercebank.rb,
lib/commerce-bank-client.rb
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #get(path, form = nil) ⇒ Object
-
#initialize ⇒ WebClient
constructor
A new instance of WebClient.
- #post(path, form = nil) ⇒ Object
Constructor Details
#initialize ⇒ WebClient
Returns a new instance of WebClient.
25 26 27 28 29 30 |
# File 'lib/commercebank.rb', line 25 def initialize = Hash.new @http = Net::HTTP.new('banking.commercebank.com', 443) @http.use_ssl = true @http.verify_mode = OpenSSL::SSL::VERIFY_NONE end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
23 24 25 |
# File 'lib/commercebank.rb', line 23 def end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
23 24 25 |
# File 'lib/commercebank.rb', line 23 def fields @fields end |
Instance Method Details
#get(path, form = nil) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/commercebank.rb', line 32 def get(path, form = nil) response = @http.get(path, header) (response) @fields = (form && get_form(response.body, form)) || Hash.new response end |
#post(path, form = nil) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/commercebank.rb', line 39 def post(path, form = nil) response = @http.post(path, @fields.to_url, header) (response) @fields = (form && get_form(response.body, form)) || Hash.new response end |