xing_api 0.4 → 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: c1a7be94fd7c7d55947d9312898b59f59a839143
4
- data.tar.gz: 403855b22b5df86e265d047218d252c4debde1cb
3
+ metadata.gz: b6ebd6a8db28d4331b667fda72dc865a8efcb522
4
+ data.tar.gz: 85c819746f7f40c80d72ba2583ea223acd4b6903
5
5
  SHA512:
6
- metadata.gz: 8c6e1c632c694727f8c993b994842d8e9264c8b3a9dfe4c492dd9ca4008367b0bc285b80bae2d4b8a7e64e90d3aabd4838bd3e2104a00b92c40950ed17168c7b
7
- data.tar.gz: a0d8fae6f888e946dadb664bcff1e6a28319abdd4950c5fef98c6bbe4a0b38b37d4b2173da416ad7a0a25218649a649a7b2736b622caab28a87ea88002ebc01b
6
+ metadata.gz: 14a604c122eec6713d4c89851c9758e84dc0dab589ecc9dab2ec1d23ea6e419fe49be7d7f72cecfd9a4ad5a30453c99406f33cc2cdfa4350d92b3378528fc9e3
7
+ data.tar.gz: 8aef4b80734d9433341bfbfc0a42cc6d703c46817304e283d1970588f857c3099578d282d429b8d35fb4cf8667fcb26d747ccd8ec091a5e8cb3359ece603ee4f
@@ -18,8 +18,19 @@ require 'xing_api/conversation'
18
18
  require 'xing_api/conversation/attachment'
19
19
  require 'xing_api/conversation/message'
20
20
  require 'xing_api/group'
21
+ require 'xing_api/group/forum'
22
+ require 'xing_api/group/forum/post'
23
+ require 'xing_api/group/media_preview'
24
+ require 'xing_api/group/post'
25
+ require 'xing_api/group/post/comment'
26
+ require 'xing_api/group/post/comment/like'
27
+ require 'xing_api/group/post/like'
21
28
  require 'xing_api/invite'
22
29
  require 'xing_api/job'
30
+ require 'xing_api/news/article'
31
+ require 'xing_api/news/article/like'
32
+ require 'xing_api/news/page'
33
+ require 'xing_api/news/page/article'
23
34
  require 'xing_api/profile_message'
24
35
  require 'xing_api/profile_visit'
25
36
  require 'xing_api/user'
@@ -2,7 +2,7 @@ module XingApi
2
2
  class Client
3
3
  include XingApi::ResponseHandler
4
4
 
5
- OAUTH_ATTRIBUTES = [:consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret]
5
+ OAUTH_ATTRIBUTES = [:consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret].freeze
6
6
  attr_writer(*OAUTH_ATTRIBUTES)
7
7
  attr_accessor :request_token_hash
8
8
 
@@ -65,8 +65,8 @@ module XingApi
65
65
  private
66
66
 
67
67
  def rebuild_request_token(options)
68
- request_token = options[:request_token] || fail('request_token missing')
69
- request_token_secret = options[:request_token_secret] || fail('request_token_secret missing')
68
+ request_token = options[:request_token] || raise('request_token missing')
69
+ request_token_secret = options[:request_token_secret] || raise('request_token_secret missing')
70
70
  OAuth::RequestToken.new(consumer, request_token, request_token_secret)
71
71
  end
72
72
 
@@ -110,7 +110,7 @@ module XingApi
110
110
 
111
111
  def ensure_attributes_are_set!(attribute_names)
112
112
  Array(attribute_names).each do |attribute_name|
113
- fail "#{attribute_name} is missing" unless send(attribute_name)
113
+ raise "#{attribute_name} is missing" unless send(attribute_name)
114
114
  end
115
115
  end
116
116
  end
@@ -1,7 +1,23 @@
1
1
  module XingApi
2
2
  class Group < XingApi::Base
3
+ def self.list(user_id, options = {})
4
+ request(:get, "/v1/users/#{user_id}/groups", options)
5
+ end
6
+
3
7
  def self.search(keywords, options = {})
4
8
  request(:get, '/v1/groups/find', { keywords: keywords }.merge(options))
5
9
  end
