You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/03/26 18:58:16 UTC
[30/30] git commit: Client: Method documentation fixes
Client: Method documentation fixes
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/e107d206
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/e107d206
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/e107d206
Branch: refs/heads/master
Commit: e107d206e2a245bf25a8dac5b5848fbf134f6455
Parents: 66a46b0
Author: Joe VLcek <jv...@redhat.com>
Authored: Thu Mar 21 13:23:50 2013 -0400
Committer: Michal fojtik <mf...@redhat.com>
Committed: Tue Mar 26 18:57:26 2013 +0100
----------------------------------------------------------------------
client/lib/deltacloud/client.rb | 2 +-
client/lib/deltacloud/client/base_error.rb | 6 +---
client/lib/deltacloud/client/connection.rb | 26 +++++++-------
client/lib/deltacloud/client/methods.rb | 14 ++++---
client/lib/deltacloud/client/methods/address.rb | 3 +-
client/lib/deltacloud/client/methods/blob.rb | 2 +-
client/lib/deltacloud/client/methods/bucket.rb | 7 ++--
client/lib/deltacloud/client/methods/driver.rb | 7 ++--
client/lib/deltacloud/client/methods/firewall.rb | 7 ++--
.../deltacloud/client/methods/hardware_profile.rb | 7 ++--
client/lib/deltacloud/client/methods/image.rb | 9 ++---
client/lib/deltacloud/client/methods/instance.rb | 12 +++---
client/lib/deltacloud/client/methods/key.rb | 5 +--
client/lib/deltacloud/client/methods/realm.rb | 7 ++--
.../deltacloud/client/methods/storage_snapshot.rb | 9 ++---
.../deltacloud/client/methods/storage_volume.rb | 7 ++--
client/lib/deltacloud/client/models.rb | 12 +++---
client/lib/deltacloud/client/models/base.rb | 8 ++--
client/lib/deltacloud/client/models/bucket.rb | 4 +-
client/lib/deltacloud/client/models/firewall.rb | 6 ---
client/lib/deltacloud/core_ext.rb | 2 +-
client/lib/deltacloud/error_response.rb | 13 ++++---
client/tests/models/image_test.rb | 2 +-
23 files changed, 81 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client.rb b/client/lib/deltacloud/client.rb
index 36200ad..c7048dd 100644
--- a/client/lib/deltacloud/client.rb
+++ b/client/lib/deltacloud/client.rb
@@ -39,7 +39,7 @@ module Deltacloud
require_relative './client/methods/backward_compatiblity'
# Extend Client module with methods that existed in old client
- # and we want to keep them.
+ # that need to be kept.
# Deprecation warnings should be provided to users if they use something
# from these modules.
#
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/base_error.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/base_error.rb b/client/lib/deltacloud/client/base_error.rb
index 544aa90..7f8e169 100644
--- a/client/lib/deltacloud/client/base_error.rb
+++ b/client/lib/deltacloud/client/base_error.rb
@@ -24,6 +24,7 @@ module Deltacloud::Client
attr_reader :driver
attr_reader :provider
attr_reader :status
+ attr_reader :original_error
def initialize(opts={})
if opts.is_a? Hash
@@ -38,11 +39,6 @@ module Deltacloud::Client
end
end
- # Return the original XML error message received from Deltacloud API
- def original_error
- @original_error
- end
-
# If the Deltacloud API server error response contain backtrace from
# server,then make this backtrace available as part of this exception
# backtrace
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/connection.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/connection.rb b/client/lib/deltacloud/client/connection.rb
index ad91cb0..4505cd9 100644
--- a/client/lib/deltacloud/client/connection.rb
+++ b/client/lib/deltacloud/client/connection.rb
@@ -23,26 +23,24 @@ module Deltacloud::Client
include Deltacloud::Client::Helpers::Model
- include Deltacloud::Client::Methods::Common
+ include Deltacloud::Client::Methods::Address
include Deltacloud::Client::Methods::Api
include Deltacloud::Client::Methods::BackwardCompatibility
+ include Deltacloud::Client::Methods::Blob
+ include Deltacloud::Client::Methods::Bucket
+ include Deltacloud::Client::Methods::Common
include Deltacloud::Client::Methods::Driver
- include Deltacloud::Client::Methods::Realm
+ include Deltacloud::Client::Methods::Firewall
include Deltacloud::Client::Methods::HardwareProfile
include Deltacloud::Client::Methods::Image
include Deltacloud::Client::Methods::Instance
include Deltacloud::Client::Methods::InstanceState
include Deltacloud::Client::Methods::Key
- include Deltacloud::Client::Methods::StorageVolume
+ include Deltacloud::Client::Methods::Realm
include Deltacloud::Client::Methods::StorageSnapshot
- include Deltacloud::Client::Methods::Address
- include Deltacloud::Client::Methods::Bucket
- include Deltacloud::Client::Methods::Blob
- include Deltacloud::Client::Methods::Firewall
+ include Deltacloud::Client::Methods::StorageVolume
def initialize(opts={})
- @request_driver = opts[:driver]
- @request_provider = opts[:provider]
@connection = Faraday.new(:url => opts[:url]) do |f|
# NOTE: The order of this is somehow important for VCR
# recording.
@@ -53,8 +51,8 @@ module Deltacloud::Client
f.adapter :net_http
end
cache_entrypoint!
- @request_driver ||= current_driver
- @request_provider ||= current_provider
+ @request_driver = opts[:driver] ||= current_driver
+ @request_provider = opts[:provider] ||= current_provider
end
# Change the current driver and return copy of the client
@@ -126,8 +124,10 @@ module Deltacloud::Client
def deltacloud_request_headers
headers = {}
headers['Accept'] = 'application/xml'
- headers['X-Deltacloud-Driver'] = @request_driver.to_s if @request_driver
- headers['X-Deltacloud-Provider'] = @request_provider.to_s if @request_provider
+ headers['X-Deltacloud-Driver'] = @request_driver.to_s \
+ if @request_driver
+ headers['X-Deltacloud-Provider'] = @request_provider.to_s \
+ if @request_provider
headers
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods.rb b/client/lib/deltacloud/client/methods.rb
index 0897866..9c81ae3 100644
--- a/client/lib/deltacloud/client/methods.rb
+++ b/client/lib/deltacloud/client/methods.rb
@@ -13,17 +13,19 @@
# License for the specific language governing permissions and limitations
# under the License.
+require_relative './methods/address'
+require_relative './methods/api'
+require_relative './methods/backward_compatiblity'
+require_relative './methods/blob'
+require_relative './methods/bucket'
require_relative './methods/common'
require_relative './methods/driver'
-require_relative './methods/realm'
+require_relative './methods/firewall'
require_relative './methods/hardware_profile'
require_relative './methods/image'
require_relative './methods/instance'
require_relative './methods/instance_state'
+require_relative './methods/key'
+require_relative './methods/realm'
require_relative './methods/storage_volume'
require_relative './methods/storage_snapshot'
-require_relative './methods/key'
-require_relative './methods/address'
-require_relative './methods/bucket'
-require_relative './methods/blob'
-require_relative './methods/firewall'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/address.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/address.rb b/client/lib/deltacloud/client/methods/address.rb
index 21da5f6..c4f3b63 100644
--- a/client/lib/deltacloud/client/methods/address.rb
+++ b/client/lib/deltacloud/client/methods/address.rb
@@ -19,8 +19,7 @@ module Deltacloud::Client
# Retrieve list of all address entities
#
- # Filter options:
- #
+ # filter_opts:
# - :id -> Filter entities using 'id' attribute
#
def addresses(filter_opts={})
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/blob.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/blob.rb b/client/lib/deltacloud/client/methods/blob.rb
index 80a3945..4be4353 100644
--- a/client/lib/deltacloud/client/methods/blob.rb
+++ b/client/lib/deltacloud/client/methods/blob.rb
@@ -17,7 +17,7 @@ module Deltacloud::Client
module Methods
module Blob
- # Retrieve list of all blob entities from given bucket
+ # Retrieve a list of all blob entities from given bucket
#
def blobs(bucket_id=nil)
raise error.new("The :bucket_id cannot be nil.") if bucket_id.nil?
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/bucket.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/bucket.rb b/client/lib/deltacloud/client/methods/bucket.rb
index b68cb05..c8086e4 100644
--- a/client/lib/deltacloud/client/methods/bucket.rb
+++ b/client/lib/deltacloud/client/methods/bucket.rb
@@ -19,9 +19,8 @@ module Deltacloud::Client
# Retrieve list of all bucket entities
#
- # Filter options:
- #
- # - :id -> Filter entities using 'id' attribute
+ # - filter_opts:
+ # - :id -> Filter entities using 'id' attribute
#
def buckets(filter_opts={})
from_collection :buckets,
@@ -39,7 +38,7 @@ module Deltacloud::Client
# Create a new bucket
#
- # - create_opts
+ # - name: Bucket name
#
def create_bucket(name)
create_resource :bucket, :name => name
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/driver.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/driver.rb b/client/lib/deltacloud/client/methods/driver.rb
index 107bcc3..579bcaf0 100644
--- a/client/lib/deltacloud/client/methods/driver.rb
+++ b/client/lib/deltacloud/client/methods/driver.rb
@@ -19,10 +19,9 @@ module Deltacloud::Client
# Retrieve list of all drivers
#
- # Filter options:
- #
- # - :id -> Filter drivers using their 'id'
- # - :state -> Filter drivers by their 'state'
+ # - filter_opt:
+ # - :id -> Filter drivers using their 'id'
+ # - :state -> Filter drivers by their 'state'
#
def drivers(filter_opts={})
from_collection(
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/firewall.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/firewall.rb b/client/lib/deltacloud/client/methods/firewall.rb
index 547dfc5..c33e8bb 100644
--- a/client/lib/deltacloud/client/methods/firewall.rb
+++ b/client/lib/deltacloud/client/methods/firewall.rb
@@ -19,9 +19,8 @@ module Deltacloud::Client
# Retrieve list of all firewall entities
#
- # Filter options:
- #
- # - :id -> Filter entities using 'id' attribute
+ # - filter_opts:
+ # - :id -> Filter entities using 'id' attribute
#
def firewalls(filter_opts={})
from_collection :firewalls,
@@ -39,7 +38,9 @@ module Deltacloud::Client
# Create a new firewall
#
+ # - name - Name to associate with new firewall
# - create_opts
+ # :name -> Name of firewall
#
def create_firewall(name, create_opts={})
create_resource :firewall, { :name => name }.merge(create_opts)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/hardware_profile.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/hardware_profile.rb b/client/lib/deltacloud/client/methods/hardware_profile.rb
index 0cf744c..95c5de4 100644
--- a/client/lib/deltacloud/client/methods/hardware_profile.rb
+++ b/client/lib/deltacloud/client/methods/hardware_profile.rb
@@ -19,9 +19,8 @@ module Deltacloud::Client
# Retrieve list of all hardware_profiles
#
- # Filter options:
- #
- # - :id -> Filter hardware_profiles using their 'id'
+ # - filter_opts:
+ # - :id -> Filter hardware_profiles using their 'id'
#
def hardware_profiles(filter_opts={})
from_collection :hardware_profiles,
@@ -30,7 +29,7 @@ module Deltacloud::Client
# Retrieve the given hardware_profile
#
- # - hardware_profile_id -> hardware_profile to retrieve
+ # - hwp_id -> hardware_profile to retrieve
#
def hardware_profile(hwp_id)
from_resource :hardware_profile,
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/image.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/image.rb b/client/lib/deltacloud/client/methods/image.rb
index 8e3765b..f61879c 100644
--- a/client/lib/deltacloud/client/methods/image.rb
+++ b/client/lib/deltacloud/client/methods/image.rb
@@ -19,11 +19,10 @@ module Deltacloud::Client
# Retrieve list of all images
#
- # Filter options:
- #
- # - :id -> Filter images using their 'id'
- # - :state -> Filter images by their 'state'
- # - :architecture -> Filter images by their 'architecture'
+ # - filter_opts:
+ # - :id -> Filter images using their 'id'
+ # - :state -> Filter images by their 'state'
+ # - :architecture -> Filter images by their 'architecture'
#
def images(filter_opts={})
from_collection :images,
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/instance.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/instance.rb b/client/lib/deltacloud/client/methods/instance.rb
index 4749d82..506c338 100644
--- a/client/lib/deltacloud/client/methods/instance.rb
+++ b/client/lib/deltacloud/client/methods/instance.rb
@@ -19,11 +19,10 @@ module Deltacloud::Client
# Retrieve list of all instances
#
- # Filter options:
- #
- # - :id -> Filter instances using their 'id'
- # - :state -> Filter instances by their 'state'
- # - :realm_id -> Filter instances based on their 'realm_id'
+ # - filter_opts:
+ # - :id -> Filter instances using their 'id'
+ # - :state -> Filter instances by their 'state'
+ # - :realm_id -> Filter instances based on their 'realm_id'
#
def instances(filter_opts={})
from_collection(
@@ -45,7 +44,8 @@ module Deltacloud::Client
# Create a new instance
#
- # - image_id -> Image to use for instance creation (img1, ami-12345, etc...)
+ # - image_id -> Image to use for instance creation
+ # (img1, ami-12345, etc...)
# - create_opts -> Various options that DC support for the current
# provider.
#
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/key.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/key.rb b/client/lib/deltacloud/client/methods/key.rb
index 8984f23..3e7f48b 100644
--- a/client/lib/deltacloud/client/methods/key.rb
+++ b/client/lib/deltacloud/client/methods/key.rb
@@ -19,9 +19,8 @@ module Deltacloud::Client
# Retrieve list of all key entities
#
- # Filter options:
- #
- # - :id -> Filter entities using 'id' attribute
+ # - filter_opts:
+ # - :id -> Filter entities using 'id' attribute
#
def keys(filter_opts={})
from_collection :keys,
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/realm.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/realm.rb b/client/lib/deltacloud/client/methods/realm.rb
index 41807f0..50d382d 100644
--- a/client/lib/deltacloud/client/methods/realm.rb
+++ b/client/lib/deltacloud/client/methods/realm.rb
@@ -19,10 +19,9 @@ module Deltacloud::Client
# Retrieve list of all realms
#
- # Filter options:
- #
- # - :id -> Filter realms using their 'id'
- # - :state -> Filter realms by their 'state'
+ # - filter_opts:
+ # - :id -> Filter realms using their 'id'
+ # - :state -> Filter realms by their 'state'
#
def realms(filter_opts={})
from_collection :realms,
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/storage_snapshot.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/storage_snapshot.rb b/client/lib/deltacloud/client/methods/storage_snapshot.rb
index 33c1696..e8c5a6d 100644
--- a/client/lib/deltacloud/client/methods/storage_snapshot.rb
+++ b/client/lib/deltacloud/client/methods/storage_snapshot.rb
@@ -19,9 +19,8 @@ module Deltacloud::Client
# Retrieve list of all storage_snapshot entities
#
- # Filter options:
- #
- # - :id -> Filter entities using 'id' attribute
+ # - filter_options:
+ # - :id -> Filter entities using 'id' attribute
#
def storage_snapshots(filter_opts={})
from_collection :storage_snapshots,
@@ -41,8 +40,8 @@ module Deltacloud::Client
#
# - volume_id -> ID of the +StorageVolume+ to create snapshot from
# - create_opts ->
- # :name -> Name of the StorageSnapshot
- # :description -> Description of the StorageSnapshot
+ # - :name -> Name of the StorageSnapshot
+ # - :description -> Description of the StorageSnapshot
#
def create_storage_snapshot(volume_id, create_opts={})
create_resource :storage_snapshot, create_opts.merge(:volume_id => volume_id)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/methods/storage_volume.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/methods/storage_volume.rb b/client/lib/deltacloud/client/methods/storage_volume.rb
index be6c4ca..994ffba 100644
--- a/client/lib/deltacloud/client/methods/storage_volume.rb
+++ b/client/lib/deltacloud/client/methods/storage_volume.rb
@@ -19,10 +19,9 @@ module Deltacloud::Client
# Retrieve list of all storage_volumes
#
- # Filter options:
- #
- # - :id -> Filter storage_volumes using their 'id'
- # - :state -> Filter storage_volumes by their 'state'
+ # - filter_opts:
+ # - :id -> Filter storage_volumes using their 'id'
+ # - :state -> Filter storage_volumes by their 'state'
#
def storage_volumes(filter_opts={})
from_collection :storage_volumes,
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/models.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/models.rb b/client/lib/deltacloud/client/models.rb
index 63b5a24..0f08ec3 100644
--- a/client/lib/deltacloud/client/models.rb
+++ b/client/lib/deltacloud/client/models.rb
@@ -14,17 +14,17 @@
# under the License.
require_relative './models/base'
+require_relative './models/address'
+require_relative './models/blob'
+require_relative './models/bucket'
require_relative './models/driver'
-require_relative './models/realm'
+require_relative './models/firewall'
require_relative './models/hardware_profile'
require_relative './models/image'
require_relative './models/instance_address'
require_relative './models/instance'
require_relative './models/instance_state'
+require_relative './models/key'
+require_relative './models/realm'
require_relative './models/storage_volume'
require_relative './models/storage_snapshot'
-require_relative './models/key'
-require_relative './models/address'
-require_relative './models/bucket'
-require_relative './models/blob'
-require_relative './models/firewall'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/models/base.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/models/base.rb b/client/lib/deltacloud/client/models/base.rb
index 9f51fb0..dbf34f7 100644
--- a/client/lib/deltacloud/client/models/base.rb
+++ b/client/lib/deltacloud/client/models/base.rb
@@ -31,7 +31,7 @@ module Deltacloud::Client
attr_reader :description
# The Base class that other models should inherit from
- # To initialize, you need to suply these mandatory params:
+ # To initialize, you need to supply these mandatory params:
#
# - :_client -> Reference to Client instance
# - :_id -> The 'id' of resource. The '_' is there to avoid conflicts
@@ -49,7 +49,7 @@ module Deltacloud::Client
alias_method :_id, :obj_id
# Populate instance variables in model
- # This method could be also used to update the variables for already
+ # This method could also be used to update the variables for already
# initialized models. Look at +Instance#reload!+ method.
#
def update_instance_variables!(opts={})
@@ -92,11 +92,11 @@ module Deltacloud::Client
@original_body
end
- # The model#id is the old way how to get the Deltacloud API resource
+ # The model#id is the old way for getting the Deltacloud API resource
# 'id'. However this collide with the Ruby Object#id.
#
def id
- warn '[DEPRECATION] `id` is deprecated because of possible conflict with Object#id. Use `_id` instead.'
+ warn '[DEPRECATION] `id` is deprecated because of a possible conflict with Object#id. Use `_id` instead.'
_id
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/models/bucket.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/models/bucket.rb b/client/lib/deltacloud/client/models/bucket.rb
index 9a8a856..3a689bf 100644
--- a/client/lib/deltacloud/client/models/bucket.rb
+++ b/client/lib/deltacloud/client/models/bucket.rb
@@ -38,14 +38,14 @@ module Deltacloud::Client
end
# Add a new blob to the bucket.
- # See: +create_blob+
+ # See: methods/blob.rb +create_blob+
#
def add_blob(blob_name, blob_data, blob_create_opts={})
create_blob(_id, blob_name, blob_data, create_opts)
end
# Remove a blob from the bucket
- # See: +destroy_blob+
+ # See: methods/blob.rb +destroy_blob+
#
def remove_blob(blob_id)
destroy_blob(_id, blob_id)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/client/models/firewall.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/client/models/firewall.rb b/client/lib/deltacloud/client/models/firewall.rb
index 9bbe0f2..4443100 100644
--- a/client/lib/deltacloud/client/models/firewall.rb
+++ b/client/lib/deltacloud/client/models/firewall.rb
@@ -26,12 +26,6 @@ module Deltacloud::Client
attr_reader :owner_id
attr_reader :rules
- # Firewall model methods
- #
- # def reboot!
- # firewall_reboot(_id)
- # end
-
# Parse the Firewall entity from XML body
#
# - xml_body -> Deltacloud API XML representation of the firewall
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/core_ext.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/core_ext.rb b/client/lib/deltacloud/core_ext.rb
index e85cdba..e8c5247 100644
--- a/client/lib/deltacloud/core_ext.rb
+++ b/client/lib/deltacloud/core_ext.rb
@@ -14,6 +14,6 @@
# under the License.
require_relative './core_ext/element'
-require_relative './core_ext/string'
require_relative './core_ext/fixnum'
+require_relative './core_ext/nil'
require_relative './core_ext/string'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/lib/deltacloud/error_response.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud/error_response.rb b/client/lib/deltacloud/error_response.rb
index 428b5ec..af663cf 100644
--- a/client/lib/deltacloud/error_response.rb
+++ b/client/lib/deltacloud/error_response.rb
@@ -22,19 +22,19 @@ module Deltacloud
# In case there is no error returned in body, it will try to use
# the generic error reporting.
#
- # - klass -> Deltacloud::Client::+Class+
+ # - name -> Deltacloud::Client::+Class+
+ # - error -> Deltacloud XML error representation
# - message -> Exception message (overiden by error body message if
# present)
- # - error -> Deltacloud XML error representation
#
def client_error(name, error, message=nil)
args = {
:message => message,
:status => error ? error[:status] : '500'
}
- # If Deltacloud API send error in response body, parse it.
- # Otherwise, when DC API send just plain text error, use
- # it as exception message.
+ # If Deltacloud API sends an error in the response body, parse it.
+ # Otherwise, when DC API sends just plain text error, use
+ # it as the exception message.
# If DC API does not send anything back, then fallback to
# the 'message' attribute.
#
@@ -52,7 +52,8 @@ module Deltacloud
@app.call(env).on_complete do |e|
case e[:status].to_s
when '401'
- raise client_error(:authentication_error, e, 'Invalid :api_user or :api_password')
+ raise client_error(:authentication_error, e,
+ 'Invalid :api_user or :api_password')
when '405'
raise client_error(
:invalid_state, e, 'Resource state does not permit this action'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e107d206/client/tests/models/image_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/models/image_test.rb b/client/tests/models/image_test.rb
index 0879b35..6c32d06 100644
--- a/client/tests/models/image_test.rb
+++ b/client/tests/models/image_test.rb
@@ -57,7 +57,7 @@ describe Deltacloud::Client::Image do
it 'supports #id' do
img = @client.image('img1')
- lambda { img.id.must_equal 'img1' }.must_output nil, "[DEPRECATION] `id` is deprecated because of possible conflict with Object#id. Use `_id` instead.\n"
+ lambda { img.id.must_equal 'img1' }.must_output nil, "[DEPRECATION] `id` is deprecated because of a possible conflict with Object#id. Use `_id` instead.\n"
end
end