Class: Cleo::ConnectionServer
- Inherits:
-
Base
- Object
- Base
- Cleo::ConnectionServer
show all
- Defined in:
- lib/cleo/connection_server.rb
Class Method Summary
collapse
Methods inherited from Base
async?, auto_flush?, good_response_code?
Class Method Details
.execute_create(con) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/cleo/connection_server.rb', line 17
def self.execute_create(con)
obj = con.as_connection unless con.is_a?(Cleo::Xml::Connection)
return true if obj.blank?
uri = URI.parse Cleo::Service.connection_server_url + "_"
request = Net::HTTP::Post.new(uri.path)
request.body = obj.to_xml
request.content_type = 'application/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
return good_response_code?(response)
end
|
.execute_delete(con) ⇒ Object
41
42
43
|
# File 'lib/cleo/connection_server.rb', line 41
def self.execute_delete(con)
return self.execute_disable(con)
end
|
.execute_disable(con) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/cleo/connection_server.rb', line 32
def self.execute_disable(con)
sender = con.as_connection unless con.is_a?(Cleo::Xml::Connection)
return true if sender.blank?
sender.active = false
return self.execute_update(sender)
end
|
.execute_update(con) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/cleo/connection_server.rb', line 45
def self.execute_update(con)
sender = con.as_connection unless con.is_a?(Cleo::Xml::Connection)
return true if sender.blank?
uri = URI.parse Cleo::Service.connection_server_url + "_"
request = Net::HTTP::Post.new(uri.path)
request.body = sender.to_xml
request.content_type = 'application/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
return good_response_code?(response)
end
|