github_issue_exporter 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90da13ded1c07b94331081e6d4ec102e9e275355
4
- data.tar.gz: 236daac34abdab9894117684c9a84f5fcd573585
3
+ metadata.gz: 44d52955013bc1e5eb31bba08f3cb7fd220634dd
4
+ data.tar.gz: 55d4cc5ab13cf8635af65fd0502710dac8f84612
5
5
  SHA512:
6
- metadata.gz: 862a0f788bdbe2226a0bc26d3e727f2ddf2c2bba2ad41f17eb6e739cdb02ae99c4e824af8b45da884398217ecca1550c899b2e4e8db082e9c004782b2f15b130
7
- data.tar.gz: 99a81d39d3ff687721134e82d6f92d2f81c2a12b6a76d8fe7d8067a2d1b841fcb1d86bdc585d6c830d6128ee2d642bd1bf1f87551437d8d4f6a5c1b5fd871c9d
6
+ metadata.gz: fa3cec10e92e0b5ff83b42569c228ecaa6f877e6ed674ddd4e09913ac0287d44586a6ebcdbb7018a6eac574c8a3f266f65218f5f8428aee054b3f914b47b6452
7
+ data.tar.gz: fafc5957ba66bc1eb29760fccdc020a5e2636b42a5c875d57fecefab8949be89ebd18f8684e012650039d4d56ae7178f899201ee7c7e578f9424113a38815e8e
@@ -75,7 +75,8 @@ HERE
75
75
  options = { path: @output,
76
76
  multiple_files: @multiple_files,
77
77
  include_closed_issues: @include_closed_issues,
78
- output_type: @output_type }
78
+ output_type: @output_type,
79
+ page_size: true }
79
80
  exporter = IssueExporting::Exporter.new(@owner, @repo, @token, options)
80
81
  exporter.export
81
82
  end
@@ -7,7 +7,7 @@ module IssueExporting
7
7
 
8
8
  attr_accessor :outputter
9
9
 
10
- def initialize(owner, repo, token = nil, options = {})
10
+ def initialize(owner, repo, token = nil, options = { page_size: true })
11
11
  @owner = owner
12
12
  @repo = repo
13
13
  @token = token
@@ -19,7 +19,8 @@ module IssueExporting
19
19
 
20
20
  def export
21
21
  error_handler = ErrorHandler.new
22
- url = IssueExporting.make_uri @owner, @repo, @token, @options
22
+ url = IssueExporting.make_uri @owner, @repo, @token
23
+ url.query += build_query_string @options
23
24
  response = Net::HTTP::get url
24
25
  if err = error_handler.error_message(response)
25
26
  error_handler.handle_error err
@@ -28,7 +29,24 @@ module IssueExporting
28
29
  end
29
30
  end
30
31
 
31
- private
32
+ def build_query_string(options)
33
+ values = {
34
+ include_closed_issues: 'state=all',
35
+ page_size: 'per_page=100'
36
+ }
37
+ qs = options.reduce([]) do |arr, kv|
38
+ key, val = kv
39
+ query_value = values[key] if val
40
+ if query_value.nil?
41
+ arr
42
+ else
43
+ arr.push(query_value) unless query_value.nil?
44
+ end
45
+ end
46
+ if qs == [] then return '' end
47
+ return '&' + qs.join('&')
48
+ end
49
+
32
50
  def build_outputter(outputter_options)
33
51
  output_type = outputter_options[:output_type] || 'file'
34
52
  case output_type
@@ -3,15 +3,14 @@ module IssueExporting
3
3
  "https://api.github.com/repos/%s/%s/issues?access_token=%s"
4
4
  end
5
5
 
6
- def self.make_url(owner, repo, token, options = {})
6
+ def self.make_url(owner, repo, token)
7
7
  url_format = IssueExporting.api_url
8
8
  root_url = url_format % [owner, repo, token]
9
- return root_url unless options[:include_closed_issues] == true
10
- root_url + "&state=all"
9
+ return root_url
11
10
  end
12
11
 
13
- def self.make_uri(owner, repo, token, options = {})
14
- URI(IssueExporting.make_url(owner, repo, token, options))
12
+ def self.make_uri(owner, repo, token)
13
+ URI(IssueExporting.make_url(owner, repo, token))
15
14
  end
16
15
 
17
16
  def self.turn_options_into_querystring(options)
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Scott Williams
2
2
 
3
3
  module IssueExporting
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_issue_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Williams