octokit 2.0.0.rc3 → 2.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -225,17 +225,19 @@ module Octokit
225
225
 
226
226
  private
227
227
 
228
- def request(method, path, options)
228
+ def request(method, path, data)
229
+ options = {}
230
+ options[:query] = data.delete(:query) || {}
231
+ options[:headers] = data.delete(:headers) || {}
232
+
229
233
  if application_authenticated?
230
- options[:query] ||= {}
231
234
  options[:query].merge! application_authentication
232
235
  end
233
- if accept = options.delete(:accept)
234
- options[:headers] ||= {}
236
+ if accept = data.delete(:accept)
235
237
  options[:headers][:accept] = accept
236
238
  end
237
239
 
238
- @last_response = response = agent.call(method, URI.encode(path), options)
240
+ @last_response = response = agent.call(method, URI.encode(path), data, options)
239
241
  response.data
240
242
  end
241
243
 
@@ -18,7 +18,7 @@ module Octokit
18
18
  # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
19
19
  # client.authorizations
20
20
  def authorizations(options = {})
21
- get 'authorizations', options
21
+ paginate 'authorizations', options
22
22
  end
23
23
 
24
24
 
@@ -29,11 +29,11 @@ module Octokit
29
29
  # @see http://developer.github.com/v3/users/#get-a-single-user
30
30
  # @example
31
31
  # Octokit.user("sferik")
32
- def user(user=nil)
32
+ def user(user=nil, options = {})
33
33
  if user
34
- get "users/#{user}"
34
+ get "users/#{user}", options
35
35
  else
36
- get 'user'
36
+ get 'user', options
37
37
  end
38
38
  end
39
39
 
@@ -99,7 +99,7 @@ module Octokit
99
99
  #
100
100
  # @param user [String] Username of the user who you are getting the list of the people they follow.
101
101
  # @return [Array<Sawyer::Resource>] Array of hashes representing users a user is following.
102
- # @see http://developer.github.com/v3/users/followers/#list-users-following-another-user
102
+ # @see http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user
103
103
  # @example
104
104
  # Octokit.following('pengwynn')
105
105
  def following(user=login, options = {})
@@ -43,9 +43,11 @@ module Octokit
43
43
  # @!attribute web_endpoint
44
44
  # @return [String] Base URL for web URLs. default: https://github.com/
45
45
 
46
- attr_accessor :api_endpoint, :auto_paginate, :client_id, :default_media_type, :connection_options,
47
- :login, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent, :web_endpoint
48
- attr_writer :access_token, :client_secret, :password
46
+ attr_accessor :access_token, :api_endpoint, :auto_paginate, :client_id,
47
+ :default_media_type, :connection_options,
48
+ :login, :middleware, :netrc, :netrc_file,
49
+ :per_page, :proxy, :user_agent, :web_endpoint
50
+ attr_writer :client_secret, :password
49
51
 
50
52
  class << self
51
53
 
@@ -133,7 +133,7 @@ module Octokit
133
133
  # Default path for .netrc file
134
134
  # @return [String]
135
135
  def netrc_file
136
- ENV['OCTOKIT_NETRC_FILE'] || File.join(ENV['HOME'], '.netrc')
136
+ ENV['OCTOKIT_NETRC_FILE'] || File.join(ENV['HOME'].to_s, '.netrc')
137
137
  end
138
138
 
139
139
  end
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "2.0.0.rc3".freeze
5
+ VERSION = "2.0.0.rc4".freeze
6
6
 
7
7
  end
@@ -344,6 +344,18 @@ describe Octokit::Client do
344
344
  conn = Octokit.client.send(:agent).instance_variable_get(:"@conn")
345
345
  expect(conn.proxy[:uri].to_s).to eq 'http://proxy.example.com'
346
346
  end
347
+ it "passes along request headers for POST" do
348
+ VCR.turn_off!
349
+ headers = {"X-GitHub-Foo" => "bar"}
350
+ root_request = stub_post("/").
351
+ with(:headers => headers).
352
+ to_return(:status => 201)
353
+ client = Octokit::Client.new
354
+ client.post "/", :headers => headers
355
+ assert_requested root_request
356
+ expect(client.last_response.status).to eq 201
357
+ VCR.turn_on!
358
+ end
347
359
  end
348
360
 
349
361
  describe "auto pagination", :vcr do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc3
4
+ version: 2.0.0.rc4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-14 00:00:00.000000000 Z
14
+ date: 2013-08-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler