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/format.rb,
 lib/mailru/api/request.rb,
 lib/mailru/api/configuration_builder.rb
 
Defined Under Namespace
  
    
      Modules: Format
    
  
    
      Classes: AccessToObjectDeniedError, ApplicationIsNotInstalledError, ApplicationLookupFailedError, AuthorizationFailedError, ConfigurationBuilder, DSL, Error, GetRequest, IncorrectImageError, IncorrectSignatureError, InvalidParameterError, MethodIsDeprecatedError, PermissionDeniedError, PostRequest, Request, UnknownError, UnknownMethodCalledError
    
  
  
    
      Constant Summary
      collapse
    
    
      
        - PATH =
          
        
- 'http://www.appsmail.ru/platform/api' 
- PARAMS =
          
        
- [:app_id, :secret_key, :private_key, :session_key, :uid, :format] 
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    #initialize(options = {}, &block)  ⇒ API 
  
  
  
  
    
Returns a new instance of API.
   
 
  
  
    | 
6
7
8
9
10
11
12
13
14
15
16 | # File 'lib/mailru/api.rb', line 6
def initialize options = {}, &block
  @configuration = options
  if block_given?
    if block.arity == 1
      yield self
    else
      @configuration.merge! ConfigurationBuilder.new(&block).configuration
    end
  end
end | 
 
  
 
  
    Instance Method Details
    
      
  
  
    #audio  ⇒ Object 
  
  
  
  
    | 
38
39
40
41
42
43
44
45 | # File 'lib/mailru/api.rb', line 38
def audio
  DSL.new(self, 'audio') do
    api 'get', :post
    api 'link'
    api 'search', :post
    api 'top', :get, Request::Secure::No
  end
end | 
 
    
      
  
  
    #events  ⇒ Object 
  
  
  
  
    | 
47
48
49
50
51 | # File 'lib/mailru/api.rb', line 47
def events
  DSL.new(self, 'events') do
    api 'getNewCount'
  end
end | 
 
    
      
  
  
    #friends  ⇒ Object 
  
  
  
  
    | 
53
54
55
56
57
58
59
60 | # File 'lib/mailru/api.rb', line 53
def friends
  DSL.new(self, 'friends') do
    api 'get'
    api 'getAppUsers'
    api 'getInvitationsCount'
    api 'getOnline'
  end
end | 
 
    
      
  
  
    #get(name, params = {}, secure = Request::Secure::Any)  ⇒ Object 
  
  
  
  
    | 
30
31
32 | # File 'lib/mailru/api.rb', line 30
def get name, params = {}, secure = Request::Secure::Any
  GetRequest.new(self, name, params, secure).get
end | 
 
    
      
  
  
    #guestbook  ⇒ Object 
  
  
  
  
    | 
62
63
64
65
66
67 | # File 'lib/mailru/api.rb', line 62
def guestbook
  DSL.new(self, 'guestbook') do
    api 'get'
    api 'post', :post
  end
end | 
 
    
      
  
  
    #mail  ⇒ Object 
  
  
  
  
    | 
69
70
71
72
73 | # File 'lib/mailru/api.rb', line 69
def mail
  DSL.new(self, 'mail') do
    api 'getUnreadCount'
  end
end | 
 
    
      
  
  
    #messages  ⇒ Object 
  
  
  
  
    | 
75
76
77
78
79
80
81
82 | # File 'lib/mailru/api.rb', line 75
def messages
  DSL.new(self, 'messages') do
    api 'getThread'
    api 'getThreadsList'
    api 'getUnreadCount'
    api 'post', :post
  end
end | 
 
    
      
  
  
    #mobile  ⇒ Object 
  
  
  
  
    | 
84
85
86
87
88 | # File 'lib/mailru/api.rb', line 84
def mobile
  DSL.new(self, 'mobile') do
    api 'getCanvas', :get, Request::Secure::No
  end
end | 
 
    
      
  
  
    #notifications  ⇒ Object 
  
  
  
  
    | 
90
91
92
93
94 | # File 'lib/mailru/api.rb', line 90
def notifications
  DSL.new(self, 'notifications') do
    api 'send', :post, Request::Secure::Yes
  end
end | 
 
    
      
  
  
    #photos  ⇒ Object 
  
  
  
  
    | 
96
97
98
99
100
101
102
103 | # File 'lib/mailru/api.rb', line 96
def photos
  DSL.new(self, 'photos')  do
    api 'createAlbum', :post
    api 'get', :post
    api 'getAlbums', :post
    api 'upload', :post
  end
end | 
 
    
      
  
  
    #post(name, params = {}, secure = Request::Secure::Any)  ⇒ Object 
  
  
  
  
    | 
34
35
36 | # File 'lib/mailru/api.rb', line 34
def post name, params = {}, secure = Request::Secure::Any
  PostRequest.new(self, name, params, secure).post
end | 
 
    
      
  
  
    #stream  ⇒ Object 
  
  
  
  
    | 
105
106
107
108
109
110
111
112
113
114
115 | # File 'lib/mailru/api.rb', line 105
def stream
  DSL.new(self, 'stream') do
    api 'comment', :post
    api 'get'
    api 'getByAuthor'
    api 'like'
    api 'post', :post
    api 'share', :post
    api 'unlike'
  end
end | 
 
    
      
  
  
    #users  ⇒ Object 
  
  
  
  
    | 
117
118
119
120
121
122
123
124 | # File 'lib/mailru/api.rb', line 117
def users
  DSL.new(self, 'users') do
    api 'getBalance'
    api 'getInfo', :post
    api 'hasAppPermission'
    api 'isAppUser'
  end
end |