prospector 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6103d636c38c2f30be31347ee92326d4ffe84d4
4
- data.tar.gz: cc0a7d29d72658a8badc5cf73b95adc1afeae974
3
+ metadata.gz: 17d684c92a2f6775b95188cedc1b11508c4591a9
4
+ data.tar.gz: e70f72f23711fd568472bf5795fdd51aef0a8ba2
5
5
  SHA512:
6
- metadata.gz: a64bd0fb70d3068e94200267779362b432f5724c9cd4416f6b1ee0176e094c81b1a7415e55c55d68ae645adbe1535547f27d6245ea40bf1f889af54aefff72c9
7
- data.tar.gz: ee493defe6697f5e21fa92d30a50a65fe0c2038408a42d42a801eaebaeadd0b21cef2b914b886e2d05348b86e0ca9ada98e0db4965a625ebf9050f1606d1d112
6
+ metadata.gz: 2315890f9d758935c69810496ffd6a352fd6470db51400493f3aa091eb50df746feb3e2e683875d5664f1c6aeab0fa49f8d18f232e1ef9ae738c6d0ae1274b55
7
+ data.tar.gz: c6f0e0951d36e8a894e89f33e6cea95d3d2111aa5f331fe756fc00790d2d762b1ba3aa49b107d39b48539d0b4b8d08fdd31c39deb60ade32cdd1407e85e24e1e
@@ -1,9 +1,19 @@
1
1
  module Prospector
2
2
  class Client
3
+ DEFAULT_ENDPOINT = 'http://api.gemprospector.com/v1/specifications.json'
4
+
5
+ attr_reader :endpoint
6
+
3
7
  def self.deliver(*args)
4
8
  new.deliver(*args)
5
9
  end
6
10
 
11
+ def initialize(endpoint = DEFAULT_ENDPOINT, secret_token = nil, client_secret = nil)
12
+ @endpoint = URI(endpoint)
13
+ @secret_token = secret_token
14
+ @client_secret = client_secret
15
+ end
16
+
7
17
  def deliver(specifications)
8
18
  set_request_body(specifications)
9
19
 
@@ -16,6 +26,14 @@ module Prospector
16
26
  end
17
27
  end
18
28
 
29
+ def client_secret
30
+ @client_secret ||= Prospector.configuration.client_secret
31
+ end
32
+
33
+ def secret_token
34
+ @secret_token ||= Prospector.configuration.secret_token
35
+ end
36
+
19
37
  private
20
38
 
21
39
  def request
@@ -26,18 +44,14 @@ module Prospector
26
44
  @response ||= make_request
27
45
  end
28
46
 
29
- def endpoint
30
- @endpoint ||= URI('http://api.gemprospector.com/v1/specifications.json')
31
- end
32
-
33
47
  def json
34
48
  @json ||= JSON.parse(response.body)
35
49
  end
36
50
 
37
51
  def build_request
38
52
  request = Net::HTTP::Post.new(endpoint)
39
- request['X-Auth-Token'] = Prospector.configuration.secret_token
40
- request['X-Auth-Secret'] = Prospector.configuration.client_secret
53
+ request['X-Auth-Token'] = secret_token
54
+ request['X-Auth-Secret'] = client_secret
41
55
  request['Content-Type'] = 'application/json'
42
56
  request
43
57
  end
@@ -1,3 +1,3 @@
1
1
  module Prospector
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prospector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Millsaps-Brewer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2015-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json