paypal-sdk-permissions 1.96.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +17 -0
- data/README.md +148 -0
- data/Rakefile +14 -0
- data/lib/paypal-sdk-permissions.rb +2 -0
- data/lib/paypal-sdk/permissions.rb +16 -0
- data/lib/paypal-sdk/permissions/api.rb +21 -0
- data/lib/paypal-sdk/permissions/data_types.rb +277 -0
- data/lib/paypal-sdk/permissions/services.rb +135 -0
- data/lib/paypal-sdk/permissions/version.rb +7 -0
- data/spec/config/cert_key.pem +33 -0
- data/spec/config/paypal.yml +25 -0
- data/spec/permissions_spec.rb +27 -0
- data/spec/spec_helper.rb +6 -0
- metadata +84 -0
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
|
6
|
+
|
7
|
+
if Dir.exist? File.expand_path('../samples', __FILE__)
|
8
|
+
gem 'permissions_samples', :path => 'samples', :require => false
|
9
|
+
group :test do
|
10
|
+
gem 'rspec-rails', :require => false
|
11
|
+
gem 'capybara', :require => false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem 'rspec'
|
17
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# Permissions
|
2
|
+
|
3
|
+
SDK for Permissions.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'paypal-sdk-permissions'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install paypal-sdk-permissions
|
18
|
+
|
19
|
+
## Configuration
|
20
|
+
|
21
|
+
For Rails application:
|
22
|
+
|
23
|
+
rails g paypal:sdk:install
|
24
|
+
|
25
|
+
For other ruby application, create a configuration file(`config/paypal.yml`):
|
26
|
+
|
27
|
+
development: &default
|
28
|
+
username: jb-us-seller_api1.paypal.com
|
29
|
+
password: WX4WTU3S8MY44S7F
|
30
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
31
|
+
app_id: APP-80W284485P519543T
|
32
|
+
http_timeout: 30
|
33
|
+
mode: sandbox
|
34
|
+
# # with certificate
|
35
|
+
# cert_path: "config/cert_key.pem"
|
36
|
+
# # with token authentication
|
37
|
+
# token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
|
38
|
+
# token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
|
39
|
+
# # with Proxy
|
40
|
+
# http_proxy: http://proxy-ipaddress:3129/
|
41
|
+
# # with device ip address
|
42
|
+
# device_ipaddress: "127.0.0.1"
|
43
|
+
test:
|
44
|
+
<<: *default
|
45
|
+
production:
|
46
|
+
<<: *default
|
47
|
+
mode: live
|
48
|
+
|
49
|
+
Load Configurations from specified file:
|
50
|
+
|
51
|
+
PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
52
|
+
|
53
|
+
## Create API object
|
54
|
+
|
55
|
+
Create API object:
|
56
|
+
|
57
|
+
api = PayPal::SDK::Permissions::API.new
|
58
|
+
|
59
|
+
Override configuration while creating a object:
|
60
|
+
|
61
|
+
api = PayPal::SDK::Permissions::API.new(:development)
|
62
|
+
api = PayPal::SDK::Permissions::API.new(:development, :app_id => "XYZ")
|
63
|
+
api = PayPal::SDK::Permissions::API.new(:app_id => "XYZ") # Take default environment.
|
64
|
+
|
65
|
+
Change configuration:
|
66
|
+
|
67
|
+
api.set_config :testing
|
68
|
+
api.set_config :testing, app_id => "XYZ"
|
69
|
+
|
70
|
+
|
71
|
+
## Build Request Object
|
72
|
+
|
73
|
+
To make api request, we need to build a request object.
|
74
|
+
|
75
|
+
# To build a empty request object for get verified status
|
76
|
+
request_permissions = api.build_request_permissions()
|
77
|
+
|
78
|
+
# To build a request object with default data
|
79
|
+
request_permissions = api.build_request_permissions( :callback => "http://localhost:3000/permissions/get_access_token" )
|
80
|
+
|
81
|
+
The Build method can be access with camelcase or underscore:
|
82
|
+
|
83
|
+
api = api.build_request_permissions()
|
84
|
+
# (or)
|
85
|
+
api = api.BuildRequestPermissions()
|
86
|
+
|
87
|
+
## Assign value to members
|
88
|
+
|
89
|
+
Members can be access with camelcase or underscore format.
|
90
|
+
|
91
|
+
request_permissions.scope = ["TRANSACTION_SEARCH","ACCOUNT_BALANCE","BILLING_AGREEMENT"]
|
92
|
+
|
93
|
+
To Get members list for the given object( For Reference ):
|
94
|
+
|
95
|
+
request_permission.members
|
96
|
+
|
97
|
+
## Make API Request
|
98
|
+
|
99
|
+
Make api call with request object:
|
100
|
+
|
101
|
+
request_permissions_response = api.request_permissions(request_permissions)
|
102
|
+
|
103
|
+
Make api call with hash:
|
104
|
+
|
105
|
+
request_permissions_response = api.request_permissions( :scope => ["TRANSACTION_SEARCH"], :callback => "http://localhost:3000/permissions/get_access_token" )
|
106
|
+
|
107
|
+
|
108
|
+
## Access values from response object
|
109
|
+
|
110
|
+
To get response status:
|
111
|
+
|
112
|
+
request_permissions_response.responseEnvelope.ack
|
113
|
+
|
114
|
+
## Example
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
require 'paypal-sdk-permissions'
|
118
|
+
@api = PayPal::SDK::Permissions::API.new
|
119
|
+
|
120
|
+
# Build request object
|
121
|
+
@request_permissions_request = @api.build_request_permissions()
|
122
|
+
@request_permissions_request.scope = ["EXPRESS_CHECKOUT"]
|
123
|
+
@request_permissions_request.callback = "http://localhost:3000/permissions/get_access_token"
|
124
|
+
|
125
|
+
# Make API call & get response
|
126
|
+
@request_permissions_response = @api.request_permissions(@request_permissions_request)
|
127
|
+
|
128
|
+
# Access Response
|
129
|
+
@request_permissions_response.responseEnvelope
|
130
|
+
@request_permissions_response.token
|
131
|
+
```
|
132
|
+
|
133
|
+
## Samples
|
134
|
+
|
135
|
+
Add following line in rails `Gemfile`:
|
136
|
+
|
137
|
+
gem 'paypal-sdk-permissions'
|
138
|
+
gem 'permissions_samples', :git => "https://github.com/paypal/permissions-sdk-ruby.git", :group => :development
|
139
|
+
|
140
|
+
Configure routes(`config/routes.rb`):
|
141
|
+
|
142
|
+
mount PermissionsSamples::Engine => "/samples" if Rails.env.development?
|
143
|
+
|
144
|
+
To get default paypal configuration execute:
|
145
|
+
|
146
|
+
rails g paypal:sdk:install
|
147
|
+
|
148
|
+
Run `rails server` and check the samples.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
desc "Run tests"
|
4
|
+
task :rspec do
|
5
|
+
cmd = "bundle exec rspec && cd samples && bundle exec rspec"
|
6
|
+
system(cmd) || raise("#{cmd} failed")
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "View samples"
|
10
|
+
task :samples do
|
11
|
+
system("cd samples/spec/dummy && bundle exec rails server")
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => :rspec
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
|
3
|
+
module PayPal
|
4
|
+
module SDK
|
5
|
+
module Permissions
|
6
|
+
autoload :VERSION, "paypal-sdk/permissions/version"
|
7
|
+
autoload :Services, "paypal-sdk/permissions/services"
|
8
|
+
autoload :DataTypes, "paypal-sdk/permissions/data_types"
|
9
|
+
autoload :API, "paypal-sdk/permissions/api"
|
10
|
+
|
11
|
+
def self.new(*args)
|
12
|
+
API.new(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
|
3
|
+
module PayPal
|
4
|
+
module SDK
|
5
|
+
module Permissions
|
6
|
+
class API < Core::API::Platform
|
7
|
+
include Services
|
8
|
+
|
9
|
+
def initialize(environment = nil, options = {})
|
10
|
+
super(SERVICE_NAME, environment, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
PERMISSIONS_HTTP_HEADER = { "X-PAYPAL-REQUEST-SOURCE" => "permissions-ruby-sdk-#{VERSION}" }
|
14
|
+
def default_http_header
|
15
|
+
super.merge(PERMISSIONS_HTTP_HEADER)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,277 @@
|
|
1
|
+
# Stub objects for Permissions
|
2
|
+
# Auto generated code
|
3
|
+
|
4
|
+
require 'paypal-sdk-core'
|
5
|
+
|
6
|
+
module PayPal::SDK
|
7
|
+
module Permissions
|
8
|
+
module DataTypes
|
9
|
+
|
10
|
+
class DataType < Core::API::DataTypes::Base
|
11
|
+
def self.load_members
|
12
|
+
add_attribute :xmlns
|
13
|
+
add_attribute :type, :namespace => :xsi
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class EnumType < Core::API::DataTypes::Enum
|
18
|
+
end
|
19
|
+
|
20
|
+
class ErrorData < DataType
|
21
|
+
def self.load_members
|
22
|
+
object_of :errorId, Integer
|
23
|
+
object_of :domain, String
|
24
|
+
object_of :subdomain, String
|
25
|
+
object_of :severity, ErrorSeverity
|
26
|
+
object_of :category, ErrorCategory
|
27
|
+
object_of :message, String
|
28
|
+
object_of :exceptionId, String
|
29
|
+
array_of :parameter, ErrorParameter
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
class ErrorParameter < DataType
|
36
|
+
def self.load_members
|
37
|
+
add_attribute :name, :required => true
|
38
|
+
object_of :value, String, :required => true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
# This is the sample message
|
45
|
+
class ResponseEnvelope < DataType
|
46
|
+
def self.load_members
|
47
|
+
object_of :timestamp, DateTime, :required => true
|
48
|
+
# Application level acknowledgment code.
|
49
|
+
object_of :ack, AckCode
|
50
|
+
object_of :correlationId, String, :required => true
|
51
|
+
object_of :build, String, :required => true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
# This specifies the list of parameters with every request to the service.
|
58
|
+
class RequestEnvelope < DataType
|
59
|
+
def self.load_members
|
60
|
+
# This should be the standard RFC 3066 language identification tag, e.g., en_US.
|
61
|
+
object_of :errorLanguage, String, :required => true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
class FaultMessage < DataType
|
68
|
+
def self.load_members
|
69
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
70
|
+
array_of :error, ErrorData
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
class ErrorSeverity < EnumType
|
77
|
+
self.options = { 'ERROR' => 'Error', 'WARNING' => 'Warning' }
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
class ErrorCategory < EnumType
|
83
|
+
self.options = { 'SYSTEM' => 'System', 'APPLICATION' => 'Application', 'REQUEST' => 'Request' }
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
# AckCodeType This code identifies the acknowledgment code types that could be used to communicate the status of processing a (request) message to an application. This code would be used as part of a response message that contains an application level acknowledgment element.
|
89
|
+
class AckCode < EnumType
|
90
|
+
self.options = { 'SUCCESS' => 'Success', 'FAILURE' => 'Failure', 'WARNING' => 'Warning', 'SUCCESSWITHWARNING' => 'SuccessWithWarning', 'FAILUREWITHWARNING' => 'FailureWithWarning', 'CUSTOMCODE' => 'CustomCode' }
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
# Enumeration for Personal Attributes of a user.
|
96
|
+
class PersonalAttribute < EnumType
|
97
|
+
self.options = { 'HTTPAXSCHEMAORGNAMEPERSONFIRST' => 'http://axschema.org/namePerson/first', 'HTTPAXSCHEMAORGNAMEPERSONLAST' => 'http://axschema.org/namePerson/last', 'HTTPAXSCHEMAORGCONTACTEMAIL' => 'http://axschema.org/contact/email', 'HTTPSCHEMAOPENIDNETCONTACTFULLNAME' => 'http://schema.openid.net/contact/fullname', 'HTTPAXSCHEMAORGCOMPANYNAME' => 'http://axschema.org/company/name', 'HTTPAXSCHEMAORGCONTACTCOUNTRYHOME' => 'http://axschema.org/contact/country/home', 'HTTPAXSCHEMAORGBIRTHDATE' => 'http://axschema.org/birthDate', 'HTTPAXSCHEMAORGCONTACTPOSTALCODEHOME' => 'http://axschema.org/contact/postalCode/home', 'HTTPSCHEMAOPENIDNETCONTACTSTREET1' => 'http://schema.openid.net/contact/street1', 'HTTPSCHEMAOPENIDNETCONTACTSTREET' => 'http://schema.openid.net/contact/street2', 'HTTPAXSCHEMAORGCONTACTCITYHOME' => 'http://axschema.org/contact/city/home', 'HTTPAXSCHEMAORGCONTACTSTATEHOME' => 'http://axschema.org/contact/state/home', 'HTTPAXSCHEMAORGCONTACTPHONEDEFAULT' => 'http://axschema.org/contact/phone/default', 'HTTPSWWWPAYPALCOMWEBAPPSAUTHSCHEMAPAYERID2' => 'https://www.paypal.com/webapps/auth/schema/payerID' }
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
# Describes the request for permissions over an account. Primary element is "scope", which lists the permissions needed.
|
103
|
+
class RequestPermissionsRequest < DataType
|
104
|
+
def self.load_members
|
105
|
+
object_of :requestEnvelope, RequestEnvelope
|
106
|
+
# URI of the permissions being requested.
|
107
|
+
array_of :scope, String, :required => true
|
108
|
+
# URL on the client side that will be used to communicate completion of the user flow. The URL can include query parameters.
|
109
|
+
object_of :callback, String, :required => true
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
# Returns the temporary request token
|
116
|
+
class RequestPermissionsResponse < DataType
|
117
|
+
def self.load_members
|
118
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
119
|
+
# Temporary token that identifies the request for permissions. This token cannot be used to access resources on the account. It can only be used to instruct the user to authorize the permissions.
|
120
|
+
object_of :token, String
|
121
|
+
array_of :error, ErrorData
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# The request use to retrieve a permanent access token. The client can either send the token and verifier, or a subject.
|
128
|
+
class GetAccessTokenRequest < DataType
|
129
|
+
def self.load_members
|
130
|
+
object_of :requestEnvelope, RequestEnvelope
|
131
|
+
# The temporary request token received from the RequestPermissions call.
|
132
|
+
object_of :token, String
|
133
|
+
# The verifier code returned to the client after the user authorization flow completed.
|
134
|
+
object_of :verifier, String
|
135
|
+
# The subject email address used to represent existing 3rd Party Permissions relationship. This field can be used in lieu of the token and verifier.
|
136
|
+
object_of :subjectAlias, String
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
# Permanent access token and token secret that can be used to make requests for protected resources owned by another account.
|
143
|
+
class GetAccessTokenResponse < DataType
|
144
|
+
def self.load_members
|
145
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
146
|
+
# Identifier for the permissions approved for this relationship.
|
147
|
+
array_of :scope, String
|
148
|
+
# Permanent access token that identifies the relationship that the user authorized.
|
149
|
+
object_of :token, String
|
150
|
+
# The token secret/password that will need to be used when generating the signature.
|
151
|
+
object_of :tokenSecret, String
|
152
|
+
array_of :error, ErrorData
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
# Request to retrieve the approved list of permissions associated with a token.
|
159
|
+
class GetPermissionsRequest < DataType
|
160
|
+
def self.load_members
|
161
|
+
object_of :requestEnvelope, RequestEnvelope
|
162
|
+
# The permanent access token to ask about.
|
163
|
+
object_of :token, String, :required => true
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
# The list of permissions associated with the token.
|
170
|
+
class GetPermissionsResponse < DataType
|
171
|
+
def self.load_members
|
172
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
173
|
+
# Identifier for the permissions approved for this relationship.
|
174
|
+
array_of :scope, String
|
175
|
+
array_of :error, ErrorData
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
# Request to invalidate an access token and revoke the permissions associated with it.
|
182
|
+
class CancelPermissionsRequest < DataType
|
183
|
+
def self.load_members
|
184
|
+
object_of :requestEnvelope, RequestEnvelope
|
185
|
+
object_of :token, String, :required => true
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
class CancelPermissionsResponse < DataType
|
192
|
+
def self.load_members
|
193
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
194
|
+
array_of :error, ErrorData
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
# List of Personal Attributes to be sent as a request.
|
201
|
+
class PersonalAttributeList < DataType
|
202
|
+
def self.load_members
|
203
|
+
array_of :attribute, PersonalAttribute
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
# A property of User Identity data , represented as a Name-value pair with Name being the PersonalAttribute requested and value being the data.
|
210
|
+
class PersonalData < DataType
|
211
|
+
def self.load_members
|
212
|
+
object_of :personalDataKey, PersonalAttribute, :required => true
|
213
|
+
object_of :personalDataValue, String, :required => true
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
# Set of personal data which forms the response of GetPersonalData call.
|
220
|
+
class PersonalDataList < DataType
|
221
|
+
def self.load_members
|
222
|
+
array_of :personalData, PersonalData
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
# Request to retrieve basic personal data.Accepts PersonalAttributeList as request and responds with PersonalDataList. This call will accept only 'Basic' attributes and ignore others.
|
229
|
+
class GetBasicPersonalDataRequest < DataType
|
230
|
+
def self.load_members
|
231
|
+
object_of :requestEnvelope, RequestEnvelope
|
232
|
+
object_of :attributeList, PersonalAttributeList, :required => true
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
# Request to retrieve personal data.Accepts PersonalAttributeList as request and responds with PersonalDataList. This call will accept both 'Basic' and Advanced attributes.
|
239
|
+
class GetAdvancedPersonalDataRequest < DataType
|
240
|
+
def self.load_members
|
241
|
+
object_of :requestEnvelope, RequestEnvelope
|
242
|
+
object_of :attributeList, PersonalAttributeList, :required => true
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
class GetBasicPersonalDataResponse < DataType
|
249
|
+
def self.load_members
|
250
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
251
|
+
object_of :response, PersonalDataList
|
252
|
+
array_of :error, ErrorData
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
class GetAdvancedPersonalDataResponse < DataType
|
259
|
+
def self.load_members
|
260
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
261
|
+
object_of :response, PersonalDataList
|
262
|
+
array_of :error, ErrorData
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
constants.each do |data_type_klass|
|
271
|
+
data_type_klass = const_get(data_type_klass)
|
272
|
+
data_type_klass.load_members if defined? data_type_klass.load_members
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
require 'paypal-sdk/permissions/data_types'
|
3
|
+
|
4
|
+
# AUTO GENERATED code for Permissions
|
5
|
+
module PayPal::SDK
|
6
|
+
module Permissions
|
7
|
+
|
8
|
+
# Service Version
|
9
|
+
SERVICE_VERSION = ""
|
10
|
+
# Service Name
|
11
|
+
SERVICE_NAME = "Permissions"
|
12
|
+
|
13
|
+
module Services
|
14
|
+
include DataTypes
|
15
|
+
|
16
|
+
|
17
|
+
# Service Call: RequestPermissions
|
18
|
+
# @param RequestPermissionsRequest
|
19
|
+
# @return RequestPermissionsResponse
|
20
|
+
def RequestPermissions(options = {} , http_header = {})
|
21
|
+
request_object = BuildRequestPermissions(options)
|
22
|
+
request_hash = request_object.to_hash
|
23
|
+
response_hash = request("RequestPermissions", request_hash, http_header)
|
24
|
+
RequestPermissionsResponse.new(response_hash)
|
25
|
+
end
|
26
|
+
alias_method :request_permissions, :RequestPermissions
|
27
|
+
|
28
|
+
def BuildRequestPermissions(options = {}, &block)
|
29
|
+
klass = RequestPermissionsRequest
|
30
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
31
|
+
object.instance_eval(&block) if block
|
32
|
+
object
|
33
|
+
end
|
34
|
+
alias_method :build_request_permissions, :BuildRequestPermissions
|
35
|
+
|
36
|
+
# Service Call: GetAccessToken
|
37
|
+
# @param GetAccessTokenRequest
|
38
|
+
# @return GetAccessTokenResponse
|
39
|
+
def GetAccessToken(options = {} , http_header = {})
|
40
|
+
request_object = BuildGetAccessToken(options)
|
41
|
+
request_hash = request_object.to_hash
|
42
|
+
response_hash = request("GetAccessToken", request_hash, http_header)
|
43
|
+
GetAccessTokenResponse.new(response_hash)
|
44
|
+
end
|
45
|
+
alias_method :get_access_token, :GetAccessToken
|
46
|
+
|
47
|
+
def BuildGetAccessToken(options = {}, &block)
|
48
|
+
klass = GetAccessTokenRequest
|
49
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
50
|
+
object.instance_eval(&block) if block
|
51
|
+
object
|
52
|
+
end
|
53
|
+
alias_method :build_get_access_token, :BuildGetAccessToken
|
54
|
+
|
55
|
+
# Service Call: GetPermissions
|
56
|
+
# @param GetPermissionsRequest
|
57
|
+
# @return GetPermissionsResponse
|
58
|
+
def GetPermissions(options = {} , http_header = {})
|
59
|
+
request_object = BuildGetPermissions(options)
|
60
|
+
request_hash = request_object.to_hash
|
61
|
+
response_hash = request("GetPermissions", request_hash, http_header)
|
62
|
+
GetPermissionsResponse.new(response_hash)
|
63
|
+
end
|
64
|
+
alias_method :get_permissions, :GetPermissions
|
65
|
+
|
66
|
+
def BuildGetPermissions(options = {}, &block)
|
67
|
+
klass = GetPermissionsRequest
|
68
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
69
|
+
object.instance_eval(&block) if block
|
70
|
+
object
|
71
|
+
end
|
72
|
+
alias_method :build_get_permissions, :BuildGetPermissions
|
73
|
+
|
74
|
+
# Service Call: CancelPermissions
|
75
|
+
# @param CancelPermissionsRequest
|
76
|
+
# @return CancelPermissionsResponse
|
77
|
+
def CancelPermissions(options = {} , http_header = {})
|
78
|
+
request_object = BuildCancelPermissions(options)
|
79
|
+
request_hash = request_object.to_hash
|
80
|
+
response_hash = request("CancelPermissions", request_hash, http_header)
|
81
|
+
CancelPermissionsResponse.new(response_hash)
|
82
|
+
end
|
83
|
+
alias_method :cancel_permissions, :CancelPermissions
|
84
|
+
|
85
|
+
def BuildCancelPermissions(options = {}, &block)
|
86
|
+
klass = CancelPermissionsRequest
|
87
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
88
|
+
object.instance_eval(&block) if block
|
89
|
+
object
|
90
|
+
end
|
91
|
+
alias_method :build_cancel_permissions, :BuildCancelPermissions
|
92
|
+
|
93
|
+
# Service Call: GetBasicPersonalData
|
94
|
+
# @param GetBasicPersonalDataRequest
|
95
|
+
# @return GetBasicPersonalDataResponse
|
96
|
+
def GetBasicPersonalData(options = {} , http_header = {})
|
97
|
+
request_object = BuildGetBasicPersonalData(options)
|
98
|
+
request_hash = request_object.to_hash
|
99
|
+
response_hash = request("GetBasicPersonalData", request_hash, http_header)
|
100
|
+
GetBasicPersonalDataResponse.new(response_hash)
|
101
|
+
end
|
102
|
+
alias_method :get_basic_personal_data, :GetBasicPersonalData
|
103
|
+
|
104
|
+
def BuildGetBasicPersonalData(options = {}, &block)
|
105
|
+
klass = GetBasicPersonalDataRequest
|
106
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
107
|
+
object.instance_eval(&block) if block
|
108
|
+
object
|
109
|
+
end
|
110
|
+
alias_method :build_get_basic_personal_data, :BuildGetBasicPersonalData
|
111
|
+
|
112
|
+
# Service Call: GetAdvancedPersonalData
|
113
|
+
# @param GetAdvancedPersonalDataRequest
|
114
|
+
# @return GetAdvancedPersonalDataResponse
|
115
|
+
def GetAdvancedPersonalData(options = {} , http_header = {})
|
116
|
+
request_object = BuildGetAdvancedPersonalData(options)
|
117
|
+
request_hash = request_object.to_hash
|
118
|
+
response_hash = request("GetAdvancedPersonalData", request_hash, http_header)
|
119
|
+
GetAdvancedPersonalDataResponse.new(response_hash)
|
120
|
+
end
|
121
|
+
alias_method :get_advanced_personal_data, :GetAdvancedPersonalData
|
122
|
+
|
123
|
+
def BuildGetAdvancedPersonalData(options = {}, &block)
|
124
|
+
klass = GetAdvancedPersonalDataRequest
|
125
|
+
object = options.is_a?(klass) ? options : klass.new(options || {})
|
126
|
+
object.instance_eval(&block) if block
|
127
|
+
object
|
128
|
+
end
|
129
|
+
alias_method :build_get_advanced_personal_data, :BuildGetAdvancedPersonalData
|
130
|
+
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIICXAIBAAKBgQCx/rJhKDRYhs9WZj66FA+HidsrKwvep3g+YNbm1fXmjcg2rEmC
|
3
|
+
kq71+Ftw9rx0Uz7vmg6vcsASUgOyeNG7mVB1SsXc6j+JAzZsmpzxHI0QKm+nBNTS
|
4
|
+
OAp5NWn6NZQfu3BNAJ/Mok/iL3am2DWXV6dU74J66rBpwIJfzs9kmw8ZGwIDAQAB
|
5
|
+
AoGAa/V1sCQ4i7FItLjTNv3P5X+h5W74hhXBguQttFj2Ct7YHwEknQPnBt2aaMve
|
6
|
+
xhdvxtgELDpHcVU5VNifLU/yUg3+DSr/YkpBWOcNTCt1seW/z5s+jr2fQERQKbyf
|
7
|
+
SXWMTqwrQ19iQoCPYaj7Drf68JhksQCaYN650g7+B/QmSBECQQDp6r75fzDtEWrr
|
8
|
+
O4Sl9plK6CRLqQQ3LveAw4JV31N2UAqgAYtzRqD6K+SviAVtX9xxuv983qQxsfX4
|
9
|
+
ozE9sGXPAkEAwsxwR1s2Acuy10h3Xj6VtnFB3PpUrkSI9c9ZxF4CMf/+AS/b2UEe
|
10
|
+
QhH60WHY8ccgKT/DoPWBcEu2o0f9nPw29QJBAI480zHNeMe/Hp+5iliM0fvtmxxy
|
11
|
+
wwB3S8L9n4RuD0dTNpLDPbO0D/DvvdhKwtoWP2rcxbx9eaRKTYKKYUfcupsCQAkP
|
12
|
+
SQmIjHJ47tBkZmjTsFLT4aRNYDLarSQBiMNBPAjnRwD3INpx1N5tx6SFUHmuMSi5
|
13
|
+
9nc9888tNklRx9HNSSECQHgs9ExBpA6WbRVcgiizOKH7fmNxAB5f6TQ2W1QHMUb+
|
14
|
+
UhZpwuDelOIfzJAQUZGTZk8a8uVmyXU5hTf3ZDbrnJ8=
|
15
|
+
-----END RSA PRIVATE KEY-----
|
16
|
+
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIICpjCCAg+gAwIBAgIDD96nMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYDVQQGEwJV
|
19
|
+
UzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFTATBgNV
|
20
|
+
BAoTDFBheVBhbCwgSW5jLjEWMBQGA1UECxQNc2FuZGJveF9jZXJ0czEbMBkGA1UE
|
21
|
+
AxQSc2FuZGJveF9jYW1lcmNoYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwu
|
22
|
+
Y29tMB4XDTA5MTAxNTA2Mzg1N1oXDTE5MTAxMzA2Mzg1N1owgYAxLTArBgNVBAMU
|
23
|
+
JHBsYXRmb18xMjU1MTcwNjk0X2Jpel9hcGkxLmdtYWlsLmNvbTEiMCAGA1UEChMZ
|
24
|
+
cGxhdGZvcm0gc2RrJ3MgVGVzdCBTdG9yZTERMA8GA1UEBxMIU2FuIEpvc2UxCzAJ
|
25
|
+
BgNVBAgTAkNBMQswCQYDVQQGEwJVUzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
|
26
|
+
gYEAsf6yYSg0WIbPVmY+uhQPh4nbKysL3qd4PmDW5tX15o3INqxJgpKu9fhbcPa8
|
27
|
+
dFM+75oOr3LAElIDsnjRu5lQdUrF3Oo/iQM2bJqc8RyNECpvpwTU0jgKeTVp+jWU
|
28
|
+
H7twTQCfzKJP4i92ptg1l1enVO+CeuqwacCCX87PZJsPGRsCAwEAAaMNMAswCQYD
|
29
|
+
VR0TBAIwADANBgkqhkiG9w0BAQUFAAOBgQCgH3kwXMJtcAaCBQLKz5TGFogJp/C3
|
30
|
+
06MvjYzdbDrx9Rjf/252UhD8dMPUP5FhU1KXduL+KIEYawPbDQ9+lV58JgM12R0p
|
31
|
+
EhCODDI/lDvzbfxUnYgkJ5cnFhTZpcAqVzWuinUnG8jAL9XKiEyu/C73ePMPWPbt
|
32
|
+
otoWi+Tk828Qlw==
|
33
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,25 @@
|
|
1
|
+
test: &default
|
2
|
+
username: jb-us-seller_api1.paypal.com
|
3
|
+
password: WX4WTU3S8MY44S7F
|
4
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
5
|
+
app_id: APP-80W284485P519543T
|
6
|
+
http_timeout: 30
|
7
|
+
mode: sandbox
|
8
|
+
redirect_url: "https://www.sandbox.paypal.com/webscr&cmd="
|
9
|
+
dev_central_url: "https://developer.paypal.com"
|
10
|
+
development:
|
11
|
+
<<: *default
|
12
|
+
|
13
|
+
with_certificate:
|
14
|
+
<<: *default
|
15
|
+
username: platfo_1255170694_biz_api1.gmail.com
|
16
|
+
password: 2DPPKUPKB7DQLXNR
|
17
|
+
signature:
|
18
|
+
cert_path: "spec/config/cert_key.pem"
|
19
|
+
app_id: APP-80W284485P519543T
|
20
|
+
soap_end_point: "https://api.sandbox.paypal.com/2.0/"
|
21
|
+
|
22
|
+
with_oauth_token:
|
23
|
+
<<: *default
|
24
|
+
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
25
|
+
token_secret: MnZ-iPdDqGLEfQIuTIfUN4uK9lU
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Permissions" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@client = PayPal::SDK::Permissions::API.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Services" do
|
10
|
+
PayPal::SDK::Permissions::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ }.each do |service_method|
|
11
|
+
it "make empty request to #{service_method}" do
|
12
|
+
response = @client.send(service_method, {})
|
13
|
+
response.response_envelope.ack.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "DataTypes" do
|
19
|
+
PayPal::SDK::Permissions::DataTypes.constants.each do |const_name|
|
20
|
+
it "create object for #{const_name}" do
|
21
|
+
klass = PayPal::SDK::Permissions::DataTypes.const_get(const_name)
|
22
|
+
klass.new.should be_a klass
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paypal-sdk-permissions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.96.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- PayPal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: paypal-sdk-core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.0
|
30
|
+
description: Permissions SDK
|
31
|
+
email:
|
32
|
+
- DL-PP-Platform-Ruby-SDK@ebay.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- spec/permissions_spec.rb
|
38
|
+
- spec/spec_helper.rb
|
39
|
+
- spec/config/paypal.yml
|
40
|
+
- spec/config/cert_key.pem
|
41
|
+
- lib/paypal-sdk-permissions.rb
|
42
|
+
- lib/paypal-sdk/permissions.rb
|
43
|
+
- lib/paypal-sdk/permissions/services.rb
|
44
|
+
- lib/paypal-sdk/permissions/api.rb
|
45
|
+
- lib/paypal-sdk/permissions/version.rb
|
46
|
+
- lib/paypal-sdk/permissions/data_types.rb
|
47
|
+
- Rakefile
|
48
|
+
- README.md
|
49
|
+
- Gemfile
|
50
|
+
homepage: https://www.x.com/
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
hash: -223861763
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
hash: -223861763
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.24
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Permissions SDK
|
80
|
+
test_files:
|
81
|
+
- spec/permissions_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- spec/config/paypal.yml
|
84
|
+
- spec/config/cert_key.pem
|