orkut 0.0.0.1
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.
- data/Gemfile +4 -0
- data/LICENSE +13 -0
- data/README.rdoc +11 -0
- data/Rakefile +9 -0
- data/lib/orkut/api.rb +23 -0
- data/lib/orkut/authenticatable.rb +24 -0
- data/lib/orkut/base.rb +23 -0
- data/lib/orkut/client/messages.rb +23 -0
- data/lib/orkut/client/timelines.rb +53 -0
- data/lib/orkut/client.rb +12 -0
- data/lib/orkut/config.rb +89 -0
- data/lib/orkut/connection.rb +27 -0
- data/lib/orkut/constants/activity_type.rb +28 -0
- data/lib/orkut/constants/fields.rb +91 -0
- data/lib/orkut/constants/group.rb +13 -0
- data/lib/orkut/constants/internal_constants.rb +17 -0
- data/lib/orkut/constants/method_names.rb +40 -0
- data/lib/orkut/constants/params.rb +45 -0
- data/lib/orkut/request.rb +60 -0
- data/lib/orkut/version.rb +25 -0
- data/lib/orkut.rb +24 -0
- data/orkut.gemspec +25 -0
- metadata +80 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2011 Umanni
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
data/lib/orkut/api.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'orkut/authenticatable'
|
2
|
+
require 'orkut/config'
|
3
|
+
require 'orkut/connection'
|
4
|
+
require 'orkut/request'
|
5
|
+
|
6
|
+
module Orkut
|
7
|
+
class API
|
8
|
+
include Authenticatable
|
9
|
+
include Connection
|
10
|
+
include Request
|
11
|
+
|
12
|
+
attr_accessor *Config::VALID_OPTIONS_KEYS
|
13
|
+
|
14
|
+
# Creates a new API
|
15
|
+
def initialize(options={})
|
16
|
+
options = Orkut.options.merge(options)
|
17
|
+
Config::VALID_OPTIONS_KEYS.each do |key|
|
18
|
+
send("#{key}=", options[key])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Orkut
|
2
|
+
module Authenticatable
|
3
|
+
|
4
|
+
# Credentials hash
|
5
|
+
#
|
6
|
+
# @return [Hash]
|
7
|
+
def credentials
|
8
|
+
{
|
9
|
+
:consumer_key => consumer_key,
|
10
|
+
:consumer_secret => consumer_secret,
|
11
|
+
:token => oauth_token,
|
12
|
+
:token_secret => oauth_token_secret,
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
# Check whether user is authenticated
|
17
|
+
#
|
18
|
+
# @return [Boolean]
|
19
|
+
def authenticated?
|
20
|
+
credentials.values.all?
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/orkut/base.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Orkut
|
2
|
+
class Base
|
3
|
+
|
4
|
+
def self.lazy_attr_reader(*attributes)
|
5
|
+
attributes.each do |attribute|
|
6
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
7
|
+
def #{attribute}
|
8
|
+
@#{attribute} ||= @attributes[#{attribute.to_s.inspect}]
|
9
|
+
end
|
10
|
+
RUBY
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(attributes = {})
|
15
|
+
@attributes = attributes.dup
|
16
|
+
end
|
17
|
+
|
18
|
+
def [](method)
|
19
|
+
self.__send__(method.to_sym)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Orkut
|
2
|
+
class Client
|
3
|
+
# Defines methods related to timelines
|
4
|
+
module Messages
|
5
|
+
|
6
|
+
def home_timeline(options={})
|
7
|
+
params = [{
|
8
|
+
"params" => {
|
9
|
+
"pageType" => "first",
|
10
|
+
"messageType" => "public_message",
|
11
|
+
"groupId" => "@friends",
|
12
|
+
"count" => 20,
|
13
|
+
"messageFormat" => "fullHtml"
|
14
|
+
},
|
15
|
+
"id" => "0-messages.get",
|
16
|
+
"method" => "messages.get"
|
17
|
+
}]
|
18
|
+
headers = {'Content-Type' => 'application/json'}
|
19
|
+
post(nil, params.to_s, headers).body
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'orkut/constants/fields'
|
2
|
+
require 'orkut/constants/group'
|
3
|
+
require 'orkut/constants/internal_constants'
|
4
|
+
require 'orkut/constants/method_names'
|
5
|
+
require 'orkut/constants/params'
|
6
|
+
|
7
|
+
module Orkut
|
8
|
+
class Client
|
9
|
+
# Defines methods related to timelines
|
10
|
+
module Timelines
|
11
|
+
|
12
|
+
DEFAULT_COUNT = 40
|
13
|
+
|
14
|
+
def home_timeline(options={})
|
15
|
+
params = [{
|
16
|
+
Orkut::Constants::Fields::PARAMS => {
|
17
|
+
Orkut::Constants::Params::GROUP_ID => Orkut::Constants::Group::ALL,
|
18
|
+
Orkut::Constants::Params::USER_ID => Orkut::Constants::InternalConstants::USERID_ME,
|
19
|
+
Orkut::Constants::Params::COUNT => (options[:count] || DEFAULT_COUNT),
|
20
|
+
Orkut::Constants::Fields::COALESCE => true,
|
21
|
+
Orkut::Constants::Fields::START_INDEX => 0
|
22
|
+
},
|
23
|
+
Orkut::Constants::Fields::ID => ''+Orkut::Constants::MethodNames::ACTIVITIES_GET,
|
24
|
+
Orkut::Constants::Fields::METHOD => Orkut::Constants::MethodNames::ACTIVITIES_GET
|
25
|
+
}]
|
26
|
+
post(nil, params.to_s, default_headers).body
|
27
|
+
end
|
28
|
+
|
29
|
+
def scraps_timeline(options={})
|
30
|
+
params = [{
|
31
|
+
Orkut::Constants::Fields::PARAMS => {
|
32
|
+
Orkut::Constants::Fields::PAGE_TYPE => Orkut::Constants::Params::PageType::FIRST,
|
33
|
+
Orkut::Constants::Fields::MESSAGE_TYPE => Orkut::Constants::InternalConstants::Values::PUBLIC_MESSAGE,
|
34
|
+
Orkut::Constants::Params::GROUP_ID => Orkut::Constants::Group::FRIENDS,
|
35
|
+
Orkut::Constants::Params::USER_ID => Orkut::Constants::InternalConstants::USERID_ME,
|
36
|
+
Orkut::Constants::Params::COUNT => (options[:count] || DEFAULT_COUNT),
|
37
|
+
Orkut::Constants::Fields::MESSAGE_FORMAT => Orkut::Constants::Params::MessageFormat::FULL_HTML
|
38
|
+
},
|
39
|
+
Orkut::Constants::Fields::ID => '-'+Orkut::Constants::MethodNames::MESSAGES_GET,
|
40
|
+
Orkut::Constants::Fields::METHOD => Orkut::Constants::MethodNames::MESSAGES_GET
|
41
|
+
}]
|
42
|
+
post(nil, params.to_s, default_headers).body
|
43
|
+
end
|
44
|
+
|
45
|
+
def default_headers
|
46
|
+
return {
|
47
|
+
Orkut::Constants::InternalConstants::CONTENT_TYPE => Orkut::Constants::InternalConstants::JSON_CONTENT_TYPE,
|
48
|
+
Orkut::Constants::InternalConstants::ORKUT_CLIENT_LIB_HEADER => Orkut::Version.to_s
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/orkut/client.rb
ADDED
data/lib/orkut/config.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'orkut/version'
|
2
|
+
|
3
|
+
module Orkut
|
4
|
+
# Defines constants and methods related to configuration
|
5
|
+
module Config
|
6
|
+
# An array of valid keys in the options hash when configuring a {Orkut::API}
|
7
|
+
VALID_OPTIONS_KEYS = [
|
8
|
+
:site,
|
9
|
+
:request_token_path,
|
10
|
+
:access_token_path,
|
11
|
+
:authorize_path,
|
12
|
+
:endpoint,
|
13
|
+
:endpoint_rest,
|
14
|
+
:endpoint_rpc,
|
15
|
+
:user_agent,
|
16
|
+
:consumer_key,
|
17
|
+
:consumer_secret,
|
18
|
+
:oauth_token,
|
19
|
+
:oauth_token_secret].freeze
|
20
|
+
|
21
|
+
DEFAULT_SITE = 'https://www.google.com'.freeze
|
22
|
+
|
23
|
+
DEFAULT_REQUEST_TOKEN_PATH = '/accounts/OAuthGetRequestToken'.freeze
|
24
|
+
|
25
|
+
DEFAULT_ACCESS_TOKEN_PATH = '/accounts/OAuthGetAccessToken'.freeze
|
26
|
+
|
27
|
+
DEFAULT_AUTHORIZE_PATH = '/accounts/OAuthAuthorizeToken'.freeze
|
28
|
+
|
29
|
+
# By default, don't set an application key
|
30
|
+
DEFAULT_CONSUMER_KEY = nil
|
31
|
+
|
32
|
+
# By default, don't set an application secret
|
33
|
+
DEFAULT_CONSUMER_SECRET = nil
|
34
|
+
|
35
|
+
# The endpoint that will be used to connect if none is set
|
36
|
+
DEFAULT_ENDPOINT = 'http://www.orkut.com/social/rpc'.freeze
|
37
|
+
|
38
|
+
DEFAULT_ENDPOINT_REST = 'http://www.orkut.com/social/rest'.freeze
|
39
|
+
|
40
|
+
DEFAULT_ENDPOINT_RPC = 'http://www.orkut.com/social/rpc'.freeze
|
41
|
+
|
42
|
+
# By default, don't set a user oauth token
|
43
|
+
DEFAULT_OAUTH_TOKEN = nil
|
44
|
+
|
45
|
+
# By default, don't set a user oauth secret
|
46
|
+
DEFAULT_OAUTH_TOKEN_SECRET = nil
|
47
|
+
|
48
|
+
# The value sent in the 'User-Agent' header if none is set
|
49
|
+
DEFAULT_USER_AGENT = "Orkut Ruby Gem #{Orkut::Version}".freeze
|
50
|
+
|
51
|
+
attr_accessor *VALID_OPTIONS_KEYS
|
52
|
+
|
53
|
+
# When this module is extended, set all configuration options to their default values
|
54
|
+
def self.extended(base)
|
55
|
+
base.reset
|
56
|
+
end
|
57
|
+
|
58
|
+
# Convenience method to allow configuration options to be set in a block
|
59
|
+
def configure
|
60
|
+
yield self
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
# Create a hash of options and their values
|
65
|
+
def options
|
66
|
+
options = {}
|
67
|
+
VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
|
68
|
+
options
|
69
|
+
end
|
70
|
+
|
71
|
+
# Reset all configuration options to defaults
|
72
|
+
def reset
|
73
|
+
self.site = DEFAULT_SITE
|
74
|
+
self.request_token_path = DEFAULT_REQUEST_TOKEN_PATH
|
75
|
+
self.access_token_path = DEFAULT_ACCESS_TOKEN_PATH
|
76
|
+
self.authorize_path = DEFAULT_AUTHORIZE_PATH
|
77
|
+
self.consumer_key = DEFAULT_CONSUMER_KEY
|
78
|
+
self.consumer_secret = DEFAULT_CONSUMER_SECRET
|
79
|
+
self.endpoint = DEFAULT_ENDPOINT
|
80
|
+
self.endpoint_rest = DEFAULT_ENDPOINT_REST
|
81
|
+
self.endpoint_rpc = DEFAULT_ENDPOINT_RPC
|
82
|
+
self.oauth_token = DEFAULT_OAUTH_TOKEN
|
83
|
+
self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET
|
84
|
+
self.user_agent = DEFAULT_USER_AGENT
|
85
|
+
self
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
|
3
|
+
module Orkut
|
4
|
+
module Connection
|
5
|
+
private
|
6
|
+
|
7
|
+
def connection(options={})
|
8
|
+
access_token = nil
|
9
|
+
if authenticated?
|
10
|
+
client_options = {
|
11
|
+
:site => site,
|
12
|
+
:request_token_path => request_token_path,
|
13
|
+
:access_token_path => access_token_path,
|
14
|
+
:authorize_path => authorize_path
|
15
|
+
}
|
16
|
+
consumer = ::OAuth::Consumer.new(consumer_key, consumer_secret, client_options)
|
17
|
+
# now create the access token object from passed values
|
18
|
+
token_hash = { :oauth_token => oauth_token,
|
19
|
+
:oauth_token_secret => oauth_token_secret
|
20
|
+
}
|
21
|
+
access_token = ::OAuth::AccessToken.from_hash(consumer, token_hash)
|
22
|
+
end
|
23
|
+
access_token
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Orkut
|
2
|
+
module Constants
|
3
|
+
module ActivityType
|
4
|
+
module ActivityType
|
5
|
+
ALBUM = 'ALBUM'
|
6
|
+
ALBUM_SHARE = 'ALBUM_SHARE'
|
7
|
+
APPLICATION = 'APPLICATION'
|
8
|
+
COMMUNITY_CREATE = 'COMMUNITY_CREATE'
|
9
|
+
COMMUNITY_JOIN = 'COMMUNITY_JOIN'
|
10
|
+
FRIEND_ADD = 'FRIEND_ADD'
|
11
|
+
MAKAMAKA = 'MAKAMAKA'
|
12
|
+
PHOTO = 'PHOTO'
|
13
|
+
PHOTO_COMMENT = 'PHOTO_COMMENT'
|
14
|
+
PHOTO_TAG = 'PHOTO_TAG'
|
15
|
+
PROFILE_UPDATE = 'PROFILE_UPDATE'
|
16
|
+
SCRAP = 'SCRAP'
|
17
|
+
SKIN_CHANGE = 'SKIN_CHANGE'
|
18
|
+
SOCIAL_EVENTS_CREATION = 'SOCIAL_EVENTS_CREATION'
|
19
|
+
STATUS_MSG = 'STATUS_MSG'
|
20
|
+
STATUS_MSG_COMMENT = 'STATUS_MSG_COMMENT'
|
21
|
+
TESTIMONIAL = 'TESTIMONIAL'
|
22
|
+
TESTIMONIAL_USER = 'TESTIMONIAL_USER'
|
23
|
+
VIDEO = 'VIDEO'
|
24
|
+
VIDEO_COMMENT = 'VIDEO_COMMENT'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'orkut/constants/params'
|
2
|
+
|
3
|
+
module Orkut
|
4
|
+
module Constants
|
5
|
+
module Fields
|
6
|
+
module AclEntryFields
|
7
|
+
# Level of access for this entry in the ACL (read/write).
|
8
|
+
ACCESS_TYPE = 'accessType'
|
9
|
+
ACCESSOR_ID = 'accessorId'
|
10
|
+
# The identifier for this ACL entry.
|
11
|
+
ACCESSOR_INFO = 'accessorInfo'
|
12
|
+
# Specifies the type of user in this entry of the ACL.
|
13
|
+
ACCESSOR_TYPE = 'accessorType'
|
14
|
+
end
|
15
|
+
|
16
|
+
BIRTHDAY = 'birthday'
|
17
|
+
COUNTRY = 'country'
|
18
|
+
CURRENT_LOCATION = 'currentLocation'
|
19
|
+
LOCALITY = 'locality'
|
20
|
+
POSTAL_CODE = 'postal'
|
21
|
+
REGION = 'region'
|
22
|
+
ABOUT_ME = 'aboutMe'
|
23
|
+
# data specifying the ACL for this album
|
24
|
+
ACL = 'accessControlList'
|
25
|
+
ACTIVITY_TYPE = 'activityType'
|
26
|
+
ALBUM_ID = Orkut::Constants::Params::ALBUM_ID
|
27
|
+
ALBUM_TITLE = 'albumTitle'
|
28
|
+
ALLOW_IM = 'allowIm'
|
29
|
+
APP_ID = 'appId'
|
30
|
+
AUTHOR_ID = 'authorId'
|
31
|
+
|
32
|
+
BODY = 'body'
|
33
|
+
COALESCE = 'coalesce'
|
34
|
+
COMMENTS = 'comments'
|
35
|
+
CREATED = 'created'
|
36
|
+
DESCRIPTION = 'description'
|
37
|
+
DISPLAY_NAME = 'displayName'
|
38
|
+
EMAILS = 'emails'
|
39
|
+
# The list of entries in an ACL
|
40
|
+
ENTRIES = 'entries'
|
41
|
+
ERROR_TYPE = 'errorType'
|
42
|
+
FROM_USER_ID = 'fromUserId'
|
43
|
+
FROM_USER_PROFILE = 'fromUserProfile'
|
44
|
+
GENDER = 'gender'
|
45
|
+
ID = 'id'
|
46
|
+
|
47
|
+
# the json field for location
|
48
|
+
LOCATION = 'location'
|
49
|
+
# the json field for count of media items in album
|
50
|
+
MEDIA_ITEM_COUNT = 'mediaItemCount'
|
51
|
+
MEDIA_ITEMS = 'mediaItems'
|
52
|
+
# media mime types in the album
|
53
|
+
MEDIA_MIME_TYPE = 'mediaMimeType'
|
54
|
+
# media types in the album
|
55
|
+
MEDIA_TYPE = 'mediaType'
|
56
|
+
MESSAGE_TYPE = 'messageType'
|
57
|
+
METHOD = 'method'
|
58
|
+
NAME = 'name'
|
59
|
+
# The next two are subfields of 'name':
|
60
|
+
NAME_FAMILY_NAME = 'familyName'
|
61
|
+
NAME_GIVEN_NAME = 'givenName'
|
62
|
+
NOTE = 'note'
|
63
|
+
PAGE_TYPE = 'pageType'
|
64
|
+
PAGE_URL = 'pageUrl'
|
65
|
+
PARAMS = 'params'
|
66
|
+
PHONE_NUMBERS = 'phoneNumbers'
|
67
|
+
POSTED_TIME = 'postedTime'
|
68
|
+
PROFILE_FIELDS = 'profileFields'
|
69
|
+
PROFILE_URL = 'profileUrl'
|
70
|
+
RELATIONSHIP_STATUS = 'relationshipStatus'
|
71
|
+
RELEVANT_PROFILES = 'relevantProfiles'
|
72
|
+
RELEVANT_USER_IDS = 'relevantUserIds'
|
73
|
+
START_INDEX = 'startIndex'
|
74
|
+
STATUS = 'status'
|
75
|
+
TEMPLATE_PARAMS = 'templateParams'
|
76
|
+
TEXT = 'text'
|
77
|
+
# the json field for thumbnail url
|
78
|
+
THUMBNAIL_URL = 'thumbnailUrl'
|
79
|
+
TIME = 'time'
|
80
|
+
TITLE = 'title'
|
81
|
+
TOTAL_RESULTS = 'totalResults'
|
82
|
+
TYPE = 'type'
|
83
|
+
URL = 'url'
|
84
|
+
VALUE = 'value'
|
85
|
+
YOUTUBE_URL = 'youtubeUrl'
|
86
|
+
VIDEO_DURATION = 'durationInSec'
|
87
|
+
|
88
|
+
MESSAGE_FORMAT = "messageFormat";
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Orkut
|
2
|
+
module Constants
|
3
|
+
module InternalConstants
|
4
|
+
ORKUT_CLIENT_LIB_HEADER = 'X-Orkut-Client-Lib'
|
5
|
+
CONTENT_TYPE ='Content-Type'
|
6
|
+
JSON_CONTENT_TYPE = 'application/json'
|
7
|
+
USERID_ME = '@me'
|
8
|
+
|
9
|
+
module Values
|
10
|
+
ALBUMS = 'albums'
|
11
|
+
MEDIAITEMS = 'mediaitems'
|
12
|
+
PUBLIC_MESSAGE = 'public_message'
|
13
|
+
APP = '@app'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Orkut
|
2
|
+
module Constants
|
3
|
+
module MethodNames
|
4
|
+
ACL_CREATE = 'aclentries.create'
|
5
|
+
ACTIVITIES_GET = 'activities.get'
|
6
|
+
ALBUMS_CREATE = 'albums.create'
|
7
|
+
ALBUMS_DELETE = 'albums.delete'
|
8
|
+
ALBUMS_GET = 'albums.get'
|
9
|
+
ALBUMS_UPDATE = 'albums.update'
|
10
|
+
|
11
|
+
CAPTCHA_ANSWER = 'captcha.answer'
|
12
|
+
|
13
|
+
COMMENTS_CREATE = 'comments.create'
|
14
|
+
COMMENTS_DELETE = 'comments.delete'
|
15
|
+
COMMENTS_GET = 'comments.get'
|
16
|
+
|
17
|
+
CREATE_ACTIVITIES = 'activities.create'
|
18
|
+
|
19
|
+
FRIEND_REMOVE = 'people.removeFriend'
|
20
|
+
FRIEND_REQUEST_ACCEPT = 'people.acceptFriendRequest'
|
21
|
+
FRIEND_REQUEST_REJECT = 'people.rejectFriendRequest'
|
22
|
+
FRIEND_REQUEST_REVOKE = 'people.revokeFriendRequest'
|
23
|
+
FRIEND_REQUEST_SEND = 'people.sendFriendRequest'
|
24
|
+
|
25
|
+
MEDIAITEMS_CREATE = 'mediaitems.create'
|
26
|
+
MEDIAITEMS_DELETE = 'mediaitems.delete'
|
27
|
+
MEDIAITEMS_GET = 'mediaitems.get'
|
28
|
+
MEDIAITEMS_UPDATE = 'mediaitems.update'
|
29
|
+
|
30
|
+
MESSAGES_CREATE = 'messages.create'
|
31
|
+
MESSAGES_DELETE = 'messages.delete'
|
32
|
+
MESSAGES_GET = 'messages.get'
|
33
|
+
|
34
|
+
PEOPLE_GET = 'people.get'
|
35
|
+
PEOPLE_UPDATE = 'people.update'
|
36
|
+
|
37
|
+
VIDEOS_GET = 'videos.get'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Orkut
|
2
|
+
module Constants
|
3
|
+
module Params
|
4
|
+
module PageType
|
5
|
+
FIRST = 'first'
|
6
|
+
LAST = 'last'
|
7
|
+
NEXT = 'next'
|
8
|
+
PREV = 'prev'
|
9
|
+
end
|
10
|
+
|
11
|
+
module MessageFormat
|
12
|
+
NO_HTML = 'noHtml'
|
13
|
+
FULL_HTML = 'fullHtml'
|
14
|
+
PLAIN_TEXT = 'plainText'
|
15
|
+
end
|
16
|
+
|
17
|
+
ACLENTRY = 'aclentry'
|
18
|
+
ACTIVITY = 'activity'
|
19
|
+
ALBUM = 'album'
|
20
|
+
ALBUM_ID = 'albumId'
|
21
|
+
CAPTCHA_ANSWER = 'captchaAnswer'
|
22
|
+
CAPTCHA_TOKEN = 'captchaToken'
|
23
|
+
CAPTCHA_URL = 'captchaUrl'
|
24
|
+
COMMENT = 'comment'
|
25
|
+
COMMENT_ID = 'commentId'
|
26
|
+
COUNT = 'count'
|
27
|
+
FIELDS = 'fields'
|
28
|
+
GROUP_ID = 'groupId'
|
29
|
+
LAST_KEY = 'lastKey'
|
30
|
+
MEDIA_ITEM = 'mediaItem'
|
31
|
+
MEDIA_ITEM_ID = 'mediaItemId'
|
32
|
+
MESSAGE = 'message'
|
33
|
+
MSG_ID = 'msgId'
|
34
|
+
NOTIFICATION = 'notification'
|
35
|
+
OWNER_ID = 'ownerId'
|
36
|
+
PERSON = 'person'
|
37
|
+
PERSON_ID = 'personId'
|
38
|
+
RELEVANT_USER_IDS = 'relevantUserIds'
|
39
|
+
SORT_BY = 'sortBy'
|
40
|
+
TYPE = 'type'
|
41
|
+
UPDATED_BEFORE = 'updatedBefore'
|
42
|
+
USER_ID = 'userId'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Orkut
|
2
|
+
# Defines HTTP request methods
|
3
|
+
module Request
|
4
|
+
|
5
|
+
# Make a regular GET request using AccessToken
|
6
|
+
#
|
7
|
+
# @response = @token.get('/people')
|
8
|
+
# @response = @token.get('/people', { 'Accept'=>'application/xml' })
|
9
|
+
#
|
10
|
+
def get(path = nil, headers = {})
|
11
|
+
connection.get(verify_path(path), headers)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Make a regular HEAD request using AccessToken
|
15
|
+
#
|
16
|
+
# @response = @token.head('/people')
|
17
|
+
#
|
18
|
+
def head(path = nil, headers = {})
|
19
|
+
connection.head(verify_path(path), headers)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Make a regular POST request using AccessToken
|
23
|
+
#
|
24
|
+
# @response = @token.post('/people')
|
25
|
+
# @response = @token.post('/people', { :name => 'Bob', :email => 'bob@mailinator.com' })
|
26
|
+
# @response = @token.post('/people', { :name => 'Bob', :email => 'bob@mailinator.com' }, { 'Accept' => 'application/xml' })
|
27
|
+
# @response = @token.post('/people', nil, {'Accept' => 'application/xml' })
|
28
|
+
# @response = @token.post('/people', @person.to_xml, { 'Accept'=>'application/xml', 'Content-Type' => 'application/xml' })
|
29
|
+
#
|
30
|
+
def post(path = nil, body = '', headers = {})
|
31
|
+
connection.post(verify_path(path), body, headers)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Make a regular PUT request using AccessToken
|
35
|
+
#
|
36
|
+
# @response = @token.put('/people/123')
|
37
|
+
# @response = @token.put('/people/123', { :name => 'Bob', :email => 'bob@mailinator.com' })
|
38
|
+
# @response = @token.put('/people/123', { :name => 'Bob', :email => 'bob@mailinator.com' }, { 'Accept' => 'application/xml' })
|
39
|
+
# @response = @token.put('/people/123', nil, { 'Accept' => 'application/xml' })
|
40
|
+
# @response = @token.put('/people/123', @person.to_xml, { 'Accept' => 'application/xml', 'Content-Type' => 'application/xml' })
|
41
|
+
#
|
42
|
+
def put(path = nil, body = '', headers = {})
|
43
|
+
connection.put(verify_path(path), body, headers)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Make a regular DELETE request using AccessToken
|
47
|
+
#
|
48
|
+
# @response = @token.delete('/people/123')
|
49
|
+
# @response = @token.delete('/people/123', { 'Accept' => 'application/xml' })
|
50
|
+
#
|
51
|
+
def delete(path = nil, headers = {})
|
52
|
+
connection.delete(verify_path(path), headers)
|
53
|
+
end
|
54
|
+
|
55
|
+
def verify_path(path)
|
56
|
+
path ||= endpoint
|
57
|
+
path
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Orkut
|
2
|
+
class Version
|
3
|
+
|
4
|
+
def self.major
|
5
|
+
0
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.minor
|
9
|
+
0
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.patch
|
13
|
+
0
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.pre
|
17
|
+
1 #nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.to_s
|
21
|
+
[major, minor, patch, pre].compact.join('.')
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/orkut.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'orkut/client'
|
2
|
+
require 'orkut/config'
|
3
|
+
|
4
|
+
module Orkut
|
5
|
+
extend Config
|
6
|
+
class << self
|
7
|
+
# Alias for Orkut::Client.new
|
8
|
+
#
|
9
|
+
# @return [Orkut::Client]
|
10
|
+
def new(options={})
|
11
|
+
Orkut::Client.new(options)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Delegate to Orkut::Client
|
15
|
+
def method_missing(method, *args, &block)
|
16
|
+
return super unless new.respond_to?(method)
|
17
|
+
new.send(method, *args, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def respond_to?(method, include_private=false)
|
21
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/orkut.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "orkut/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'orkut'
|
7
|
+
s.version = Orkut::Version.to_s
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Umanni']
|
10
|
+
s.email = ['contato@umanni.com']
|
11
|
+
s.homepage = 'https://github.com/umanni/orkut'
|
12
|
+
s.summary = %q{Orkut API wrapper}
|
13
|
+
s.description = %q{A Ruby wrapper for the Orkut REST/RPC API.}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE",
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.add_dependency 'omniauth', [">= 0.3.0"]
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orkut
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Umanni
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-19 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: &19747780 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *19747780
|
25
|
+
description: A Ruby wrapper for the Orkut REST/RPC API.
|
26
|
+
email:
|
27
|
+
- contato@umanni.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files:
|
31
|
+
- LICENSE
|
32
|
+
- README.rdoc
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE
|
36
|
+
- README.rdoc
|
37
|
+
- Rakefile
|
38
|
+
- lib/orkut.rb
|
39
|
+
- lib/orkut/api.rb
|
40
|
+
- lib/orkut/authenticatable.rb
|
41
|
+
- lib/orkut/base.rb
|
42
|
+
- lib/orkut/client.rb
|
43
|
+
- lib/orkut/client/messages.rb
|
44
|
+
- lib/orkut/client/timelines.rb
|
45
|
+
- lib/orkut/config.rb
|
46
|
+
- lib/orkut/connection.rb
|
47
|
+
- lib/orkut/constants/activity_type.rb
|
48
|
+
- lib/orkut/constants/fields.rb
|
49
|
+
- lib/orkut/constants/group.rb
|
50
|
+
- lib/orkut/constants/internal_constants.rb
|
51
|
+
- lib/orkut/constants/method_names.rb
|
52
|
+
- lib/orkut/constants/params.rb
|
53
|
+
- lib/orkut/request.rb
|
54
|
+
- lib/orkut/version.rb
|
55
|
+
- orkut.gemspec
|
56
|
+
homepage: https://github.com/umanni/orkut
|
57
|
+
licenses: []
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.11
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Orkut API wrapper
|
80
|
+
test_files: []
|