lib/branch_io/client/response.rb in branch_io-0.1.0 vs lib/branch_io/client/response.rb in branch_io-0.2.0

- old
+ new

@@ -26,11 +26,11 @@ def failure? !success? end def validate! - raise ErrorApiCallFailed.new(self) unless success? + raise ErrorApiCallFailed, self unless success? end def json response.parsed_response end @@ -82,26 +82,30 @@ end def responses @responses ||= json.map do |url_info| # below the EmbeddedResponseWrapper(s) act as a dummp HTTParty response - if url_info.has_key?("error") + if url_info.key?("error") ErrorResponse.new(EmbeddedResponseWrapper.new(url_info)) else UrlResponse.new(EmbeddedResponseWrapper.new(url_info)) end end end + # rubocop: disable Lint/UselessAccessModifier + # Not sure why RuboCop thinks this is useless. + private - class EmbeddedResponseWrapper < Struct.new(:parsed_response); end + # rubocop: enable Lint/UselessAccessModifier + + EmbeddedResponseWrapper = Struct.new(:parsed_response) end class LinkPropertiesResponse < Response def link_properties @link_properties ||= BranchIO::LinkProperties.new(json) end end - end end