ultrasoap 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 507ea593167429507f8f5a47997780f19e61ce30
4
- data.tar.gz: ef8bba16c630b6f9c2460112c3adce843595cfc3
3
+ metadata.gz: 7d01f25bb8ce7753f612d44fa748e1d5fd75f955
4
+ data.tar.gz: f711d478f5ea642f86f83e7959960494d32e4765
5
5
  SHA512:
6
- metadata.gz: eadaebea9c0581a8ceb5c408a607661b7f886e9f5432df058952d74b0c620a5ebd5c0f6ef48eaf608351fb66fac8ec56eec1d5a615c682404c0109d3b69f7803
7
- data.tar.gz: 41e2a9e910cdc75d768b2ba134b5f58c51eaa21c3939ef96bb4e8712a4d07868e16aa9ba97a634a163322d67feed7e25f9d97488634be580bd9f05c09ea8b99b
6
+ metadata.gz: 4cb63cf681c0aa40fb5a48132646672545776e099fe911527c483ba74152ce527b3074f114776d7423dd0a463819efb92a4e85e4e5f4b69289b97ff2aa4655bd
7
+ data.tar.gz: 4b10f30d44b8a34ffd0922d0278b09d404e403afb29c00076ef86575f800cc725b744d374a6cffaca79edb5f4da99ae6bebe18d478998e3b23279f2a24c10e3b
data/README.md CHANGED
@@ -91,3 +91,44 @@ probes_response.xpath("//ProbeData").each |probe|
91
91
  ...
92
92
  end
