lib/weary/resource.rb in weary-0.5.0 vs lib/weary/resource.rb in weary-0.5.1

- old
+ new

@@ -16,21 +16,15 @@ resource_name = resource_name.to_s unless resource_name.is_a?(String) @name = resource_name.downcase.strip.gsub(/\s/,'_') end def via=(http_verb) - @via = case http_verb - when *Methods[:get] - :get - when *Methods[:post] - :post - when *Methods[:put] - :put - when *Methods[:delete] - :delete - else - raise ArgumentError, "#{http_verb} is not a supported method" + verb = HTTPVerb.new(http_verb).normalize + @via = if Methods.include?(verb) + verb + else + :get end end def format=(type) type = type.downcase if type.is_a?(String) @@ -61,10 +55,10 @@ @with = params.collect {|x| x.to_sym} | @requires end end end - def requires=(params) + def requires=(params) if @with.is_a?(Hash) params.each { |key| @with[key] = nil unless @with.has_key?(key) } @requires = params.collect {|x| x.to_sym} else @with = @with | params.collect {|x| x.to_sym} \ No newline at end of file