softlayer_api 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 390f9ff4017222664251b8ccf219c01fe051f936
4
- data.tar.gz: 7f3bd11e1d5915e3bbe5c1a47602543fa86768a7
3
+ metadata.gz: 05bc26a020b1873a59356b3f2fd700cf9179e6ee
4
+ data.tar.gz: b4e61f95ed3f0e01cd9a98e5fddb3a19c6b52ff5
5
5
  SHA512:
6
- metadata.gz: 204a913bcc8b5f3bb79f3fd591ee32f123b9b9918b9469868b81afee662882af114f88a4fa1774215cfc1e67e1fed08d4a4fcfefecb420bf5b9ba962dab07446
7
- data.tar.gz: e425eae9d1a0b3f2fd66434ce014ec67b02234c4451072f9c0f658384d9b8059731b58c95e2e48f2081c29fe68252d069da794a89531a19cfc36efdf43527251
6
+ metadata.gz: dc7368ecd4e5794452f828071825a957296eb5934856d54d522fa31835234ebf550c9ede65706a534764fdb86396cda7c7eea2a38c1ef991fc0d8ae9561bcfa0
7
+ data.tar.gz: 992295885ea1fd4f30c064ecf10c5ef53220e373ee4e071ec84f7f0db20ac7582238573761b80168e744aee7d4f72238014898cd3f1fe8e96401201cc17f9502
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,6 @@
1
1
  *2.2*
2
- * Added a method to reboot servers.
2
+ * Added the ability to set a timout for network requests. The timeout is given when a client is created by passing the :timeout hash parameter when creating a client. The value of the parameter is an integer number of seconds.
3
+ * Fixed a bug in VirtualServer#capture_image
3
4
 
4
5
  *2.1.1*
5
6
  * Virtual server upgrades no longer raise exceptions
@@ -45,6 +45,11 @@ module SoftLayer
45
45
 
46
46
  # A string passsed as the value for the User-Agent header when requests are sent to SoftLayer API.
47
47
  attr_accessor :user_agent
48
+
49
+ # An integer value (in seconds). The number of seconds to wait for HTTP requests to the network API
50
+ # until they timeout. This value can be nil in which case the timeout will be the default value for
51
+ # the library handling network communication (often 30 seconds)
52
+ attr_reader :network_timeout
48
53
 
49
54
  ##
50
55
  # The client class maintains an (optional) default client. The default client
@@ -66,6 +71,7 @@ module SoftLayer
66
71
  # * <b>+:api_key+</b> - The API key used to authenticate the user with the API
67
72
  # * <b>+:enpoint_url+</b> - The API endpoint the client should connect to. This defaults to API_PUBLIC_ENDPOINT
68
73
  # * <b>+:user_agent+</b> - A string that is passed along as the user agent when the client sends requests to the server
74
+ # * <b>+:timeout+</b> - An integer number of seconds to wait until network requests time out. Corresponds to the network_timeout property of the client
69
75
  #
70
76
  # If these arguments are not provided then the client will try to locate them using other
71
77
  # sources including global variables, and the SoftLayer config file (if one exists)
@@ -85,6 +91,8 @@ module SoftLayer
85
91
  @endpoint_url = settings[:endpoint_url] || API_PUBLIC_ENDPOINT
86
92
 
87
93
  @user_agent = settings[:user_agent] || "softlayer_api gem/#{SoftLayer::VERSION} (Ruby #{RUBY_PLATFORM}/#{RUBY_VERSION})"
94
+
95
+ @network_timeout = settings[:timeout] if settings.has_key?(:timeout)
88
96
 
89
97
  raise "A SoftLayer Client requires a username" if !@username || @username.empty?
90
98
  raise "A SoftLayer Client requires an api_key" if !@api_key || @api_key.empty?
@@ -54,6 +54,7 @@ module SoftLayer
54
54
  # [softlayer]
55
55
  # username = joeusername
56
56
  # api_key = DEADBEEFBADF00D
57
+ # timeout = 60
57
58
  #
58
59
  # = Environment Variables
59
60
  #
