Class: Vkontakte::App::Iframe

Inherits:
Base
  • Object
show all
Includes:
Vkontakte::Api::Friends, Vkontakte::Api::Groups, Vkontakte::Api::Likes, Vkontakte::Api::Photos
Defined in:
lib/vkontakte/app/iframe.rb

Overview

IFrame приложения More info at vk.com/developers.php?id=-1_27971896&s=1

Instance Attribute Summary collapse

Attributes inherited from Base

#auth

Instance Method Summary collapse

Methods included from Vkontakte::Api::Photos

included

Methods included from Vkontakte::Api::Likes

included

Methods included from Vkontakte::Api::Groups

included

Methods included from Vkontakte::Api::Friends

included

Methods inherited from Base

#authorize, #authorized?, #call, #initialize

Constructor Details

This class inherits a constructor from Vkontakte::App::Base

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



12
13
14
# File 'lib/vkontakte/app/iframe.rb', line 12

def params
  @params
end

Instance Method Details

#api_resultObject

результат выполнения API-запроса, формирующийся при просмотре приложения. Параметры этого запроса можно ввести в разделе редактирования приложения. Например, для получения информации об указанных пользователях, можно использовать следующий запрос:

method=getProfiles&uids={user_id},{viewer_id},1,6492&format=json&v=2.0


59
60
61
# File 'lib/vkontakte/app/iframe.rb', line 59

def api_result
  @api_result ||= MultiJson.decode(params[:api_result])
end

#languageObject

Переменная language может принимать следующие значения:

0 – русский язык.
1 – украинский язык.
2 – белорусский язык.
3 – английский язык.


44
45
46
47
48
49
50
51
52
# File 'lib/vkontakte/app/iframe.rb', line 44

def language
  return :ru if params[:language].blank?
  case params[:language].to_s
    when '0' then :ru
    when '1' then :uk
    when '2' then :be
    when '3' then :en
  end
end

#valid_auth_key?Boolean

Этот параметр приходит, если в приложении включена система платежей (во вкладке Платежи при редактировании приложения). auth_key вычисляется на сервере ВКонтакте следующим образом:

auth_key = md5(api_id + '_' + viewer_id + '_' + api_secret)

Returns:

  • (Boolean)


33
34
35
# File 'lib/vkontakte/app/iframe.rb', line 33

def valid_auth_key?
  !params[:auth_key].blank? && params[:auth_key] == auth_key
end