xing_api 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/xing_api/base.rb CHANGED
@@ -7,6 +7,11 @@ module XingApi
7
7
  client.request(http_verb, url, options)
8
8
  end
9
9
 
10
+ def request_with_body(http_verb, url, body_hash, options={})
11
+ client = options.delete(:client) || default_client
12
+ client.request_with_body(http_verb, url, body_hash)
13
+ end
14
+
10
15
  private
11
16
 
12
17
  def default_client
@@ -28,6 +28,10 @@ module XingApi
28
28
  handle(access_token.request(http_verb, full_url))
29
29
  end
30
30
 
31
+ def request_with_body(http_verb, url, body_hash={})
32
+ handle(access_token.request(http_verb, url, body_hash.to_json, { 'Content-Type' => 'application/json' }))
33
+ end
34
+
31
35
  def get_request_token(oauth_callback='oob')
32
36
  ensure_attributes_are_set! %w(consumer_key consumer_secret)
33
37
 
@@ -5,6 +5,10 @@ module XingApi
5
5
  request(:get, "/v1/users/#{user_id}/contacts", options)
6
6
  end
7
7
 
8
+ def self.list_ids(options={})
9
+ request(:get, '/v1/users/me/contact_ids', options)
10
+ end
11
+
8
12
  def self.shared(user_id, options={})
9
13
  request(:get, "/v1/users/#{user_id}/contacts/shared", options)
10
14
  end
@@ -5,10 +5,6 @@ module XingApi
5
5
  request(:get, "/v1/users/me/conversations/#{conversation_id}/attachments", options)
6
6
  end
7
7
 
8
- def self.find(conversation_id, attachment_id, options={})
9
- request(:get, "/v1/users/me/conversations/#{conversation_id}/attachments/#{attachment_id}", options)
10
- end
11
-
12
8
  def self.download_url(conversation_id, attachment_id, options={})
13
9
  request(:post, "/v1/users/me/conversations/#{conversation_id}/attachments/#{attachment_id}/download", options)
14
10
  end
@@ -25,10 +25,6 @@ module XingApi
25
25
  request(:get, "/v1/users/me/conversations/valid_recipients/#{recipient_id}", options)
26
26
  end
27
27
 
28
- def self.invite(conversation_id, user_id, options={})
29
- request(:put, "/v1/users/me/conversations/#{conversation_id}/participants/#{user_id}", options)
30
- end
31
-
32
28
  def self.read(conversation_id, options={})
33
29
  request(:put, "/v1/users/me/conversations/#{conversation_id}/read", options)
34
30
  end
@@ -0,0 +1,17 @@
1
+ module XingApi
2
+ class User::BirthDate < XingApi::Base
3
+
4
+ def self.update(day, month, year, options={})
5
+ request(
6
+ :put,
7
+ '/v1/users/me/birth_date',
8
+ {
9
+ :day => day,
10
+ :month => month,
11
+ :year => year
12
+ }.merge(options)
13
+ )
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module XingApi
2
+ class User::BusinessAddress < XingApi::Base
3
+
4
+ def self.update(options={})
5
+ request(:put, '/v1/users/me/business_address', options)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,30 @@
1
+ module XingApi
2
+ class User::Company < XingApi::Base
3
+
4
+ def self.create(name, title, industry, employment_type, options={})
5
+ request(
6
+ :post,
7
+ '/v1/users/me/professional_experience/companies',
8
+ {
9
+ :name => name,
10
+ :title => title,
11
+ :industry => industry,
12
+ :employment_type => employment_type
13
+ }.merge(options)
14
+ )
15
+ end
16
+
17
+ def self.update(company_id, options={})
18
+ request(:put, "/v1/users/me/professional_experience/companies/#{company_id}", options)
19
+ end
20
+
21
+ def self.delete(company_id, options={})
22
+ request(:delete, "/v1/users/me/professional_experience/companies/#{company_id}", options)
23
+ end
24
+
25
+ def self.primary_company(company_id, options={})
26
+ request(:put, '/v1/users/me/professional_experience/primary_company', { :company_id => company_id }.merge(options))
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,13 @@
1
+ module XingApi
2
+ class User::Language < XingApi::Base
3
+
4
+ def self.update(language, options={})
5
+ request(:put, "/v1/users/me/languages/#{language}", options)
6
+ end
7
+
8
+ def self.delete(language, options={})
9
+ request(:delete, "/v1/users/me/languages/#{language}", options)
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module XingApi
2
+ class User::Photo < XingApi::Base
3
+
4
+ def self.update(body_hash, options={})
5
+ request_with_body(:put, '/v1/users/me/photo', body_hash, options)
6
+ end
7
+
8
+ def self.delete(options={})
9
+ request(:delete, '/v1/users/me/photo', options)
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module XingApi
2
+ class User::PrivateAddress < XingApi::Base
3
+
4
+ def self.update(options={})
5
+ request(:put, '/v1/users/me/private_address', options)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module XingApi
2
+ class User::Qualification < XingApi::Base
3
+
4
+ def self.create(description, options={})
5
+ request(
6
+ :post,
7
+ '/v1/users/me/educational_background/qualifications',
8
+ { :description => description }.merge(options)
9
+ )
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module XingApi
2
+ class User::School < XingApi::Base
3
+
4
+ def self.create(name, options={})
5
+ request(:post, '/v1/users/me/educational_background/schools', { :name => name }.merge(options))
6
+ end
7
+
8
+ def self.update(school_id, options={})
9
+ request(:put, "/v1/users/me/educational_background/schools/#{school_id}", options)
10
+ end
11
+
12
+ def self.delete(school_id, options={})
13
+ request(:delete, "/v1/users/me/educational_background/schools/#{school_id}", options)
14
+ end
15
+
16
+ def self.primary_school(school_id, options={})
17
+ request(:put, '/v1/users/me/educational_background/schools', { :school_id => school_id }.merge(options))
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module XingApi
2
+ class User::WebProfile < XingApi::Base
3
+
4
+ def self.delete(profile, options={})
5
+ request(:delete, "/v1/users/me/web_profiles/#{profile}", options)
6
+ end
7
+
8
+ end
9
+ end
data/lib/xing_api/user.rb CHANGED
@@ -37,5 +37,13 @@ module XingApi
37
37
  request(:post, '/v1/users/me/status_message', {:message => message}.merge(options))
