xing_api 0.3 → 0.4

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: a6694210d744441f7872f84c1e2f6587dd689fc9
4
- data.tar.gz: 6f63ab052a256e12be4a4c0bc121a67e29cd5ffb
3
+ metadata.gz: c1a7be94fd7c7d55947d9312898b59f59a839143
4
+ data.tar.gz: 403855b22b5df86e265d047218d252c4debde1cb
5
5
  SHA512:
6
- metadata.gz: ba557942b95e3d2ccc43b477daa0ce44ac93ac97271c4e7a65ed8966e01bee56ea512cb22d19c600f58ac297c0eb12eec704203be539972b30988cdab82b8e82
7
- data.tar.gz: 38212eb4d27b98c42e91b61edb19f890aa00cb18f028b277ac581f502b79407e832221e4a3a8ad6e8739e81bca7defdbe7ca20a96072a487a8e8b5e7f03b2daa
6
+ metadata.gz: 8c6e1c632c694727f8c993b994842d8e9264c8b3a9dfe4c492dd9ca4008367b0bc285b80bae2d4b8a7e64e90d3aabd4838bd3e2104a00b92c40950ed17168c7b
7
+ data.tar.gz: a0d8fae6f888e946dadb664bcff1e6a28319abdd4950c5fef98c6bbe4a0b38b37d4b2173da416ad7a0a25218649a649a7b2736b622caab28a87ea88002ebc01b
@@ -1,16 +1,17 @@
1
1
  module XingApi
2
2
  class Error < StandardError
3
- attr_reader :status_code, :name, :text
3
+ attr_reader :status_code, :name, :text, :errors
4
4
 
5
- def initialize(status_code, name = '', text = '')
5
+ def initialize(status_code, name = '', text = '', errors = [])
6
6
  @status_code = status_code
7
7
  @name = name
8
8
  @text = text
9
+ @errors = errors || []
9
10
  super(text)
10
11
  end
11
12
 
12
13
  def to_s
13
- [status_code, name, text].join(' - ')
14
+ [status_code, name, text, errors.to_s].join(' - ')
14
15
  end
15
16
  end
16
17
 
@@ -32,7 +32,7 @@ module XingApi
32
32
  body = parse_json(response)
33
33
  error_class = failed_response_for(status_code, body[:error_name])
34
34
 
35
- fail error_class.new(status_code, body[:error_name], body[:message])
35
+ fail error_class.new(status_code, body[:error_name], body[:message], body[:errors])
36
36
  end
37
37
 
38
38
  def failed_response_for(status_code, error_name)
@@ -48,10 +48,10 @@ module XingApi
48
48
 
49
49
  def unauthorized_response_for(error_name)
50
50
  case error_name
51
- when *OAUTH_ERROR_RESPONSES
52
- XingApi::OauthError
53
51
  when 'INVALID_OAUTH_TOKEN'
54
52
  XingApi::InvalidOauthTokenError
53
+ when *OAUTH_ERROR_RESPONSES
54
+ XingApi::OauthError
55
55
  end
56
56
  end
57
57
 
data/lib/xing_api/user.rb CHANGED
@@ -47,5 +47,9 @@ module XingApi
47
47
  def self.update(options = {})
48
48
  request(:put, '/v1/users/me', options)
49
49
  end
50
+
51
+ def self.search(keywords, options = {})
52
+ request(:get, '/v1/users/find', { keywords: keywords }.merge(options))
53
+ end
50
54
  end
51
55
  end
@@ -1,3 +1,3 @@
1
1
  module XingApi
2
- VERSION = '0.3' unless defined?(XingApi::VERSION)
2
+ VERSION = '0.4' unless defined?(XingApi::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xing_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Schmidt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-31 00:00:00.000000000 Z
12
+ date: 2015-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth