forked from aeolus-incubator/thor-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move code and ensure proper requires
General things concerning AeolusClient namespace are moved to aeolus_client.rb. Logging configuration that is done by requiring aeolus_client/base.rb is marked as FIXME for removal when configuration refactoring is done. Require aeolus_client/base.rb for resource classes that inherit from it.
- Loading branch information
Showing
5 changed files
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'active_resource' | ||
|
||
module AeolusClient | ||
end | ||
|
||
module ActiveResource | ||
class Errors < ActiveModel::Errors | ||
# Grabs errors from an XML response. | ||
def from_xml(xml, save_cache = false) | ||
array = Array.wrap(Hash.from_xml(xml)['errors']['error']) | ||
# The below is added because the default behaviour (the above | ||
# line) only works fine if the error string is not buried in | ||
# another layer of xml. | ||
# | ||
# from_array (in this Errors class) is brittle and will blow up | ||
# if it doesn't get an array of strings. | ||
if array.size >= 1 && array[0].is_a?(Hash) && | ||
array[0].has_key?('message') | ||
array.map! {|error| error['message']} | ||
end | ||
from_array array, save_cache | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require 'aeolus_client/base' | ||
|
||
class AeolusClient::ProviderXMLFormat | ||
include ActiveResource::Formats::XmlFormat | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters