Module: ActiveMerchant::PostsData

Included in:
Billing::Gateway
Defined in:
lib/active_merchant/posts_data.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_merchant/posts_data.rb', line 4

def self.included(base)
  base.class_attribute :ssl_strict
  base.ssl_strict = true

  base.class_attribute :ssl_version
  base.ssl_version = nil

  base.class_attribute :retry_safe
  base.retry_safe = false

  base.class_attribute :open_timeout
  base.open_timeout = Connection::OPEN_TIMEOUT

  base.class_attribute :read_timeout
  base.read_timeout = Connection::READ_TIMEOUT

  base.class_attribute :max_retries
  base.max_retries = Connection::MAX_RETRIES

  base.class_attribute :logger
  base.class_attribute :wiredump_device

  base.class_attribute :proxy_address
  base.class_attribute :proxy_port
end

Instance Method Details

#raw_ssl_request(method, endpoint, data, headers = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/active_merchant/posts_data.rb', line 42

def raw_ssl_request(method, endpoint, data, headers = {})
  logger.warn "#{self.class} using ssl_strict=false, which is insecure" if logger unless ssl_strict
  logger.warn "#{self.class} posting to plaintext endpoint, which is insecure" if logger unless endpoint.to_s =~ /^https:/

  connection = new_connection(endpoint)
  connection.open_timeout = open_timeout
  connection.read_timeout = read_timeout
  connection.retry_safe   = retry_safe
  connection.verify_peer  = ssl_strict
  connection.ssl_version  = ssl_version
  connection.logger       = logger
  connection.max_retries  = max_retries
  connection.tag          = self.class.name
  connection.wiredump_device = wiredump_device

  connection.pem          = @options[:pem] if @options
  connection.pem_password = @options[:pem_password] if @options

  connection.ignore_http_status = @options[:ignore_http_status] if @options

  connection.proxy_address = proxy_address
  connection.proxy_port    = proxy_port

  connection.request(method, data, headers)
end

#ssl_get(endpoint, headers = {}) ⇒ Object



30
31
32
# File 'lib/active_merchant/posts_data.rb', line 30

def ssl_get(endpoint, headers={})
  ssl_request(:get, endpoint, nil, headers)
end

#ssl_post(endpoint, data, headers = {}) ⇒ Object



34
35
36
# File 'lib/active_merchant/posts_data.rb', line 34

def ssl_post(endpoint, data, headers = {})
  ssl_request(:post, endpoint, data, headers)
end

#ssl_request(method, endpoint, data, headers) ⇒ Object



38
39
40
# File 'lib/active_merchant/posts_data.rb', line 38

def ssl_request(method, endpoint, data, headers)
  handle_response(raw_ssl_request(method, endpoint, data, headers))
end