ossy 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: ed72b49fd31404f38c118558aa38f6f2e1469e3937d858c77a1bcb5585f94eff
4
- data.tar.gz: b1b364bc5a9b33da7ed7fabf0f648e7f74b47efc3922d3ca61d47995579f58b4
3
+ metadata.gz: 6dfdf802909b30bd081ea1e537437d38b52ef117a769e0696bb6b024ab57c9e4
4
+ data.tar.gz: a0aaf3afa2381cd6db31a72668ee57020e2ada102120e1c9f171c2757198c8bb
5
5
  SHA512:
6
- metadata.gz: c050bd2e6d8ceab00e0617a66a363f44f2a9f1a81416c3de2f8a2f05fcb67b9f1cf544b47d15ea59d622bc0b4e2dc1490de4a9b95f43ce51cd3bde1b19902def
7
- data.tar.gz: 16e592ffe2465faf4bd4de7685dfc7c562735e2e65d1a814417f002a72aa1784c4127c159f74b2dc0be552c4dd6ef0b4dc9cba09da159952380f2f64e11d6553
6
+ metadata.gz: 51a44d6e250c9e1482625dfec2ce42c16d73571f06c5bcb6508b682bb530fd33a6ef9657ba9757a05b7b6c9f073059d272e23bbb38e4f26ba3479e0c8f989fcb
7
+ data.tar.gz: e687709b8d88ad167035c6259ae01604d0ece52ed54994cbd81fba0007186a389b6dd8ac023f8ae394c7e5951dc0ba24e9b021690cc2b70f4b5e749cd1093bbb
@@ -1,3 +1,9 @@
1
+ ## 0.1.3 2020-01-23
2
+
3
+ ### Changed
4
+
5
+ - Switched from `http` to `faraday` as it has less dependencies (@solnic)
6
+
1
7
  ## 0.1.2 2020-01-23
2
8
 
3
9
  ### Fixed
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'ossy/import'
4
4
 
5
- require 'http'
5
+ require 'faraday'
6
6
  require 'json'
7
7
 
8
8
  module Ossy
@@ -16,7 +16,7 @@ module Ossy
16
16
  path = "orgs/#{org}/teams/#{team}/memberships/#{username}"
17
17
  resp = get(path)
18
18
 
19
- return false unless resp.code.equal?(200)
19
+ return false unless resp.status.equal?(200)
20
20
 
21
21
  json = JSON.parse(resp.body)
22
22
 
@@ -27,14 +27,14 @@ module Ossy
27
27
  path = "repos/#{repo}/git/ref/tags/#{tag}"
28
28
  resp = get(path)
29
29
 
30
- return false unless resp.code.equal?(200)
30
+ return false unless resp.status.equal?(200)
31
31
 
32
32
  sha = JSON.parse(resp.body)['object']['sha']
33
33
 
34
34
  path = "repos/#{repo}/git/tags/#{sha}"
35
35
  resp = get(path)
36
36
 
37
- return false unless resp.code.equal?(200)
37
+ return false unless resp.status.equal?(200)
38
38
 
39
39
  json = JSON.parse(resp.body)
40
40
 
@@ -45,7 +45,7 @@ module Ossy
45
45
  path = "orgs/#{org}/members"
46
46
  resp = get(path)
47
47
 
48
- return nil unless resp.code.equal?(200)
48
+ return nil unless resp.status.equal?(200)
49
49
 
50
50
  user = JSON.parse(resp.body)
51
51
  .map { |member| user(member['login']) }
@@ -58,13 +58,13 @@ module Ossy
58
58
  path = "users/#{login}"
59
59
  resp = get(path)
60
60
 
61
- return nil unless resp.code.equal?(200)
61
+ return nil unless resp.status.equal?(200)
62
62
 
63
63
  JSON.parse(resp.body)
64
64
  end
65
65
 
66
66
  def request(meth, path, opts = {})
67
- http.public_send(meth, url(path), opts)
67
+ http.public_send(meth, path, opts)
68
68
  end
69
69
 
70
70
  def get(path, opts = {})
@@ -72,17 +72,18 @@ module Ossy
72
72
  end
73
73
 
74
74
  def post(path, input)
75
- request(:post, path, json: input)
75
+ request(:post, path, JSON.dump(input))
76
76
  end
77
77
 
78
- def url(path)
79
- "#{BASE_URL}/#{path}"
78
+ def http
79
+ @http ||= Faraday.new(url: BASE_URL, headers: headers) do |conn|
80
+ conn.basic_auth(settings.github_login, settings.github_token)
81
+ end
80
82
  end
81
83
 
82
- def http
83
- HTTP
84
- .headers('Accept': 'application/vnd.github.everest-preview+json')
85
- .basic_auth(user: settings.github_login, pass: settings.github_token)
84
+ def headers
85
+ { 'Content-Type' => 'application/json',
86
+ 'Accept' => 'application/vnd.github.everest-preview+json' }
86
87
  end
87
88
  end
88
89
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ossy
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ossy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
@@ -93,19 +93,19 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0.14'
95
95
  - !ruby/object:Gem::Dependency
96
- name: http
96
+ name: faraday
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '4.1'
101
+ version: '1.0'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '4.1'
108
+ version: '1.0'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: tilt
111
111
  requirement: !ruby/object:Gem::Requirement