Module: ActiveMerchant::PostsData

Included in:
Shipping::Carrier
Defined in:
lib/active_merchant/common/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
# File 'lib/active_merchant/common/posts_data.rb', line 4

def self.included(base)
  base.superclass_delegating_accessor :ssl_strict
  base.ssl_strict = true
  
  base.class_inheritable_accessor :retry_safe
  base.retry_safe = false

  base.superclass_delegating_accessor :open_timeout
  base.open_timeout = 60

  base.superclass_delegating_accessor :read_timeout
  base.read_timeout = 60
  
  base.superclass_delegating_accessor :logger
  base.superclass_delegating_accessor :wiredump_device
end

Instance Method Details

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



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/active_merchant/common/posts_data.rb', line 33

def raw_ssl_request(method, endpoint, data, headers = {})
  connection = Connection.new(endpoint)
  connection.open_timeout = open_timeout
  connection.read_timeout = read_timeout
  connection.retry_safe   = retry_safe
  connection.verify_peer  = ssl_strict
  connection.logger       = logger
  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.request(method, data, headers)
end

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



21
22
23
# File 'lib/active_merchant/common/posts_data.rb', line 21

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

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



25
26
27
# File 'lib/active_merchant/common/posts_data.rb', line 25

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

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



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

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