10
+
11
+ def self.read(group_id, options = {})
12
+ request(:put, "/v1/groups/#{group_id}/read", options)
13
+ end
14
+
15
+ def self.join(group_id, options = {})
16
+ request(:post, "/v1/groups/#{group_id}/memberships", options)
17
+ end
18
+
19
+ def self.leave(group_id, options = {})
20
+ request(:delete, "/v1/groups/#{group_id}/memberships", options)
21
+ end
6
22
  end
7
23
  end
@@ -0,0 +1,9 @@
1
+ module XingApi
2
+ class Group
3
+ class Forum < XingApi::Base
4
+ def self.list(group_id, options = {})
5
+ request(:get, "/v1/groups/#{group_id}/forums", options)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ module XingApi
2
+ class Group
3
+ class Forum
4
+ class Post < XingApi::Base
5
+ def self.list(forum_id, options = {})
6
+ request(:get, "/v1/groups/forums/#{forum_id}/posts", options)
7
+ end
8
+
9
+ def self.create(forum_id, title, content, options = {})
10
+ request(:post, "/v1/groups/forums/#{forum_id}/posts", { title: title, content: content }.merge(options))
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module XingApi
2
+ class Group
3
+ class MediaPreview < XingApi::Base
4
+ def self.create(url, options = {})
5
+ request(:post, '/v1/groups/media_previews', { url: url }.merge(options))
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module XingApi
2
+ class Group
3
+ class Post < XingApi::Base
4
+ def self.list(group_id, options = {})
5
+ request(:get, "/v1/groups/#{group_id}/posts", options)
6
+ end
7
+
8
+ def self.find(post_id, options = {})
9
+ request(:get, "/v1/groups/forums/posts/#{post_id}", options)
10
+ end
11
+
12
+ def self.delete(post_id, options = {})
13
+ request(:delete, "/v1/groups/forums/posts/#{post_id}", options)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module XingApi
2
+ class Group
3
+ class Post
4
+ class Comment < XingApi::Base
5
+ def self.list(post_id, options = {})
6
+ request(:get, "/v1/groups/forums/posts/#{post_id}/comments", options)
7
+ end
8
+
9
+ def self.create(post_id, content, options = {})
10
+ request(:post, "/v1/groups/forums/posts/#{post_id}/comments", { content: content }.merge(options))
11
+ end
12
+
13
+ def self.delete(comment_id, options = {})
14
+ request(:delete, "/v1/groups/forums/posts/comments/#{comment_id}", options)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ module XingApi
2
+ class Group
3
+ class Post
4
+ class Comment
5
+ class Like < XingApi::Base
6
+ def self.list(comment_id, options = {})
7
+ request(:get, "/v1/groups/forums/posts/comments/#{comment_id}/likes", options)
8
+ end
9
+
10
+ def self.create(comment_id, options = {})
11
+ request(:put, "/v1/groups/forums/posts/comments/#{comment_id}/like", options)
12
+ end
13
+
14
+ def self.delete(comment_id, options = {})
15
+ request(:delete, "/v1/groups/forums/posts/comments/#{comment_id}/like", options)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module XingApi
2
+ class Group
3
+ class Post
4
+ class Like < XingApi::Base
5
+ def self.list(post_id, options = {})
6
+ request(:get, "/v1/groups/forums/posts/#{post_id}/likes", options)
7
+ end
8
+
9
+ def self.create(post_id, options = {})
10
+ request(:put, "/v1/groups/forums/posts/#{post_id}/like", options)
11
+ end
12
+
13
+ def self.delete(post_id, options = {})
14
+ request(:delete, "/v1/groups/forums/posts/#{post_id}/like", options)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module XingApi
2
+ module News
3
+ class Article < XingApi::Base
4
+ def self.find(article_id, options = {})
5
+ request(:get, "/v1/news/articles/#{article_id}", options)
6
+ end
7
+
8
+ def self.update(article_id, version, options = {})
9
+ request(:put, "/v1/news/articles/#{article_id}", { version: version }.merge(options))
10
+ end
11
+
12
+ def self.delete(article_id, version, options = {})
13
+ request(:delete, "/v1/news/articles/#{article_id}", { version: version }.merge(options))
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module XingApi
2
+ module News
3
+ class Article
4
+ class Like < XingApi::Base
5
+ def self.list(article_id, options = {})
6
+ request(:get, "/v1/news/articles/#{article_id}/likes", options)
7
+ end
8
+
9
+ def self.create(article_id, options = {})
10
+ request(:put, "/v1/news/articles/#{article_id}/like", options)
11
+ end
12
+
13
+ def self.delete(article_id, options = {})
14
+ request(:delete, "/v1/news/articles/#{article_id}/like", options)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module XingApi
2
+ module News
3
+ class Page < XingApi::Base
4
+ def self.find(page_id, options = {})
5
+ request(:get, "/v1/news/pages/#{page_id}", options)
6
+ end
7
+
8
+ def self.list_editable(options = {})
9
+ request(:get, '/v1/users/me/news/pages/editable', options)
10
+ end
11
+
12
+ def self.list_following(options = {})
13
+ request(:get, '/v1/users/me/news/pages/following', options)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module XingApi
2
+ module News
3
+ class Page
4
+ class Article < XingApi::Base
5
+ def self.create(page_id, source_url, title, options = {})
6
+ request(:post, "/v1/news/pages/#{page_id}/articles", { source_url: source_url, title: title }.merge(options))
7
+ end
8
+
9
+ def self.list(page_id, options = {})
10
+ request(:get, "/v1/news/pages/#{page_id}/articles", options)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -11,12 +11,12 @@ module XingApi
11
11
  NONCE_MISSING
