Class: MailRU::API
- Inherits:
-
Object
show all
- Defined in:
- lib/mailru-api.rb,
lib/mailru-api/dsl.rb,
lib/mailru-api/error.rb,
lib/mailru-api/request.rb
Defined Under Namespace
Modules: Format
Classes: AccessToObjectDeniedError, ApplicationIsNotInstalledError, ApplicationLookupFailedError, AuthorizationFailedError, DSL, Error, GetRequest, IncorrectImageError, IncorrectSignatureError, InvalidParameterError, MethodIsDeprecatedError, PermissionDeniedError, PostRequest, Request, UnknownError, UnknownMethodCalledError
Constant Summary
collapse
- PATH =
'http://www.appsmail.ru/platform/api'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}, &block) ⇒ API
Returns a new instance of API.
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/mailru-api.rb', line 57
def initialize options = {}, &block
@app_id = options[:app_id]
@secret_key = options[:secret_key]
@private_key = options[:private_key]
@session_key = options[:session_key]
@uid = options[:uid]
@format = options[:format]
if block_given?
if block.arity == 1
yield self
else
configuration = APIConfigurationBuilder.new(&block).configuration
unless configuration.nil?
@app_id = configuration.app_id || @app_id
@secret_key = configuration.secret_key || @secret_key
@private_key = configuration.private_key || @private_key
@session_key = configuration.session_key || @session_key
@uid = configuration.uid || @uid
@format = configuration.format || @format
end
end
end
end
|
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def app_id
@app_id
end
|
Returns the value of attribute format.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def format
@format
end
|
#private_key ⇒ Object
Returns the value of attribute private_key.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def private_key
@private_key
end
|
#secret_key ⇒ Object
Returns the value of attribute secret_key.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def secret_key
@secret_key
end
|
#session_key ⇒ Object
Returns the value of attribute session_key.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def session_key
@session_key
end
|
#uid ⇒ Object
Returns the value of attribute uid.
55
56
57
|
# File 'lib/mailru-api.rb', line 55
def uid
@uid
end
|
Instance Method Details
#audio ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/mailru-api.rb', line 83
def audio
DSL.new(self, 'audio') do
api 'get'
api 'link'
api 'search'
end
end
|
#events ⇒ Object
91
92
93
94
95
|
# File 'lib/mailru-api.rb', line 91
def events
DSL.new(self, 'events') do
api 'getNewCount'
end
end
|
#friends ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'lib/mailru-api.rb', line 97
def friends
DSL.new(self, 'friends') do
api 'get'
api 'getAppUsers'
api 'getInvitationsCount'
api 'getOnline'
end
end
|
#guestbook ⇒ Object
106
107
108
109
110
111
|
# File 'lib/mailru-api.rb', line 106
def guestbook
DSL.new(self, 'guestbook') do
api 'get'
api 'post', :post
end
end
|
#mail ⇒ Object
113
114
115
116
117
|
# File 'lib/mailru-api.rb', line 113
def mail
DSL.new(self, 'mail') do
api 'getUnreadCount'
end
end
|
#messages ⇒ Object
119
120
121
122
123
124
125
126
|
# File 'lib/mailru-api.rb', line 119
def messages
DSL.new(self, 'messages') do
api 'getThread'
api 'getThreadsList'
api 'getUnreadCount'
api 'post', :post
end
end
|
#mobile ⇒ Object
128
129
130
131
132
|
# File 'lib/mailru-api.rb', line 128
def mobile
DSL.new(self, 'mobile') do
api 'getCanvas', :get, Request::Secure::No
end
end
|
#notifications ⇒ Object
134
135
136
137
138
|
# File 'lib/mailru-api.rb', line 134
def notifications
DSL.new(self, 'notifications') do
api 'send', :get, Request::Secure::Yes
end
end
|
#photos ⇒ Object
140
141
142
143
144
145
146
147
|
# File 'lib/mailru-api.rb', line 140
def photos
DSL.new(self, 'photos') do
api 'createAlbum'
api 'get'
api 'getAlbums'
api 'upload', :post
end
end
|
#stream ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/mailru-api.rb', line 149
def stream
DSL.new(self, 'stream') do
api 'comment'
api 'get'
api 'getByAuthor'
api 'like'
api 'post', :post
api 'share', :post
api 'unlike'
end
end
|
#users ⇒ Object
161
162
163
164
165
166
167
168
|
# File 'lib/mailru-api.rb', line 161
def users
DSL.new(self, 'users') do
api 'getBalance'
api 'getInfo'
api 'hasAppPermission'
api 'isAppUser'
end
end
|