Class: PostageApp::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/postageapp/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



56
57
58
59
60
61
62
63
64
# File 'lib/postageapp/configuration.rb', line 56

def initialize
  @secure             = true
  @host               = 'api.postageapp.com'
  @http_open_timeout  = 5
  @http_read_timeout  = 10
  @requests_to_resend = %w( send_message )
  @framework          = 'undefined framework'
  @environment        = 'production'
end

Instance Attribute Details

#environmentObject

Environment gem is running in



51
52
53
# File 'lib/postageapp/configuration.rb', line 51

def environment
  @environment
end

#frameworkObject

The framework PostageApp gem runs in



48
49
50
# File 'lib/postageapp/configuration.rb', line 48

def framework
  @framework
end

#hostObject

The host to connect to (default: ‘api.postageapp.com’)



11
12
13
# File 'lib/postageapp/configuration.rb', line 11

def host
  @host
end

#http_open_timeoutObject

The HTTP open timeout in seconds (defaults to 2).



30
31
32
# File 'lib/postageapp/configuration.rb', line 30

def http_open_timeout
  @http_open_timeout
end

#http_read_timeoutObject

The HTTP read timeout in seconds (defaults to 5).



33
34
35
# File 'lib/postageapp/configuration.rb', line 33

def http_read_timeout
  @http_read_timeout
end

#loggerObject

The logger used by this gem



54
55
56
# File 'lib/postageapp/configuration.rb', line 54

def logger
  @logger
end

#portObject

The port on which PostageApp service runs (default: 443 for secure, 80 for insecure connections)



15
16
17
# File 'lib/postageapp/configuration.rb', line 15

def port
  @port
end

#project_rootObject

The file path of the project. This is where logs and failed requests can be stored



45
46
47
# File 'lib/postageapp/configuration.rb', line 45

def project_root
  @project_root
end

#protocolObject

The protocol used to connect to the service (default: ‘https’ for secure and ‘http’ for insecure connections)



8
9
10
# File 'lib/postageapp/configuration.rb', line 8

def protocol
  @protocol
end

#proxy_hostObject

The hostname of the proxy server (if using a proxy)



18
19
20
# File 'lib/postageapp/configuration.rb', line 18

def proxy_host
  @proxy_host
end

#proxy_passObject

The password for the proxy server (if using proxy)



27
28
29
# File 'lib/postageapp/configuration.rb', line 27

def proxy_pass
  @proxy_pass
end

#proxy_portObject

The port of the proxy server (if using proxy)



21
22
23
# File 'lib/postageapp/configuration.rb', line 21

def proxy_port
  @proxy_port
end

#proxy_userObject

The username for the proxy server (if using proxy)



24
25
26
# File 'lib/postageapp/configuration.rb', line 24

def proxy_user
  @proxy_user
end

#recipient_overrideObject

The email address that all send_message method should address all messages while overriding original addresses



37
38
39
# File 'lib/postageapp/configuration.rb', line 37

def recipient_override
  @recipient_override
end

#requests_to_resendObject

A list of API method names payloads of which are captured and resent in case of service unavailability



41
42
43
# File 'lib/postageapp/configuration.rb', line 41

def requests_to_resend
  @requests_to_resend
end

#secureObject Also known as: secure?

true for https, false for http connections (default: is true)



4
5
6
# File 'lib/postageapp/configuration.rb', line 4

def secure
  @secure
end

Instance Method Details

#api_keyObject



72
73
74
# File 'lib/postageapp/configuration.rb', line 72

def api_key
  @api_key || ENV['POSTAGEAPP_API_KEY']
end

#api_key=(key) ⇒ Object



68
69
70
# File 'lib/postageapp/configuration.rb', line 68

def api_key=(key)
  @api_key = key
end

#urlObject



92
93
94
# File 'lib/postageapp/configuration.rb', line 92

def url
  "#{self.protocol}://#{self.host}:#{self.port}"
end