12
12
  INVALID_OAUTH_VERSION
13
13
  REQUIRED_PARAMETER_MISSING
14
- )
14
+ ).freeze
15
15
 
16
16
  def handle(response)
17
17
  return {} if response.code.to_i == 204
18
18
 
19
- unless (200..299).include?(response.code.to_i)
19
+ unless (200..299).cover?(response.code.to_i)
20
20
  raise_failed_response!(response)
21
21
  end
22
22
 
@@ -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], body[:errors])
35
+ raise 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)
@@ -32,10 +32,6 @@ module XingApi
32
32
  request(:get, '/v1/users/find_by_emails', { emails: emails }.merge(options))
33
33
  end
34
34
 
35
- def self.groups(user_id, options = {})
36
- request(:get, "/v1/users/#{user_id}/groups", options)
37
- end
38
-
39
35
  def self.status_message(message, options = {})
40
36
  request(:post, '/v1/users/me/status_message', { message: message }.merge(options))
41
37
  end
@@ -1,3 +1,3 @@
1
1
  module XingApi
2
- VERSION = '0.4' unless defined?(XingApi::VERSION)
2
+ VERSION = '0.5' 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.4'
4
+ version: '0.5'
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-09-06 00:00:00.000000000 Z
12
+ date: 2016-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -106,8 +106,19 @@ files:
106
106
  - lib/xing_api/conversation/message.rb
107
107
  - lib/xing_api/error.rb
108
108
  - lib/xing_api/group.rb
109
+ - lib/xing_api/group/forum.rb
110
+ - lib/xing_api/group/forum/post.rb
111
+ - lib/xing_api/group/media_preview.rb
112
+ - lib/xing_api/group/post.rb
113
+ - lib/xing_api/group/post/comment.rb
114
+ - lib/xing_api/group/post/comment/like.rb
115
+ - lib/xing_api/group/post/like.rb
109
116
  - lib/xing_api/invite.rb
110
117
  - lib/xing_api/job.rb
118
+ - lib/xing_api/news/article.rb
119
+ - lib/xing_api/news/article/like.rb
120
+ - lib/xing_api/news/page.rb
121
+ - lib/xing_api/news/page/article.rb
111
122
  - lib/xing_api/profile_message.rb
112
123
  - lib/xing_api/profile_visit.rb
113
124
  - lib/xing_api/response_handler.rb
@@ -143,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
154
  version: 1.3.5
144
155
  requirements: []
145
156
  rubyforge_project:
146
- rubygems_version: 2.4.5
157
+ rubygems_version: 2.5.1
147
158
  signing_key:
148
159
  specification_version: 4
149
160
  summary: Official Ruby wrapper for the XING API