93
93
  ```
94
+
95
+ There is also a rudimentary and experimental support for transactions.
96
+ Once you have instantiated the client, you can invoke the following methods:
97
+
98
+ ```ruby
99
+ dl.start_transaction
100
+
101
+ dl.commit_transaction
102
+
103
+ dl.rollback_transaction
104
+ ```
105
+
106
+ As soon as the transactions support will be thoroughly tested and will reach a stable status, I'll update the documentation with some example.
107
+
108
+ Wrapper functions
109
+ -----------------
110
+
111
+ Although is possible to call all functions via the generic *send_request* method, I've started to implement some builtin function, which wraps the API functions themselves and should facilitate their invoking.
112
+
113
+ These functions require less writing and can be used without having to pre-form a message hash. They just need a couple of parameters.
114
+
115
+ All functions return a Nokogiri::Nodeset, just like send_request.
116
+
117
+ The current version supports the following functions:
118
+
119
+ ```ruby
120
+ # Enumerate all Load Balancing pools for the required zone
121
+ # Parameters:
122
+ # - zone => the name of the zone, *including* the trailing dot
123
+ # - pool_type => the type of the pool. Defaults to SB => SiteBacker . See the reference manual to learn more.
124
+
125
+ get_lb_pools(zone, pool_type='SB')
126
+
127
+ # Returns all the records for a certain load balancing pool
128
+ # Parameters:
129
+ # - pool_id => the ID of the pool
130
+ get_pool_records(pool_id)
131
+
132
+ ```
133
+
134
+ More functions are on the way (lookup functions and other stuff).
data/lib/client.rb CHANGED
@@ -7,6 +7,7 @@ module UltraSOAP
7
7
 
8
8
  @logger
9
9
 
10
+ # Would like to find a better place for defaults, rather than here
10
11
  @logdest = './ultrasoap.log'
11
12
  @logging = false
12
13
  @log_level = 'error'
@@ -54,12 +55,9 @@ module UltraSOAP
54
55
  @logger = Logger.new(@logdest)
55
56
 
56
57
  logging = Settings['logging'] || Client.logging
57
-
58
58
  log_lev = Settings['log_level'] || Client.log_level
59
59
 
60
60
  begin
61
- # For some reason, if I use the instance variable, Savon.client doesn't work properly
62
-
63
61
  @client = Savon.client do
64
62
  wsdl ultra_wsdl
65
63
  env_namespace 'soapenv'
@@ -92,6 +90,8 @@ module UltraSOAP
92
90
  return Nokogiri::XML(@response.to_xml).remove_namespaces!
93
91
  rescue Exception => e
94
92
  @logger.error("Error in ultrasoap.send_request: " + e.message)
93
+ # Rollback current transaction, if any
94
+ transaction_rollback unless @transaction_id == nil
95
95
  return nil
96
96
  end
97
97
  end
@@ -140,10 +140,10 @@ module UltraSOAP
140
140
  # Helper method to retrieve load balancing pools data
141
141
  # Parameters:
142
142
  # - zone (don't forget the trailing dot)
143
- def get_lb_pools(zone)
143
+ def get_lb_pools(zone, pool_type='SB')
144
144
  message = {
145
145
  :zone_name => zone,
146
- :lb_pool_type => 'SB'
146
+ :lb_pool_type => pool_type
147
147
  }
148
148
 
149
149
  begin
@@ -157,7 +157,7 @@ module UltraSOAP
157
157
 
158
158
  # Helper method to retrieve Pool's records
159
159
  # Parameters:
160
- # - poolID
160
+ # - pool_id
161
161
  def get_pool_records(pool_id)
162
162
  message = {
163
163
  :pool_id => pool_id.to_s
@@ -170,9 +170,49 @@ module UltraSOAP
170
170
  end
171
171
  end
172
172
 
173
+ # Returns a list of probes for the given pool record
174
+ # Parameters:
175
+ # - poolRecordID
176
+ # - SortBy, possible values are:
177
+ # PROBEID
178
+ # PROBEDATA
179
+ # PROBEFAILSPECS
180
+ # ACTIVE
181
+ # POOLID
182
+ # AGENTFAILSPECS
183
+ # PROBEWEIGHT
184
+ # BLEID
185
+ def get_probes_of_pool_record(pool_record_id, sort_by="PROBEDATA")
186
+ message = {
187
+ :pool_record_ID => pool_record_id.to_s,
188
+ :sort_by => sort_by
189
+ }
190
+
191
+ begin
192
+ return self.send_request :get_probes_of_pool_record, message
193
+ rescue Exception => e
194
+ @logger.error("Error while retrieving probes for pool record ID #{pool_record_id.to_s}: #{e.message}")
195
+ end
196
+ end
197
+
198
+ # Returns notifications for a pool
199
+ # Parameters:
200
+ # - poolID: string
201
+ def get_notifications_of_pool(pool_id)
202
+ message = {
203
+ :pool_id => pool_id
204
+ }
205
+
206
+ begin
207
+ return self.send_request :get_notifications_of_pool, message
208
+ rescue Exception => e
209
+ @logger.error("Error while retrieving notifications for pool ID #{pool_id}: #{e.message}")
210
+ end
211
+ end
212
+
173
213
  # LOOKUP methods
174
214
 
175
- def lookup_pool_type(pt_code)
215
+ def lookup_pool_type(pt_code='SB')
176
216
  case pt_code.to_s
177
217
  when 'SB'
178
218
  'SiteBacker'
@@ -185,7 +225,7 @@ module UltraSOAP
185
225
  end
186
226
  end
187
227
 
188
- def lookup_response_method(rm_code)
228
+ def lookup_response_method(rm_code='FX')
189
229
  case rm_code.to_s
190
230
  when 'FX'
191
231
  'Fixed'
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ultrasoap'
3
- s.version = '0.1.2'
3
+ s.version = '0.1.3'
4
4
  s.summary = "Simple Ruby client library for UltraDNS SOAP API"
5
- s.description = "Connect to Neustar's UltraDNS SOAP API.\nFKA ultrasoap-ruby.\nAny feedback or contribution is appreciated."
5
+ s.description = "Connect to Neustar's UltraDNS SOAP API. FKA ultrasoap-ruby. Any feedback or contribution is appreciated."
6
6
  s.authors = ["Gabriel Sambarino"]
7
7
  s.email = 'gabriel.sambarino@gmail.com'
8
8
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultrasoap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Sambarino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-20 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -52,10 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.10'
55
- description: |-
56
- Connect to Neustar's UltraDNS SOAP API.
57
- FKA ultrasoap-ruby.
58
- Any feedback or contribution is appreciated.
55
+ description: Connect to Neustar's UltraDNS SOAP API. FKA ultrasoap-ruby. Any feedback
56
+ or contribution is appreciated.
59
57
  email: gabriel.sambarino@gmail.com
60
58
  executables: []
61
59
  extensions: []