paypal-rest-api 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +214 -43
- data/VERSION +1 -1
- data/lib/paypal-api/access_token.rb +16 -2
- data/lib/paypal-api/api_collection.rb +29 -0
- data/lib/paypal-api/api_collections/authorized_payments.rb +4 -4
- data/lib/paypal-api/api_collections/captured_payments.rb +2 -2
- data/lib/paypal-api/api_collections/catalog_products.rb +2 -2
- data/lib/paypal-api/api_collections/disputes.rb +188 -0
- data/lib/paypal-api/api_collections/invoice_templates.rb +82 -0
- data/lib/paypal-api/api_collections/invoices.rb +196 -0
- data/lib/paypal-api/api_collections/orders.rb +7 -7
- data/lib/paypal-api/api_collections/payout_items.rb +47 -0
- data/lib/paypal-api/api_collections/payouts.rb +47 -0
- data/lib/paypal-api/api_collections/referenced_payout_items.rb +47 -0
- data/lib/paypal-api/api_collections/referenced_payouts.rb +47 -0
- data/lib/paypal-api/api_collections/refunds.rb +1 -1
- data/lib/paypal-api/api_collections/shipment_tracking.rb +2 -2
- data/lib/paypal-api/api_collections/subscription_plans.rb +106 -0
- data/lib/paypal-api/api_collections/subscriptions.rb +16 -98
- data/lib/paypal-api/api_collections/user_info.rb +47 -0
- data/lib/paypal-api/api_collections/users.rb +96 -0
- data/lib/paypal-api/api_collections/webhook_events.rb +78 -0
- data/lib/paypal-api/api_collections/webhook_lookups.rb +68 -0
- data/lib/paypal-api/api_collections/webhooks.rb +5 -108
- data/lib/paypal-api/client.rb +61 -0
- data/lib/paypal-api.rb +106 -12
- metadata +14 -2
data/lib/paypal-api/client.rb
CHANGED
@@ -8,6 +8,7 @@ module PaypalAPI
|
|
8
8
|
attr_reader :config
|
9
9
|
|
10
10
|
# Initializes Client
|
11
|
+
# @api public
|
11
12
|
#
|
12
13
|
# @param client_id [String] PayPal client id
|
13
14
|
# @param client_secret [String] PayPal client secret
|
@@ -127,16 +128,51 @@ module PaypalAPI
|
|
127
128
|
CatalogProducts.new(self)
|
128
129
|
end
|
129
130
|
|
131
|
+
# @return [Disputes] Disputes APIs collection
|
132
|
+
def disputes
|
133
|
+
Disputes.new(self)
|
134
|
+
end
|
135
|
+
|
136
|
+
# @return [InvoiceTemplates] InvoiceTemplates APIs collection
|
137
|
+
def invoice_templates
|
138
|
+
InvoiceTemplates.new(self)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @return [Invoices] Invoices APIs collection
|
142
|
+
def invoices
|
143
|
+
Invoices.new(self)
|
144
|
+
end
|
145
|
+
|
130
146
|
# @return [Orders] Orders APIs collection
|
131
147
|
def orders
|
132
148
|
Orders.new(self)
|
133
149
|
end
|
134
150
|
|
151
|
+
# @return [PayoutItems] PayoutItems APIs collection
|
152
|
+
def payout_items
|
153
|
+
PayoutItems.new(self)
|
154
|
+
end
|
155
|
+
|
156
|
+
# @return [Payouts] Payouts APIs collection
|
157
|
+
def payouts
|
158
|
+
Payouts.new(self)
|
159
|
+
end
|
160
|
+
|
135
161
|
# @return [Redunds] Refunds APIs collection
|
136
162
|
def refunds
|
137
163
|
Refunds.new(self)
|
138
164
|
end
|
139
165
|
|
166
|
+
# @return [ReferencedPayoutItems] ReferencedPayoutItems APIs collection
|
167
|
+
def referenced_payout_items
|
168
|
+
ReferencedPayoutItems.new(self)
|
169
|
+
end
|
170
|
+
|
171
|
+
# @return [ReferencedPayouts] ReferencedPayouts APIs collection
|
172
|
+
def referenced_payouts
|
173
|
+
ReferencedPayouts.new(self)
|
174
|
+
end
|
175
|
+
|
140
176
|
# @return [ShipmentTracking] Shipment Tracking APIs collection
|
141
177
|
def shipment_tracking
|
142
178
|
ShipmentTracking.new(self)
|
@@ -147,11 +183,36 @@ module PaypalAPI
|
|
147
183
|
Subscriptions.new(self)
|
148
184
|
end
|
149
185
|
|
186
|
+
# @return [SubscriptionPlans] Subscription Plans APIs collection
|
187
|
+
def subscription_plans
|
188
|
+
SubscriptionPlans.new(self)
|
189
|
+
end
|
190
|
+
|
191
|
+
# @return [UserInfo] User Info APIs collection
|
192
|
+
def user_info
|
193
|
+
UserInfo.new(self)
|
194
|
+
end
|
195
|
+
|
196
|
+
# @return [Users] Users Management APIs collection
|
197
|
+
def users
|
198
|
+
Users.new(self)
|
199
|
+
end
|
200
|
+
|
150
201
|
# @return [Webhooks] Webhooks APIs collection
|
151
202
|
def webhooks
|
152
203
|
Webhooks.new(self)
|
153
204
|
end
|
154
205
|
|
206
|
+
# @return [WebhookEvents] Webhook Events APIs collection
|
207
|
+
def webhook_lookups
|
208
|
+
WebhookLookups.new(self)
|
209
|
+
end
|
210
|
+
|
211
|
+
# @return [WebhookEvents] Webhook Lookups APIs collection
|
212
|
+
def webhook_events
|
213
|
+
WebhookEvents.new(self)
|
214
|
+
end
|
215
|
+
|
155
216
|
private
|
156
217
|
|
157
218
|
def execute_request(http_method, path, query: nil, body: nil, headers: nil)
|
data/lib/paypal-api.rb
CHANGED
@@ -3,25 +3,26 @@
|
|
3
3
|
#
|
4
4
|
# PaypalAPI is a main gem module.
|
5
5
|
#
|
6
|
-
# It can store global PaypalAPI::Client for easier access to APIs.
|
7
|
-
#
|
8
|
-
# @example Initializing new global client
|
9
|
-
# PaypalAPI.client = PaypalAPI::Client.new(
|
10
|
-
# client_id: ENV.fetch('PAYPAL_CLIENT_ID'),
|
11
|
-
# client_secret: ENV.fetch('PAYPAL_CLIENT_SECRET'),
|
12
|
-
# live: false
|
13
|
-
# )
|
14
|
-
#
|
15
|
-
# # And then call any APIs without mentioning the client
|
16
|
-
# PaypalAPI::Webhooks.list # or PaypalAPI.webhooks.list
|
17
|
-
#
|
18
6
|
module PaypalAPI
|
19
7
|
class << self
|
20
8
|
# Sets client
|
9
|
+
# @api public
|
10
|
+
#
|
11
|
+
# @example Initializing new global client
|
12
|
+
# PaypalAPI.client = PaypalAPI::Client.new(
|
13
|
+
# client_id: ENV.fetch('PAYPAL_CLIENT_ID'),
|
14
|
+
# client_secret: ENV.fetch('PAYPAL_CLIENT_SECRET'),
|
15
|
+
# live: false
|
16
|
+
# )
|
17
|
+
#
|
18
|
+
# @return [Client] PaypalAPI client
|
21
19
|
attr_writer :client
|
22
20
|
|
23
21
|
# @!macro [new] request
|
24
22
|
#
|
23
|
+
# @api public
|
24
|
+
# @example
|
25
|
+
# PaypalAPI.$0("/path1/path2", query: query, body: body, headers: headers)
|
25
26
|
# @param path [String] Request path
|
26
27
|
# @param query [Hash, nil] Request query parameters
|
27
28
|
# @param body [Hash, nil] Request body parameters
|
@@ -61,44 +62,121 @@ module PaypalAPI
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
65
|
+
#
|
66
|
+
# @!macro [new] api_collection
|
67
|
+
# $0 APIs collection
|
68
|
+
# @api public
|
69
|
+
# @example
|
70
|
+
# PaypalAPI.$0
|
71
|
+
#
|
72
|
+
|
64
73
|
#
|
65
74
|
# @!method authentication
|
75
|
+
# @macro api_collection
|
66
76
|
# @return [Authentication]
|
67
77
|
#
|
68
78
|
# @!method authorized_payments
|
79
|
+
# @macro api_collection
|
69
80
|
# @return [AuthorizedPayments]
|
70
81
|
#
|
71
82
|
# @!method captured_payments
|
83
|
+
# @macro api_collection
|
72
84
|
# @return [CapturedPayments]
|
73
85
|
#
|
74
86
|
# @!method catalog_products
|
87
|
+
# @macro api_collection
|
75
88
|
# @return [CatalogProducts]
|
76
89
|
#
|
90
|
+
# @!method disputes
|
91
|
+
# @macro api_collection
|
92
|
+
# @return [Disputes]
|
93
|
+
#
|
94
|
+
# @!method invoice_templates
|
95
|
+
# @macro api_collection
|
96
|
+
# @return [InvoiceTemplates]
|
97
|
+
#
|
98
|
+
# @!method invoices
|
99
|
+
# @macro api_collection
|
100
|
+
# @return [Invoices]
|
101
|
+
#
|
77
102
|
# @!method orders
|
103
|
+
# @macro api_collection
|
78
104
|
# @return [Orders]
|
79
105
|
#
|
106
|
+
# @!method payout_items
|
107
|
+
# @macro api_collection
|
108
|
+
# @return [PayoutItems]
|
109
|
+
#
|
110
|
+
# @!method payouts
|
111
|
+
# @macro api_collection
|
112
|
+
# @return [Payouts]
|
113
|
+
#
|
80
114
|
# @!method refunds
|
115
|
+
# @macro api_collection
|
81
116
|
# @return [Refunds]
|
82
117
|
#
|
118
|
+
# @!method referenced_payout_items
|
119
|
+
# @macro api_collection
|
120
|
+
# @return [ReferencedPayoutItems]
|
121
|
+
#
|
122
|
+
# @!method referenced_payouts
|
123
|
+
# @macro api_collection
|
124
|
+
# @return [ReferencedPayouts]
|
125
|
+
#
|
83
126
|
# @!method shipment_tracking
|
127
|
+
# @macro api_collection
|
84
128
|
# @return [ShipmentTracking]
|
85
129
|
#
|
86
130
|
# @!method subscriptions
|
131
|
+
# @macro api_collection
|
87
132
|
# @return [Subscriptions]
|
88
133
|
#
|
134
|
+
# @!method subscription_plans
|
135
|
+
# @macro api_collection
|
136
|
+
# @return [SubscriptionPlans]
|
137
|
+
#
|
138
|
+
# @!method user_info
|
139
|
+
# @macro api_collection
|
140
|
+
# @return [UserInfo]
|
141
|
+
#
|
142
|
+
# @!method users
|
143
|
+
# @macro api_collection
|
144
|
+
# @return [Users]
|
145
|
+
#
|
89
146
|
# @!method webhooks
|
147
|
+
# @macro api_collection
|
90
148
|
# @return [Webhooks]
|
91
149
|
#
|
150
|
+
# @!method webhook_events
|
151
|
+
# @macro api_collection
|
152
|
+
# @return [WebhookEvents]
|
153
|
+
#
|
154
|
+
# @!method webhook_lookups
|
155
|
+
# @macro api_collection
|
156
|
+
# @return [WebhookLookups]
|
157
|
+
#
|
92
158
|
%i[
|
93
159
|
authentication
|
94
160
|
authorized_payments
|
95
161
|
captured_payments
|
96
162
|
catalog_products
|
163
|
+
disputes
|
164
|
+
invoice_templates
|
165
|
+
invoices
|
97
166
|
orders
|
167
|
+
payout_items
|
168
|
+
payouts
|
98
169
|
refunds
|
170
|
+
referenced_payout_items
|
171
|
+
referenced_payouts
|
99
172
|
shipment_tracking
|
100
173
|
subscriptions
|
174
|
+
subscription_plans
|
175
|
+
user_info
|
176
|
+
users
|
101
177
|
webhooks
|
178
|
+
webhook_events
|
179
|
+
webhook_lookups
|
102
180
|
].each do |method_name|
|
103
181
|
define_method(method_name) do
|
104
182
|
client.public_send(method_name)
|
@@ -106,6 +184,10 @@ module PaypalAPI
|
|
106
184
|
end
|
107
185
|
|
108
186
|
# Globally set Client object
|
187
|
+
# @api public
|
188
|
+
# @example
|
189
|
+
# PaypalAPI.client
|
190
|
+
# @return [Client]
|
109
191
|
def client
|
110
192
|
raise "#{name}.client must be set" unless @client
|
111
193
|
|
@@ -128,8 +210,20 @@ require_relative "paypal-api/api_collections/authentication"
|
|
128
210
|
require_relative "paypal-api/api_collections/authorized_payments"
|
129
211
|
require_relative "paypal-api/api_collections/captured_payments"
|
130
212
|
require_relative "paypal-api/api_collections/catalog_products"
|
213
|
+
require_relative "paypal-api/api_collections/disputes"
|
214
|
+
require_relative "paypal-api/api_collections/invoice_templates"
|
215
|
+
require_relative "paypal-api/api_collections/invoices"
|
131
216
|
require_relative "paypal-api/api_collections/orders"
|
217
|
+
require_relative "paypal-api/api_collections/payout_items"
|
218
|
+
require_relative "paypal-api/api_collections/payouts"
|
132
219
|
require_relative "paypal-api/api_collections/refunds"
|
220
|
+
require_relative "paypal-api/api_collections/referenced_payout_items"
|
221
|
+
require_relative "paypal-api/api_collections/referenced_payouts"
|
133
222
|
require_relative "paypal-api/api_collections/shipment_tracking"
|
134
223
|
require_relative "paypal-api/api_collections/subscriptions"
|
224
|
+
require_relative "paypal-api/api_collections/subscription_plans"
|
225
|
+
require_relative "paypal-api/api_collections/user_info"
|
226
|
+
require_relative "paypal-api/api_collections/users"
|
135
227
|
require_relative "paypal-api/api_collections/webhooks"
|
228
|
+
require_relative "paypal-api/api_collections/webhook_events"
|
229
|
+
require_relative "paypal-api/api_collections/webhook_lookups"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-rest-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Glushkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PayPal REST API with no dependencies.
|
14
14
|
email:
|
@@ -26,10 +26,22 @@ files:
|
|
26
26
|
- lib/paypal-api/api_collections/authorized_payments.rb
|
27
27
|
- lib/paypal-api/api_collections/captured_payments.rb
|
28
28
|
- lib/paypal-api/api_collections/catalog_products.rb
|
29
|
+
- lib/paypal-api/api_collections/disputes.rb
|
30
|
+
- lib/paypal-api/api_collections/invoice_templates.rb
|
31
|
+
- lib/paypal-api/api_collections/invoices.rb
|
29
32
|
- lib/paypal-api/api_collections/orders.rb
|
33
|
+
- lib/paypal-api/api_collections/payout_items.rb
|
34
|
+
- lib/paypal-api/api_collections/payouts.rb
|
35
|
+
- lib/paypal-api/api_collections/referenced_payout_items.rb
|
36
|
+
- lib/paypal-api/api_collections/referenced_payouts.rb
|
30
37
|
- lib/paypal-api/api_collections/refunds.rb
|
31
38
|
- lib/paypal-api/api_collections/shipment_tracking.rb
|
39
|
+
- lib/paypal-api/api_collections/subscription_plans.rb
|
32
40
|
- lib/paypal-api/api_collections/subscriptions.rb
|
41
|
+
- lib/paypal-api/api_collections/user_info.rb
|
42
|
+
- lib/paypal-api/api_collections/users.rb
|
43
|
+
- lib/paypal-api/api_collections/webhook_events.rb
|
44
|
+
- lib/paypal-api/api_collections/webhook_lookups.rb
|
33
45
|
- lib/paypal-api/api_collections/webhooks.rb
|
34
46
|
- lib/paypal-api/client.rb
|
35
47
|
- lib/paypal-api/config.rb
|