yandex-pdd 0.0.5 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/yandex/pdd.rb +18 -0
  2. metadata +3 -3
@@ -97,6 +97,24 @@ module Yandex
97
97
  return create_user(login, password, true)
98
98
  end
99
99
 
100
+ # user_oauth_token
101
+ # https://pddimp.yandex.ru/api/user_oauth_token.xml ? token=<токен> & domain=<имя домена> & login=<имя пользователя>
102
+
103
+ def user_oauth_token(login, domain)
104
+ url = API_URL + '/api/user_oauth_token.xml?token=' + @token + '&domain=' + quote_encode(domain) +
105
+ '&login=' + quote_encode(login)
106
+ return nil unless make_request(url)
107
+ if (oauth_token = get_node_text('/action/domains/domain/email/oauth-token'))
108
+ return oauth_token
109
+ end
110
+ return unknown_error()
111
+ end
112
+
113
+ # http://passport.yandex.ru/passport ? mode=oauth & type=trusted-pdd-partner & error_retpath=<URL для редиректа> & access_token=<токен>
114
+ def passport(token, url)
115
+ return "http://passport.yandex.ru/passport?mode=oauth&type=trusted-pdd-partner&error_retpath=#{quote_encode(url)}&access_token=#{token}"
116
+ end
117
+
100
118
  def update_user(login, data)
101
119
  url = API_URL + 'edit_user.xml?token=' + @token + '&login=' + quote_encode(login) +
102
120
  '&password=' + quote_encode(data[:password]) +
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex-pdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby
16
- requirement: &68147310 !ruby/object:Gem::Requirement
16
+ requirement: &81218220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *68147310
24
+ version_requirements: *81218220
25
25
  description: pdd.yandex.ru api gem from https://github.com/dctabuyz/Yandex-API-PDD.ruby
26
26
  email: vick.orel@gmail.com
27
27
  executables: []