lib/hello_sign/resource/base_resource.rb in hellosign-ruby-sdk-3.0.17 vs lib/hello_sign/resource/base_resource.rb in hellosign-ruby-sdk-3.0.18
- old
+ new
@@ -1,10 +1,10 @@
#
# The MIT License (MIT)
-#
+#
# Copyright (C) 2014 hellosign.com
-#
+#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@@ -39,10 +39,11 @@
# @param key [String] (nil) key of the hash, point to where resource data is. If nil then the hash itself
#
# @return [HelloSign::Resource::BaseResource] a new BaseResource
def initialize(hash, key=nil)
@raw_data = key ? hash[key] : hash
+ @warnings = hash['warnings'] ? hash['warnings'] : nil
@data = @raw_data.inject({}) do |data, (key, value)|
data[key.to_s] = if value.is_a? Hash
value = BaseResource.new(value)
elsif ((value.is_a? Array) && (value[0].is_a? Hash))
value = value.map {|v| BaseResource.new(v)}
@@ -74,9 +75,17 @@
# raw response data from the server in json
#
# @return [type] [description]
def data
@raw_data
+ end
+
+ #
+ # shows any warnings returned with the api response, if present
+ #
+ # @return [Array<Hash>, nil] Array of warning hashes in format {'warning_msg' => val, 'warning_name' => val} or nil
+ def warnings
+ @warnings
end
end
end
end