paystackapi 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ba82afef2fefb1237161ae822651db461aa466b149d1fbfe5a4378b84624e50
4
- data.tar.gz: be1d8f666f537b7c3ea39a9a1a8771f3be74487170fa66bf9d803f50bd06d14d
3
+ metadata.gz: 0d0a49833d54be1cdfd68829955e94ea1d9d975f7c8b6c6b42e74c8fa6c3dec2
4
+ data.tar.gz: 954eee81fcbd67f11e5545995b6d981fe41778a72cd0ce5f870639bbde465d0b
5
5
  SHA512:
6
- metadata.gz: 95f205513c08322e8f46d4a615497e16a9bd4d093c04a314840234b5e952c2f83d1a2225f1a2878299d53f59e4722136901b731a036032b94fe9e1b45d538ab6
7
- data.tar.gz: 15004a3e696cf757007d41ed1f556e3976d1af1ddc339e07ac4941bf6f18f10a363300e20562bb0133e5352068386cff67feb4f63d7eba2ccdc8c42bb29a9c7a
6
+ metadata.gz: e20fe943b7533100767545713a58ce0a44dc4fa51d9562b8fd996f340722094ed431814d7e0caaecb53f20152dbbf14b445176c7fa6c3d39b176f33d63066368
7
+ data.tar.gz: 74ea140a28db7d561cbeb712636f3324f9bcbbbbb53f69f665eb6af261430c906931c6b5c0bce7aacac7c15a8563bfe2a724ebba01454f920312a4169a345d9e
@@ -1,6 +1,6 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Samuel Joseph
3
+ Copyright (c) 2019 samuel52
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,144 +1,43 @@
1
- # Paystackapi :moneybag:
2
- [![CircleCI](https://circleci.com/gh/samuel52/PaystackRubyApi.svg?style=shield)](https://circleci.com/gh/samuel52/PaystackRubyApi)
3
- [![Gem Version](https://badge.fury.io/rb/paystackapi.svg)](https://badge.fury.io/rb/paystackapi)
1
+ # Paystackapi
4
2
 
5
- Paystack gem for Ruby api only application
6
- ### Installation
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paystackapi`. To experiment with that code, run `bin/console` for an interactive prompt.
7
4
 
8
- Simply add this line to your application's Gemfile:
5
+ TODO: Delete this and the text above, and describe your gem
9
6
 
10
- ```ruby
11
- gem 'paystackapi'
12
- ```
7
+ ## Installation
13
8
 
14
- And then execute:
15
- ```ruby
16
- bundle install
17
- ```
9
+ Add this line to your application's Gemfile:
18
10
 
19
- Or install it yourself as:
20
11
  ```ruby
21
- gem install paystackapi
22
- ```
23
-
24
- ### Usage
25
-
26
- You may need to install [Dotenv](https://github.com/bkeepers/dotenv) to set you environmental variables. Set the requirements in your controller files where needed.
27
-
28
- ```ruby
29
- require 'paystackapi'
30
- require 'dotenv/load'
31
- ```
32
-
33
- ### Transactions :credit_card:
34
- ###### Verify Payment
35
-
36
- ```ruby
37
-
38
- def validate_payment
39
- paystack_ref = params[:reference_code] # get payment ref after initializing payment from the frontend
40
- verify = Paystackapi::PaystackTransactions.verify(paystack_ref)
41
- end
12
+ gem 'paystackapi'
42
13
  ```
43
- ###### Other Transaction Methods :point_down:
44
14
 
45
- ```ruby
46
- Paystackapi::PaystackTransactions.list # list all transactions
47
- Paystackapi::PaystackTransactions.totals # show transaction totals
48
- Paystackapi::PaystackTransactions.list_single(arg) # list single transaction
49
- Paystackapi::PaystackTransactions.charge(arg) # charge authorization from card
50
- ```
51
- ### Customers :two_men_holding_hands:
15
+ And then execute:
52
16
 
53
- ```ruby
54
- def customers
55
- customerEmail = params[:customer_email]
56
- customer = Paystackapi::PaystackCustomers.create(customerEmail)
57
- end
58
- ```
59
- ###### Other Customer Methods
17
+ $ bundle
60
18
 
61
- ```ruby
62
- Paystackapi::PaystackCustomers.list #list all customers
63
- Paystackapi::PaystackCustomers.list_single(arg) #get by id
64
- ```
65
- ### Plans :cyclone:
19
+ Or install it yourself as:
66
20
 
67
- ```ruby
68
- def plans
69
- createPlan = {
70
- CustomerName = params[:name]
71
- interval = params[:interval]
72
- amount = params[:amount]
73
- }
74
- customer = Paystackapi::PaystackPlans.create(createPlan)
75
- end
76
- ```
77
- ###### Other Plans Methods
21
+ $ gem install paystackapi
78
22
 
79
- ```ruby
80
- Paystackapi::PaystackPlans.list #list all paystack plans
81
- Paystackapi::PaystackPlans.list_single(arg) #get by id
82
- Paystackapi::PaystackPlans.update(arg) #update plan by id
83
- ```
84
- ### Subscription :electric_plug:
85
- ```ruby
86
- def subscription
87
- createSub = {
88
- CustomerToken = "CUS_xnxdt6s1zg1f4nx"
89
- planCode = "PLN_gx2wn530m0i3w3m"
90
- }
91
-
92
- customer = Paystackapi::PaystackSubscription.create(createSub)
93
- end
94
- ```
95
- ###### Other Subcription Methods
23
+ ## Usage
96
24
 
97
- ```ruby
98
- Paystackapi::PaystackSubscription.list #list all subs
99
- Paystackapi::PaystackSubscription.list_single(arg) #get subs by id
100
- Paystackapi::PaystackSubscription.disable #disable subs
101
- Paystackapi::PaystackSubscription.enable #enable subs
102
- ```
103
- ### Paystack Transfer :boom:
104
- ```ruby
105
- def transfer
106
- createTrans = {
107
- type = "nuban" #use params[:something] to get the parameters from your endpoint
108
- name = "Raz"
109
- description = "Razite"
110
- account_number = "01000000419"
111
- bank_code = "044"
112
- currency = "NGN"
113
- }
114
- customer = Paystackapi::PaystackTransfer.generate(createTrans)
115
- end
116
- ```
117
- ###### Other Transfer Methods
25
+ TODO: Write usage instructions here
118
26
 
119
- ```ruby
120
- Paystackapi::PaystackTransfer.list_reciept #list all transfers Reciept
121
- Paystackapi::PaystackTransfer.update_reciept(arg, arg) #update reciept
122
- Paystackapi::PaystackTransfer.initailize(arg) #initalize a transfer (triggers an otp here)
123
- Paystackapi::PaystackTransfer.list_transfer #list all transfers
124
- Paystackapi::PaystackTransfer.finalize(arg) #finalize a transfer
125
-
126
- ```
127
- ### Bank List :bank:
128
- ```ruby
129
- Paystackapi::PaystackSubscription.list_banks #list all Nigerian Banks
130
- ```
27
+ ## Development
131
28
 
132
- ### Contributing
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
133
30
 
134
- Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
135
32
 
136
- ### Who are you?
33
+ ## Contributing
137
34
 
138
- I'm Sam, find me on [twitter](https://twitter.com/sammyngn).
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/paystackapi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
139
36
 
140
- ### License
37
+ ## License
141
38
 
142
39
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
143
40
 
41
+ ## Code of Conduct
144
42
 
43
+ Everyone interacting in the Paystackapi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/paystackapi/blob/master/CODE_OF_CONDUCT.md).
data/lib/paystackapi.rb CHANGED
@@ -1,103 +1,164 @@
1
- require 'paystackapi/core/version'
2
- require 'paystackapi/core/base.rb'
3
- require 'paystackapi/core/transaction.rb'
4
- require 'paystackapi/core/bank.rb'
5
- require 'paystackapi/core/customer.rb'
6
- require 'paystackapi/core/otp.rb'
7
- require 'paystackapi/core/plan.rb'
8
- require 'paystackapi/core/transfer.rb'
9
- require 'paystackapi/core/subscription.rb'
1
+ require 'paystackapi/version'
2
+ require 'paystackapi/base.rb'
10
3
  require 'httparty'
11
- require 'dotenv'
4
+ require 'openssl'
5
+ require 'dotenv/load'
12
6
 
13
7
  module Paystackapi
14
8
  class PaystackTransactions
15
- def self.verify(body)
16
- Transaction.verify_payment(body)
17
- end
18
- def self.list
19
- Transaction.list_transactions
20
- end
21
- def self.totals
22
- Transaction.list_transaction_totals
23
- end
24
- def self.list_single(body)
25
- Transaction.fetch_transaction(body)
26
- end
27
- def self.charge(body)
28
- Transaction.charge_authorization(body)
9
+ def self.verify_payment(body)
10
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}" + "/verify/#{body}",
11
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
12
+ return api
13
+ end
14
+ def self.list_transactions()
15
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}",
16
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
17
+ return api
18
+ end
19
+ def self.list_transaction_totals()
20
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "totals",
21
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
22
+ return api
23
+ end
24
+ def self.fetch_transaction(body)
25
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "#{body}",
26
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
27
+ return api
28
+ end
29
+ def self.charge_authorization(body)
30
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "charge_authorization",
31
+ :body => body.to_json,
32
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
33
+ return api
29
34
  end
30
35
  end
31
36
  class PaystackCustomers
32
- def self.create(body)
33
- Customer.create_customer(body)
34
- end
35
- def self.list
36
- Customer.list_customer
37
- end
38
- def self.list_single(body)
39
- Customer.fetch_a_customer(body)
37
+ def self.create_customer(body)
38
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
39
+ :body => body.to_json,
40
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
41
+ return api
42
+ end
43
+ def self.list_customer()
44
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
45
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
46
+ return api
47
+ end
48
+ def self.fetch_a_customer(body)
49
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}/" + "#{body}",
50
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
51
+ return api
40
52
  end
41
53
  end
42
54
 
43
55
  class PaystackPlans
44
- def self.create(body)
45
- Plan.create_plan(body)
46
- end
47
- def self.list
48
- Plan.list_plans
49
- end
50
- def self.list_single(body)
51
- Plan.list_single_plan(body)
52
- end
53
- def self.update(body, plan)
54
- Plan.update_plan(body, plan)
56
+ def self.create_plan(body)
57
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
58
+ :body => body.to_json,
59
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
60
+ return api
61
+ end
62
+ def self.list_plans()
63
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
64
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
65
+ return api
66
+ end
67
+ def self.list_single_plan(body)
68
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
69
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
70
+ return api
71
+ end
72
+ def self.update_plan(body)
73
+ api = HTTParty.put("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
74
+ :body => body.to_json,
75
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
76
+ return api
55
77
  end
56
78
  end
57
79
 
58
80
 
59
81
  class PaystackSubscription
60
- def self.create(body)
61
- Subscription.create_subscription(body)
62
- end
63
- def self.list
64
- Subscription.list_subscription
65
- end
66
- def self.list_single(body)
67
- Subscription.list_single_subscription(body)
68
- end
69
- def self.disable(body)
70
- Subscription.disable_subscription(body)
71
- end
72
- def self.enable(body)
73
- Subscription.enable_subscription(body)
82
+ def self.create_subscription(body)
83
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
84
+ :body => body.to_json,
85
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
86
+ return api
87
+ end
88
+ def self.list_subscription()
89
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
90
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
91
+ return api
92
+ end
93
+ def self.list_single_subscription(body)
94
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}" + "#{body}",
95
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
96
+ return api
97
+ end
98
+ def self.disable_subscription()
99
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "disable",
100
+ :body => body.to_json,
101
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
102
+ return api
103
+ end
104
+ def self.enable_subscription()
105
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "enable",
106
+ :body => body.to_json,
107
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
108
+ return api
74
109
  end
110
+
75
111
  end
76
112
 
77
113
  class PaystackTransfer
78
- def self.generate(body)
79
- Transfer.create_transfer_reciept(body)
80
- end
81
- def self.list_reciept
82
- Transfer.list_transfer_reciept
83
- end
84
- def self.update_reciept(body, trf_code)
85
- Transfer.update_transfer_reciept(body, trf_code)
86
- end
87
- def self.initailize(body)
88
- Transfer.init_transfer(body)
89
- end
90
- def self.list_transfer
91
- Transfer.list_transfers
92
- end
93
- def self.finalize(body)
94
- Transfer.finalize_transfers(body)
114
+ def self.create_transfer_reciept(body)
115
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
116
+ :body => body.to_json,
117
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
118
+ return api
119
+ end
120
+ def self.list_transfer_reciept(body)
121
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
122
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
123
+ return api
124
+ end
125
+ def self.update_transfer_reciept(body, trf_code)
126
+ api = HTTParty.put("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}" + "#{trf_code}",
127
+ :body => body.to_json,
128
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
129
+ return api
130
+ end
131
+ def self.init_transfer(body)
132
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
133
+ :body => body.to_json,
134
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
135
+ return api
136
+ end
137
+ def self.list_transfers(body)
138
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
139
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
140
+ return api
141
+ end
142
+ def self.finalize_transfers(body)
143
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/finalize_transfer",
144
+ :body => body.to_json,
145
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
146
+ return api
147
+ end
148
+ def self.resend_otp(body)
149
+ api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/resend_otp",
150
+ :body => body.to_json,
151
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
152
+ return api
95
153
  end
154
+
96
155
  end
97
156
 
98
157
  class PaystackBank
99
- def self.list_banks
100
- Bank.banks
158
+ def self.banks()
159
+ api = HTTParty.get("#{API::BASE_URL}" + "#{API::BANK_PATH}",
160
+ :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
161
+ return api
101
162
  end
102
163
  end
103
164
  end
File without changes
@@ -1,15 +1,15 @@
1
- module Transaction
1
+ class Transaction
2
2
  def self.verify_payment(body)
3
3
  api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}" + "/verify/#{body}",
4
4
  :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
5
5
  return api
6
6
  end
7
- def self.list_transactions
7
+ def self.list_transactions()
8
8
  api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}",
9
9
  :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
10
10
  return api
11
11
  end
12
- def self.list_transaction_totals
12
+ def self.list_transaction_totals()
13
13
  api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "totals",
14
14
  :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
15
15
  return api
@@ -24,5 +24,5 @@ module Transaction
24
24
  :body => body.to_json,
25
25
  :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
26
26
  return api
27
- end
27
+ end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module Paystackapi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paystackapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Joseph
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-15 00:00:00.000000000 Z
11
+ date: 2019-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,68 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: httparty
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.16.3
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.16.3
69
- - !ruby/object:Gem::Dependency
70
- name: dotenv
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.6'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.6'
83
- - !ruby/object:Gem::Dependency
84
- name: openssl
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.1'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 2.1.2
93
- type: :runtime
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '2.1'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 2.1.2
103
41
  description: This gem will be used mostly for ruby api only apps
104
42
  email:
105
43
  - samuelsadiq52@gmail.com
@@ -108,18 +46,12 @@ extensions: []
108
46
  extra_rdoc_files: []
109
47
  files:
110
48
  - CODE_OF_CONDUCT.md
111
- - LICENSE.md
49
+ - LICENSE.txt
112
50
  - README.md
113
51
  - lib/paystackapi.rb
114
- - lib/paystackapi/core/bank.rb
115
- - lib/paystackapi/core/base.rb
116
- - lib/paystackapi/core/customer.rb
117
- - lib/paystackapi/core/otp.rb
118
- - lib/paystackapi/core/plan.rb
119
- - lib/paystackapi/core/subscription.rb
120
- - lib/paystackapi/core/transaction.rb
121
- - lib/paystackapi/core/transfer.rb
122
- - lib/paystackapi/core/version.rb
52
+ - lib/paystackapi/base.rb
53
+ - lib/paystackapi/transaction.rb
54
+ - lib/paystackapi/version.rb
123
55
  homepage: https://github.com/samuel52/PaystackRubyApi.git
124
56
  licenses:
125
57
  - MIT
@@ -1,7 +0,0 @@
1
- module Bank
2
- def self.banks
3
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::BANK_PATH}",
4
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
5
- return api
6
- end
7
- end
@@ -1,18 +0,0 @@
1
- module Customer
2
- def self.create_customer(body)
3
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
4
- :body => body.to_json,
5
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
6
- return api
7
- end
8
- def self.list_customer
9
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
10
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
11
- return api
12
- end
13
- def self.fetch_a_customer(body)
14
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}/" + "#{body}",
15
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
16
- return api
17
- end
18
- end
@@ -1,8 +0,0 @@
1
- module Otp
2
- def self.resend_otp(body)
3
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/resend_otp",
4
- :body => body.to_json,
5
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
6
- return api
7
- end
8
- end
@@ -1,24 +0,0 @@
1
- module Plan
2
- def self.create_plan(body)
3
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
4
- :body => body.to_json,
5
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
6
- return api
7
- end
8
- def self.list_plans
9
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
10
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
11
- return api
12
- end
13
- def self.list_single_plan(body)
14
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
15
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
16
- return api
17
- end
18
- def self.update_plan(body, plan)
19
- api = HTTParty.put("#{API::BASE_URL}" + "#{API::PLAN_PATH}/" + "#{plan}",
20
- :body => body.to_json,
21
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
22
- return api
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- module Subscription
2
- def self.create_subscription(body)
3
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
4
- :body => body.to_json,
5
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
6
- return api
7
- end
8
- def self.list_subscription
9
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
10
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
11
- return api
12
- end
13
- def self.list_single_subscription(body)
14
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "#{body}",
15
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
16
- return api
17
- end
18
- def self.disable_subscription(body)
19
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "disable",
20
- :body => body.to_json,
21
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
22
- return api
23
- end
24
- def self.enable_subscription
25
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "enable",
26
- :body => body.to_json,
27
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
28
- return api
29
- end
30
- end
@@ -1,36 +0,0 @@
1
- module Transfer
2
- def self.create_transfer_reciept(body)
3
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
4
- :body => body.to_json,
5
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
6
- return api
7
- end
8
- def self.list_transfer_reciept
9
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
10
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
11
- return api
12
- end
13
- def self.update_transfer_reciept(body, trf_code)
14
- api = HTTParty.put("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}/" + "#{trf_code}",
15
- :body => body.to_json,
16
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
17
- return api
18
- end
19
- def self.init_transfer(body)
20
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
21
- :body => body.to_json,
22
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
23
- return api
24
- end
25
- def self.list_transfers
26
- api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
27
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
28
- return api
29
- end
30
- def self.finalize_transfers(body)
31
- api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/finalize_transfer",
32
- :body => body.to_json,
33
- :headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
34
- return api
35
- end
36
- end