@@ -110,6 +111,7 @@ module SoftLayer
110
111
  result[:username] = softlayer_section['username'] if softlayer_section['username']
111
112
  result[:endpoint_url] = softlayer_section['endpoint_url'] if softlayer_section['endpoint_url']
112
113
  result[:api_key] = softlayer_section['api_key'] if softlayer_section['api_key']
114
+ result[:timeout] = softlayer_section['timeout'] if softlayer_section['timeout']
113
115
  end
114
116
  end
115
117
  end
@@ -58,7 +58,7 @@ module SoftLayer
58
58
 
59
59
  recognize_token(@tokenizer, :eos, "Extraneous text after object mask: ")
60
60
 
61
- if property && (property.name != "mask" && propertyName != "filterMask")
61
+ if property && (property.name != "mask" && property.name != "filterMask")
62
62
  raise ObjectMaskParserError, "Object Mask must begin with a 'mask' or 'filterMask' root property"
63
63
  end
64
64
 
@@ -296,9 +296,9 @@ using either client.service_named('<service_name_here>') or client['<service_nam
296
296
 
297
297
  def xmlrpc_client()
298
298
  if !@xmlrpc_client
299
- @xmlrpc_client = XMLRPC::Client.new2(URI.join(@client.endpoint_url,@service_name).to_s)
299
+ @xmlrpc_client = XMLRPC::Client.new2(URI.join(@client.endpoint_url,@service_name).to_s, nil, @client.network_timeout)
300
300
 
301
- # this is a workaround for a bug in later versions of the XML-RPC client in Ruby Core.
301
+ # This is a workaround for a bug in later versions of the XML-RPC client in Ruby Core.
302
302
  # see https://bugs.ruby-lang.org/issues/8182
303
303
  @xmlrpc_client.http_header_extra = {
304
304
  "Accept-Encoding" => "identity",
@@ -143,13 +143,15 @@ module SoftLayer
143
143
  #
144
144
  # The image_notes should be a string and will be added to the image as notes.
145
145
  #
146
- def capture_image(image_name, include_attached_storage = false, image_notes = nil)
146
+ def capture_image(image_name, include_attached_storage = false, image_notes = '')
147
+ image_notes = '' if !image_notes
148
+
147
149
  disk_filter = lambda { |disk| disk['device'] == '0' }
148
- disk_filter = lambda { |disk| disk['device'] == '1' } if include_attached_storage
150
+ disk_filter = lambda { |disk| disk['device'] != '1' } if include_attached_storage
149
151
 
150
152
  disks = self.blockDevices.select(&disk_filter)
151
153
 
152
- self.service.createArchiveTransaction(image_name, disks, notes) if disks && !disks.empty?
154
+ self.service.createArchiveTransaction(image_name, disks, image_notes) if disks && !disks.empty?
153
155
  end
154
156
 
155
157
  ##
@@ -31,7 +31,7 @@ require 'rubygems'
31
31
  # - +$SL_API_BASE_URL+- The default URL used to access the SoftLayer API. This defaults to the value of +SoftLayer::API_PUBLIC_ENDPOINT+
32
32
  #
33
33
  module SoftLayer
34
- VERSION = "2.1.1" # version history in the CHANGELOG.textile file at the root of the source
34
+ VERSION = "2.2.0" # version history in the CHANGELOG.textile file at the root of the source
35
35
 
36
36
  # The base URL of the SoftLayer API available to the public internet.
37
37
  API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3/'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softlayer_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SoftLayer Development Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configparser
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 1.8.1
89
+ - !ruby/object:Gem::Dependency
90
+ name: coveralls
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
89
103
  description: The softlayer_api gem offers a convenient mechanism for invoking the
90
104
  services of the SoftLayer API from Ruby.
91
105
  email: sldn@softlayer.com
@@ -148,5 +162,5 @@ rubyforge_project:
148
162
  rubygems_version: 2.2.2
149
163
  signing_key:
150
164
  specification_version: 4
151
- summary: Library for accessing the SoftLayer portal API
165
+ summary: Library for accessing the SoftLayer API
152
166
  test_files: []