Class: Groupwise::PostOfficeAgent
- Inherits:
-
Object
- Object
- Groupwise::PostOfficeAgent
- Defined in:
- lib/groupwise/post_office_agent.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #free_busy(email_addresses, wait_time = 0, start_time = nil, end_time = nil) ⇒ Object
-
#initialize(endpoint, username, app_name, app_key) ⇒ PostOfficeAgent
constructor
A new instance of PostOfficeAgent.
- #logout ⇒ Object
- #version ⇒ Object
- #wsdl ⇒ Object
Constructor Details
#initialize(endpoint, username, app_name, app_key) ⇒ PostOfficeAgent
Returns a new instance of PostOfficeAgent.
5 6 7 8 9 |
# File 'lib/groupwise/post_office_agent.rb', line 5 def initialize(endpoint, username, app_name, app_key) @endpoint, @username, @app_name, @app_key = endpoint, username, app_name, app_key @client = Savon.client(wsdl: wsdl, endpoint: endpoint) login end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/groupwise/post_office_agent.rb', line 3 def client @client end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/groupwise/post_office_agent.rb', line 3 def endpoint @endpoint end |
Instance Method Details
#free_busy(email_addresses, wait_time = 0, start_time = nil, end_time = nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/groupwise/post_office_agent.rb', line 31 def free_busy(email_addresses, wait_time = 0, start_time = nil, end_time = nil) = { free_busy_session_id: free_busy_session(email_addresses, start_time, end_time) } sleep wait_time response = authenticated_request(:get_free_busy, )[:free_busy_info] end |
#logout ⇒ Object
25 26 27 28 29 |
# File 'lib/groupwise/post_office_agent.rb', line 25 def logout response = authenticated_request(:logout) @session = nil if response[:status][:code] == '0' return response end |
#version ⇒ Object
11 12 13 14 15 16 |
# File 'lib/groupwise/post_office_agent.rb', line 11 def version @version ||= begin body = HTTPI.get(HTTPI::Request.new(endpoint)).body version = body.match(/(?<=POA )([^\n\r]*)/).captures.first end end |
#wsdl ⇒ Object
18 19 20 21 22 23 |
# File 'lib/groupwise/post_office_agent.rb', line 18 def wsdl @wsdl ||= begin wsdl_version = Groupwise.wsdl_version(version) File.("../../../contrib/novell/GW#{wsdl_version}/groupwise.wsdl", __FILE__) end end |