38
38
  end
39
39
 
40
+ def self.share_link(uri, options={})
41
+ request(:post, "/v1/users/me/share/link", options = {uri: uri}.merge(options))
42
+ end
43
+
44
+ def self.update(options={})
45
+ request(:put, '/v1/users/me', options)
46
+ end
47
+
40
48
  end
41
49
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module XingApi
3
- VERSION = '0.1' unless defined?(XingApi::VERSION)
3
+ VERSION = '0.2' unless defined?(XingApi::VERSION)
4
4
  end
data/lib/xing_api.rb CHANGED
@@ -17,13 +17,21 @@ require 'xing_api/contact_request'
17
17
  require 'xing_api/conversation'
18
18
  require 'xing_api/conversation/attachment'
19
19
  require 'xing_api/conversation/message'
20
- require 'xing_api/geo_location'
21
20
  require 'xing_api/invite'
22
21
  require 'xing_api/job'
23
22
  require 'xing_api/profile_message'
24
23
  require 'xing_api/profile_visit'
25
24
  require 'xing_api/user'
25
+ require 'xing_api/user/birth_date'
26
+ require 'xing_api/user/business_address'
27
+ require 'xing_api/user/company'
28
+ require 'xing_api/user/language'
29
+ require 'xing_api/user/photo'
30
+ require 'xing_api/user/private_address'
31
+ require 'xing_api/user/qualification'
26
32
  require 'xing_api/user/recommendation'
33
+ require 'xing_api/user/school'
34
+ require 'xing_api/user/web_profile'
27
35
 
28
36
  module XingApi
29
37
  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.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-11 00:00:00.000000000 Z
13
+ date: 2015-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: oauth
@@ -61,7 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
- name: debugger
64
+ name: rake
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
@@ -85,28 +85,36 @@ executables: []
85
85
  extensions: []
86
86
  extra_rdoc_files: []
87
87
  files:
88
+ - lib/xing_api/profile_visit.rb
88
89
  - lib/xing_api/activity/comment.rb
89
90
  - lib/xing_api/activity/like.rb
91
+ - lib/xing_api/error.rb
92
+ - lib/xing_api/user.rb
93
+ - lib/xing_api/response_handler.rb
94
+ - lib/xing_api/invite.rb
95
+ - lib/xing_api/contact_request.rb
96
+ - lib/xing_api/version.rb
97
+ - lib/xing_api/user/school.rb
98
+ - lib/xing_api/user/qualification.rb
99
+ - lib/xing_api/user/photo.rb
100
+ - lib/xing_api/user/recommendation.rb
101
+ - lib/xing_api/user/language.rb
102
+ - lib/xing_api/user/company.rb
103
+ - lib/xing_api/user/private_address.rb
104
+ - lib/xing_api/user/web_profile.rb
105
+ - lib/xing_api/user/birth_date.rb
106
+ - lib/xing_api/user/business_address.rb
107
+ - lib/xing_api/contact.rb
108
+ - lib/xing_api/profile_message.rb
109
+ - lib/xing_api/conversation.rb
110
+ - lib/xing_api/conversation/message.rb
111
+ - lib/xing_api/conversation/attachment.rb
90
112
  - lib/xing_api/activity.rb
91
113
  - lib/xing_api/base.rb
92
- - lib/xing_api/bookmark.rb
93
114
  - lib/xing_api/client.rb
115
+ - lib/xing_api/bookmark.rb
94
116
  - lib/xing_api/contact/tag.rb
95
- - lib/xing_api/contact.rb
96
- - lib/xing_api/contact_request.rb
97
- - lib/xing_api/conversation/attachment.rb
98
- - lib/xing_api/conversation/message.rb
99
- - lib/xing_api/conversation.rb
100
- - lib/xing_api/error.rb
101
- - lib/xing_api/geo_location.rb
102
- - lib/xing_api/invite.rb
103
117
  - lib/xing_api/job.rb
104
- - lib/xing_api/profile_message.rb
105
- - lib/xing_api/profile_visit.rb
106
- - lib/xing_api/response_handler.rb
107
- - lib/xing_api/user/recommendation.rb
108
- - lib/xing_api/user.rb
109
- - lib/xing_api/version.rb
110
118
  - lib/xing_api.rb
111
119
  homepage: https://github.com/xing/xing_api
112
120
  licenses:
@@ -1,17 +0,0 @@
1
- module XingApi
2
- class GeoLocation < XingApi::Base
3
-
4
- def self.create(accuracy, latitude, longitude, options={})
5
- request(:put, '/v1/users/me/geo_location', {
6
- :accuracy => accuracy,
7
- :latitude => latitude,
8
- :longitude => longitude
9
- }.merge(options))
10
- end
11
-
12
- def self.nearby_users(options={})
13
- request(:get, '/v1/users/me/nearby_users', options)
14
- end
15
-
16
- end
17
- end