orkut 0.0.0.16 → 0.0.0.17
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'orkut/error'
|
1
2
|
require 'orkut/client/base'
|
2
3
|
require 'orkut/constants/fields'
|
3
4
|
require 'orkut/constants/group'
|
@@ -13,7 +14,32 @@ module Orkut
|
|
13
14
|
# TODO implements features
|
14
15
|
|
15
16
|
def get_comments(options={})
|
17
|
+
raise(Orkut::Error, 'Parameter activity_id cannot be nil') if options[:activity_id].blank?
|
18
|
+
params = {
|
19
|
+
Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE,
|
20
|
+
Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON,
|
21
|
+
Orkut::Constants::Fields::ACTIVITY_ID => options[:activity_id],
|
22
|
+
Orkut::Constants::Fields::MAX_RESULTS => (options[:count] || Orkut::Client::Base::DEFAULT_COUNT).to_s,
|
23
|
+
Orkut::Constants::Fields::EXTRA_PARAMS => options
|
24
|
+
}
|
25
|
+
unless options[:page_token].blank?
|
26
|
+
params[Orkut::Constants::Fields::PAGE_TOKEN] = options[:page_token]
|
27
|
+
end
|
28
|
+
MultiJson.decode(execute(Orkut::Constants::Fields::COMMENTS, Orkut::Constants::Action::LIST, params))
|
29
|
+
end
|
16
30
|
|
31
|
+
def insert_comment(options={})
|
32
|
+
raise(Orkut::Error, 'Parameters activity_id and content cannot be nil') if options[:activity_id].blank? or options[:content].blank?
|
33
|
+
params = {
|
34
|
+
Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE,
|
35
|
+
Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON,
|
36
|
+
Orkut::Constants::Fields::ACTIVITY_ID => options[:activity_id],
|
37
|
+
Orkut::Constants::Fields::EXTRA_PARAMS => options
|
38
|
+
}
|
39
|
+
body = {
|
40
|
+
Orkut::Constants::Fields::CONTENT => options[:content]
|
41
|
+
}.to_json
|
42
|
+
MultiJson.decode(execute(Orkut::Constants::Fields::COMMENTS, Orkut::Constants::Action::INSERT, params, body.to_s, default_headers))
|
17
43
|
end
|
18
44
|
end
|
19
45
|
end
|
@@ -53,7 +53,7 @@ module Orkut
|
|
53
53
|
Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE,
|
54
54
|
Orkut::Constants::Fields::COLLECTION => Orkut::Constants::Collection::STREAM,
|
55
55
|
Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON,
|
56
|
-
Orkut::Constants::Fields::MAX_RESULTS => (options[:count] || Orkut::Client::Base::DEFAULT_COUNT),
|
56
|
+
Orkut::Constants::Fields::MAX_RESULTS => (options[:count] || Orkut::Client::Base::DEFAULT_COUNT).to_s,
|
57
57
|
Orkut::Constants::Fields::EXTRA_PARAMS => options
|
58
58
|
}
|
59
59
|
unless options[:page_token].blank?
|
@@ -67,7 +67,7 @@ module Orkut
|
|
67
67
|
Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE,
|
68
68
|
Orkut::Constants::Fields::COLLECTION => Orkut::Constants::Collection::SCRAPS,
|
69
69
|
Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON,
|
70
|
-
Orkut::Constants::Fields::MAX_RESULTS => (options[:count] || Orkut::Client::Base::DEFAULT_COUNT),
|
70
|
+
Orkut::Constants::Fields::MAX_RESULTS => (options[:count] || Orkut::Client::Base::DEFAULT_COUNT).to_s,
|
71
71
|
Orkut::Constants::Fields::EXTRA_PARAMS => options
|
72
72
|
}
|
73
73
|
unless options[:page_token].blank?
|
@@ -37,6 +37,7 @@ module Orkut
|
|
37
37
|
COALESCE = 'coalesce'
|
38
38
|
COLLECTION = 'collection'
|
39
39
|
COMMENTS = 'comments'
|
40
|
+
CONTENT = 'content'
|
40
41
|
COUNT = 'count'
|
41
42
|
CREATED = 'created'
|
42
43
|
DESCRIPTION = 'description'
|
@@ -51,6 +52,7 @@ module Orkut
|
|
51
52
|
FROM_USER_PROFILE = 'fromUserProfile'
|
52
53
|
GENDER = 'gender'
|
53
54
|
GROUP_ID = 'groupId'
|
55
|
+
KIND = 'kind'
|
54
56
|
ID = 'id'
|
55
57
|
|
56
58
|
# the json field for location
|
data/lib/orkut/request.rb
CHANGED
@@ -53,16 +53,17 @@ module Orkut
|
|
53
53
|
connection_v1.delete(verify_path(path), headers)
|
54
54
|
end
|
55
55
|
|
56
|
-
def execute(entity, action, params = {})
|
56
|
+
def execute(entity, action, params = {}, body = '', headers = {})
|
57
57
|
raise(Orkut::Error, 'Parameters entity and action cannot be nil') if entity.blank? or action.blank?
|
58
58
|
raise(Orkut::Error, 'Parameter body cannot be nil or empty') if params.blank? or params.empty?
|
59
59
|
|
60
60
|
extra = params.delete(Orkut::Constants::Fields::EXTRA_PARAMS)
|
61
61
|
|
62
62
|
orkut = connection.discovered_api('orkut', 'v2')
|
63
|
-
response = connection(extra).execute(orkut.try(entity.to_sym).try(action.to_sym), params)
|
63
|
+
response = connection(extra).execute(orkut.try(entity.to_sym).try(action.to_sym), params, body, headers)
|
64
64
|
status, headers, body = response
|
65
|
-
body
|
65
|
+
return body.first if status == 200
|
66
|
+
''
|
66
67
|
end
|
67
68
|
|
68
69
|
def verify_path(path)
|
data/lib/orkut/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orkut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-03 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &23947800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *23947800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: multi_json
|
27
|
-
requirement: &
|
27
|
+
requirement: &23947260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *23947260
|
36
36
|
description: A Ruby wrapper for the Orkut REST/RPC API.
|
37
37
|
email:
|
38
38
|
- contato@umanni.com
|