paylense-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9618ea6452cab9574ed91381605c590c0327c748564790bb27e7194f5b6ccb70
4
+ data.tar.gz: c45d3db63fa6a7b76e9a5eb73b19b6268ab2dc03d9704d555499e9386636b312
5
+ SHA512:
6
+ metadata.gz: be4908b7392bcab320ce11af51a9778033453955387ec600eaa66bf491add342df973f575577e40ea5048f016798eae1ea9f5345bb602d99af110dd9c501a5bd
7
+ data.tar.gz: 476d7cf81ba797e79f4c2d7b0b8961c5ba225fe150f17fb32d3272d06e156b0bc9218714520079412c8dbb6b70d9b5328d5a83a3d0d020fa5f6e32661cfc3fd0
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ repo_token: 788j9999999
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/cassettes/
9
+ /tmp/
10
+ Gemfile.lock
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ Documentation:
2
+ Enabled: false
3
+ Naming/FileName:
4
+ Enabled: false
5
+ Metrics/MethodLength:
6
+ Max: 25
7
+ Metrics/BlockLength:
8
+ Max: 35
9
+ Metrics/ParameterLists:
10
+ Max: 8
11
+ Lint/DuplicateMethods:
12
+ Enabled: false
13
+ Naming/AccessorMethodName:
14
+ Enabled: false
15
+ Naming/PredicateName:
16
+ Enabled: false
17
+ Style/AsciiComments:
18
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.2
8
+ git:
9
+ depth: 25
10
+ quiet: true
@@ -0,0 +1,128 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at `acellam.guy@gmail.com`
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in paylense-sdk.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Winopay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Paylense API Ruby Gem
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/paylense-sdk.svg)](https://badge.fury.io/rb/paylense-sdk)
4
+ [![Build Status](https://travis-ci.org/winopay/paylense-sdk.svg?branch=master)](https://travis-ci.org/winopay/paylense-sdk)
5
+ [![Coverage Status](https://coveralls.io/repos/github/winopay/paylense-sdk/badge.svg?branch=master)](https://coveralls.io/github/winopay/paylense-sdk?branch=master)
6
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
7
+ [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/paylense-api-sdk/)
8
+
9
+ ## Usage
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'paylense-sdk'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install paylense-sdk
26
+
27
+ ## Using credentials
28
+ Add the following configurations in an initializer file (for example, `config/initializers/paylense-sdk.rb` in a Rails app):
29
+
30
+ ```
31
+ Paylense.configure do |config|
32
+ config.version = 'Paylense API version you plan to use'
33
+ config.envrionment = 'Specify if your testing the API or you are ready to do business'
34
+ config.api_key = 'Your Paylense API key'
35
+ config.api_secret = 'Your Paylense API secret'
36
+ end
37
+ ```
38
+
39
+ ## Collections
40
+ Used to create an instance of collection
41
+
42
+
43
+ You can create an collection client with the following:
44
+
45
+ ```ruby
46
+ require 'paylense-sdk'
47
+
48
+ collection = Paylense::Collections.new
49
+ ```
50
+
51
+ ### Methods
52
+ 1. `request_to_pay`: This operation is used to request a payment from a Payer. The payer will be asked to authorize the payment. The transaction is executed once the payer has authorized the payment. The transaction will be in status PENDING until it is authorized or declined by the payer or it is timed out by the system. The status of the transaction can be validated by using `get_transaction_status`.
53
+
54
+ 2. `get_transaction_status`: Retrieve transaction information using the `transaction_reference` returned by `request_to_pay`. You can invoke it at intervals until the transaction fails or succeeds. If the transaction has failed, it will throw an appropriate error.
55
+
56
+ ## Disbursements
57
+ Used to create an instance of disbursement
58
+
59
+ You can create an disbursement client with the following:
60
+
61
+ ```ruby
62
+ require 'paylense-sdk'
63
+
64
+ disbursement = Paylense::Disbursements.new
65
+ ```
66
+
67
+ ### Methods
68
+ 1. `transfer`: Used to transfer an amount from the owner’s account to a payee account. The status of the transaction can be validated by using the `get_transaction_status` method.
69
+
70
+ 2. `get_transaction_status`: Retrieve transaction information using the `transaction_reference` returned by `transfer`. You can invoke it at intervals until the transaction fails or succeeds. If the transaction has failed, it will throw an appropriate error.
71
+
72
+ ## Sample Code
73
+
74
+ ```ruby
75
+ require 'paylense-sdk'
76
+
77
+ collection = Paylense::collection.new
78
+
79
+ transaction = collection.request_to_pay(
80
+ phone_number="256772123456", amount=600,
81
+ procession_number="123456789", narration="dd")
82
+
83
+ transaction_ref = transaction[:transaction_reference]
84
+
85
+ collection.get_transaction_status(transaction_ref)
86
+
87
+ ```
88
+
89
+ ### Points to note:
90
+ All methods for Disbursements follow the same format as the examples shown above for Collections
91
+
92
+ The 'transfer' method for Disbursements follows the same format as 'request_to_pay' above.
93
+
94
+ ## Additional documentation
95
+ For additional documentation, please refer to this link: https://docs.paylense.com
96
+
97
+ ## Contributing
98
+ Bug reports and pull requests are welcome on GitHub at https://github.com/winopay/paylense-ruby-sdk. 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.
99
+
100
+ ## Development
101
+
102
+ Install the gems using bundler
103
+
104
+ ```bash
105
+ bundle install
106
+ ```
107
+
108
+ Run the the unit tests:
109
+
110
+ ```bash
111
+ rspec
112
+ ```
113
+
114
+
115
+ ## License
116
+
117
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
118
+
119
+ ## Code of Conduct
120
+
121
+ Everyone interacting in the Paylense::Ruby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/winopay/paylense-ruby-sdk/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'paylense-sdk'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/paylense-sdk ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'paylense-sdk'
6
+ require 'optparse'
7
+ require_relative '../lib/paylense-sdk/cli'
8
+
9
+ options = {}
10
+ OptionParser.new do |opts|
11
+ opts.banner = 'Usage: Paylense --key key --secret secret'
12
+
13
+ opts.on('-k', '--key=KEY', String,
14
+ 'Merchant account API Key') do |v|
15
+ options[:key] = v
16
+ end
17
+
18
+ opts.on('-s', '--secret=SECRET', String,
19
+ 'Merchant account API secret') do |v|
20
+ options[:secret] = v
21
+ end
22
+ end.parse!
23
+
24
+ Paylense::CLI.new(options)
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'paylense-sdk/config'
4
+ require 'paylense-sdk/version'
5
+ require 'paylense-sdk/collections'
6
+ require 'paylense-sdk/disbursements'
7
+
8
+ module Paylense
9
+ class << self
10
+ attr_accessor :config
11
+ end
12
+
13
+ def self.config
14
+ @config ||= Config.new
15
+ end
16
+
17
+ def self.reset
18
+ @config = Config.new
19
+ end
20
+
21
+ def self.configure
22
+ yield(config)
23
+ end
24
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Base implementation of the Paylense API client
4
+
5
+ # Includes methods common to collections, disbursements
6
+
7
+ require 'faraday'
8
+
9
+ require 'paylense-sdk/config'
10
+ require 'paylense-sdk/errors'
11
+
12
+ module Paylense
13
+ class Client
14
+ def send_request(service, method, path, body = {})
15
+ begin
16
+ conn = create_connection(service)
17
+ relative_path = "/api/#{Paylense.config.version}#{path}"
18
+
19
+ case method
20
+ when 'get'
21
+ response = conn.get(relative_path)
22
+ when 'post'
23
+ response = conn.post(relative_path, body.to_json)
24
+ end
25
+ rescue ArgumentError
26
+ raise 'Missing configuration key(s)'
27
+ end
28
+ interpret_response(response)
29
+ end
30
+
31
+ def interpret_response(resp)
32
+ body = resp.body.empty? ? '' : JSON.parse(resp.body)
33
+
34
+ response = {
35
+ body: body,
36
+ code: resp.status
37
+ }
38
+ unless resp.status >= 200 && resp.status < 300
39
+ handle_error(response[:body], response[:code])
40
+ end
41
+
42
+ body
43
+ end
44
+
45
+ def handle_error(response_body, response_code)
46
+ raise Paylense::Error.new(response_body, response_code)
47
+ end
48
+
49
+ # set authorization and authentication
50
+ def create_connection(service)
51
+ url = "https://#{service}.paylense.com" if Payhere.config.environment.eql? 'production'
52
+ url = "https://sandbox#{service}.paylense.com" if Payhere.config.environment.eql? 'sandbox'
53
+
54
+ headers = {
55
+ "Content-Type": 'application/json',
56
+ "Accept": 'application/json'
57
+ }
58
+
59
+ conn = Faraday.new(url: url)
60
+ conn.headers = headers
61
+
62
+ get_credentials
63
+ conn.authorization @access_token
64
+ conn.headers['Secret-Key'] = @secret_key
65
+
66
+ conn
67
+ end
68
+
69
+ def get_credentials
70
+ @secret_key = Paylense.config.secret_key
71
+ @access_token = Paylense.config.access_token
72
+ end
73
+
74
+ # retrieve transaction information
75
+ def get_transaction_status(path)
76
+ send_request('get', path)
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Implementation of the Paylense API collections client
4
+
5
+ require 'securerandom'
6
+
7
+ require 'paylense-sdk/config'
8
+ require 'paylense-sdk/client'
9
+ require 'paylense-sdk/validate'
10
+
11
+ module Paylense
12
+ class Collections < Client
13
+ # This method is used to request a payment from a Payer
14
+ # The payer will be asked to authorize the payment. The transaction will
15
+ # be executed once the payer has authorized the payment.
16
+ # The request to pay will be in status PENDING until the transaction
17
+ # is authorized or declined by the payer or it is timed out by the system.
18
+ # The status of the transaction is received via the webhook
19
+
20
+ def request_to_pay(api_key,account_number, amount, merchant_reference, payment_method, provider, currency,
21
+ encrypted_card ='', narration = '', account_name = '', account_email ='', redirect_url = '', callback_url = '')
22
+ Paylense::Validate.new.validate(account_number, amount)
23
+ merchant_reference = SecureRandom.uuid unless merchant_reference.blank?
24
+
25
+ body = {
26
+ "account_number": account_number,
27
+ "narration": narration,
28
+ "merchant_reference": merchant_reference,
29
+ "amount": amount.to_i,
30
+ "api_key": api_key,
31
+ "payment_method": payment_method,
32
+ "provider": provider,
33
+ "currency": currency,
34
+ "encrypted_card": encrypted_card,
35
+ "account_name": account_name,
36
+ "account_email": account_email,
37
+ "redirect_url": redirect_url,
38
+ "callback_url": callback_url
39
+ }
40
+ path = '/request-to-pay'
41
+ send_request('collections', 'post', path, body)
42
+ #{ transaction_reference: uuid }
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Configurations are set up in this file
4
+ # for a user's Paylense API user credentials
5
+
6
+ module Paylense
7
+ class Config
8
+ attr_accessor :environment, :version, :app_key, :api_secret
9
+
10
+ def initialize
11
+ @environment = nil
12
+ @version = nil
13
+ @api_key = nil
14
+ @api_secret = nil
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Implementation of Paylense API disbursements client
4
+
5
+ require 'paylense-sdk/config'
6
+ require 'paylense-sdk/client'
7
+
8
+ module Paylense
9
+ class Disbursements < Client
10
+ # The transfer operation is used to transfer an amount from the payer's
11
+ # account to a payee account.
12
+ # The status of the transaction can be validated
13
+ # by using `get_transation_status`
14
+ def transfer(api_key, account_number, amount, merchant_reference, payment_method, provider, currency,
15
+ narration = '', account_name = '', account_email ='', redirect_url = '', callback_url = '',
16
+ extra_provider_detail = {})
17
+ Paylense::Validate.new.validate(account_number, amount)
18
+ merchant_reference = SecureRandom.uuid unless merchant_reference.blank?
19
+
20
+ body = {
21
+ "account_number": account_number,
22
+ "narration": narration,
23
+ "merchant_reference": merchant_reference,
24
+ "amount": amount.to_i,
25
+ "api_key": api_key,
26
+ "payment_method": payment_method,
27
+ "provider": provider,
28
+ "currency": currency,
29
+ "account_name": account_name,
30
+ "account_email": account_email,
31
+ "redirect_url": redirect_url,
32
+ "callback_url": callback_url,
33
+ "extra_provider_detail": extra_provider_detail
34
+ }
35
+ path = '/transfer'
36
+
37
+ send_request('post', path, body)
38
+ { merchant_reference: merchant_reference }
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Error handling for unsuccessful responses from Paylense API
4
+
5
+ module Paylense
6
+ class Error < StandardError
7
+ def initialize(message, code)
8
+ @code = code
9
+ super("Error code #{code} #{message}")
10
+ end
11
+ end
12
+
13
+ class ValidationError < StandardError
14
+ def initialize(msg = message)
15
+ super(msg)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Validations for parameters passed into client methods
4
+
5
+ require 'paylense-sdk/errors'
6
+
7
+ module Paylense
8
+ class Validate
9
+ def validate(account_number, amount)
10
+ validate_string?(account_number, 'Phone number')
11
+ validate_numeric?(amount, 'Amount')
12
+ end
13
+
14
+ def validate_numeric?(num, field)
15
+ return true if num.is_a? Numeric
16
+
17
+ raise Paylense::ValidationError, "#{field} should be a number"
18
+ end
19
+
20
+ def validate_string?(str, field)
21
+ return true if str.is_a? String
22
+
23
+ raise Paylense::ValidationError, "#{field} should be a string"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Paylense
4
+ VERSION = '1.0.0'
5
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'paylense-sdk/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'paylense-sdk'
9
+ spec.version = Paylense::VERSION
10
+ spec.authors = ['Acellam Guy']
11
+ spec.email = ['acellam.guy@gmail.com']
12
+ spec.summary = 'Winopay Paylense gem'
13
+ spec.description = 'Winopay Paylense API Client for Ruby'
14
+ spec.license = 'MIT'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the
18
+ # RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0")
21
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = 'bin'
24
+ spec.executables = 'paylense-sdk'
25
+ spec.require_paths = ['lib']
26
+ spec.required_ruby_version = '>= 2.3'
27
+
28
+ spec.add_dependency 'faraday', '~> 1.0'
29
+ spec.add_development_dependency 'bundler', '1.17.3'
30
+ spec.add_development_dependency 'coveralls', '~> 0.8.15'
31
+ spec.add_development_dependency 'pry', '~> 0.12'
32
+ spec.add_development_dependency 'rake', '~> 13.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'vcr', '~> 5.1'
35
+ spec.add_development_dependency 'webmock', '~> 2.1'
36
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paylense-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Acellam Guy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-05-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.17.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.17.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.15
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.15
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.1'
125
+ description: Winopay Paylense API Client for Ruby
126
+ email:
127
+ - acellam.guy@gmail.com
128
+ executables:
129
+ - paylense-sdk
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".coveralls.yml"
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".rubocop.yml"
137
+ - ".travis.yml"
138
+ - CODE_OF_CONDUCT.md
139
+ - Gemfile
140
+ - LICENSE.txt
141
+ - README.md
142
+ - Rakefile
143
+ - bin/console
144
+ - bin/paylense-sdk
145
+ - bin/setup
146
+ - lib/paylense-sdk.rb
147
+ - lib/paylense-sdk/client.rb
148
+ - lib/paylense-sdk/collections.rb
149
+ - lib/paylense-sdk/config.rb
150
+ - lib/paylense-sdk/disbursements.rb
151
+ - lib/paylense-sdk/errors.rb
152
+ - lib/paylense-sdk/validate.rb
153
+ - lib/paylense-sdk/version.rb
154
+ - paylense-sdk.gemspec
155
+ homepage:
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '2.3'
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubygems_version: 3.0.9
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: Winopay Paylense gem
178
+ test_files: []