sourcing 0.0.4 → 0.0.5

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: 4afa61ca15362b50c3a4c4e808c6e1de123c2d79
4
- data.tar.gz: 41d58479ce93e655e0933ea794f03516b830ac93
3
+ metadata.gz: 3785a9f0fd6214f4a3535e032ea04cd36ac60607
4
+ data.tar.gz: d202f812e8eb2c0da9f5b84a3dceeec622fa2d31
5
5
  SHA512:
6
- metadata.gz: c620ef00b8e4590792845628bad0d8cb0850c1e797de5177ce72a86173ebddb461e596ff4d3e19be18667f6885ed25d029bc8941be3a4d61a16d0c3dbd3c01e2
7
- data.tar.gz: af9066785166cc0eb7707657beec2dcf2be15d67defc1a56e090c7d8631b9935775d5f1b3d3ee2c4bec6bdf767815a27c2c1dac0750b47d530c460498f49f674
6
+ metadata.gz: 42e561305dbf629536da40286094f73a5bdcdc91226628b632ea688c82a2a66918829e7fadc171061f0b74c63f44f14a0cd2b18776b95a7f86f520862516161e
7
+ data.tar.gz: e556988f7875abcc8f6466ebf3d38a41848e66887d8c18e68aebad9889ec147100186b31223fa726aabd1a9b5c22c9d245bd6a6467cff7e428a28f993f6a1fd0
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sourcing'
4
+ require 'json'
5
+ require 'optparse'
6
+
7
+ begin
8
+ require 'awesome_print'
9
+ rescue LoadError
10
+ def ap(value)
11
+ puts JSON.pretty_generate(value)
12
+ end
13
+ end
14
+
15
+ options = {}
16
+ values = {}
17
+
18
+ parser = OptionParser.new do |opts|
19
+ opts.banner = "Usage: sourcing EMAIL [options]"
20
+
21
+ opts.on("--twitter HANDLE", String, "Twitter handle") do |v|
22
+ values[:twitter] = v
23
+ end
24
+
25
+ opts.on("--github HANDLE", String, "GitHub handle") do |v|
26
+ values[:github] = v
27
+ end
28
+
29
+ opts.on("--email EMAIL", String, "Email") do |v|
30
+ values[:email] = v
31
+ end
32
+
33
+ opts.on("--api-key KEY", String, "Sourcing") do |v|
34
+ options[:api_key] = v
35
+ end
36
+ end
37
+
38
+ parser.parse!
39
+
40
+ if email = ARGV[0]
41
+ values[:email] ||= email
42
+ end
43
+
44
+ if key = ENV['SOURCING_KEY']
45
+ options[:api_key] ||= key
46
+ end
47
+
48
+ if values == {}
49
+ puts parser
50
+ exit
51
+ end
52
+
53
+ person = Sourcing::Person.find(values, options)
54
+
55
+ if person
56
+ ap person.to_hash
57
+ else
58
+ puts 'Person not found'
59
+ end
@@ -7,10 +7,14 @@ module Sourcing
7
7
  values = {:id => values}
8
8
  end
9
9
 
10
- params = options.delete(:params) || {}
10
+ options = options.dup
11
+ params = options.delete(:params) || {}
11
12
 
12
13
  if key = options.delete(:api_key)
13
- params[:authorization] = key
14
+ options.merge!(
15
+ auth_type: :bearer,
16
+ password: key
17
+ )
14
18
  end
15
19
 
16
20
  if email = values[:email]
@@ -1,3 +1,3 @@
1
1
  module Sourcing
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_dependency "nestful", "~> 1.0.7"
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_dependency 'nestful', '~> 1.0.7'
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sourcing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2013-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,7 +55,8 @@ dependencies:
55
55
  description: API client for sourcing.io
56
56
  email:
57
57
  - alex@sourcing.io
58
- executables: []
58
+ executables:
59
+ - sourcing
59
60
  extensions: []
60
61
  extra_rdoc_files: []
61
62
  files:
@@ -64,6 +65,7 @@ files:
64
65
  - LICENSE.txt
65
66
  - README.md
66
67
  - Rakefile
68
+ - bin/sourcing
67
69
  - examples/email.rb
68
70
  - lib/sourcing.rb
69
71
  - lib/sourcing/person.rb