lib/you_track/client/mock.rb in you_track-0.3.0 vs lib/you_track/client/mock.rb in you_track-0.4.0

- old
+ new

@@ -5,24 +5,12 @@ @data ||= Hash.new { |h,k| h[k] = { :issues => {}, :comments => {}, :users => {}, - :projects => { - "YTD" => { - "name" => "You Track Dev", - "shortName" => "YTD", - "versions" => [], - "assignees" => {}, - "isImporting" => "false", - "description" => "Fake project for YouTrack development", - } - }, + :projects => {}, :custom_fields => { - "YTD" => [ - {"name" => "Fix versions", "url" => "https://foo.bar/rest/admin/project/YTD/customfield/Fix%20versions"} - ] } } } end @@ -36,11 +24,11 @@ attr_accessor :last_request def url_for(path, options={}) URI.parse( - File.join(self.url.to_s, "/rest", path.to_s) + File.join(self.url.to_s, "/rest", URI.escape(path.to_s)) ).tap do |uri| if query = options[:query] uri.query = Faraday::NestedParamsEncoder.encode(query) end end.to_s @@ -65,10 +53,10 @@ path = options[:path] url = options[:url] || url_for(path, query: params) request_headers = {"Accept" => "application/xml"} - response_headers = {"Content-Type" => "application/xml"} + response_headers = {"Content-Type" => "application/xml"}.merge(options[:response_headers] || {}) # request phase # * :method - :get, :post, ... # * :url - URI for the current request; also contains GET parameters # * :body - POST parameters for :post/:put requests