Skip to content

Commit

Permalink
Merge branch 'release/0.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
kgathi2 committed May 25, 2015
2 parents 7d10b41 + 05a879a commit 761b3ec
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ Project maintainers have the right and responsibility to remove, edit, or reject
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)

## NOTES
http://www.smashingmagazine.com/2014/04/08/how-to-build-a-ruby-gem-with-bundler-test-driven-development-travis-ci-and-coveralls-oh-my/

http://blakewilliams.me/blog/developing-gems-with-tdd-and-minitest-pt-1

17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# Mpayer

[![Build Status](https://travis-ci.org/kgathi2/mpayer_ruby.svg)](https://travis-ci.org/kgathi2/mpayer_ruby)
[![Build Status](https://travis-ci.org/kgathi2/mpayer_ruby.svg)](https://travis-ci.org/kgathi2/mpayer_ruby) [![Gem Version](https://badge.fury.io/rb/mpayer_ruby.svg)](http://badge.fury.io/rb/mpayer_ruby) [![Coverage Status](https://coveralls.io/repos/kgathi2/mpayer_ruby/badge.svg)](https://coveralls.io/r/kgathi2/mpayer_ruby)

[![Gem Version](https://badge.fury.io/rb/sinderella.png)](http://badge.fury.io/rb/mpayer_ruby)

[![Coverage Status](https://coveralls.io/repos/kgathi2/mpayer_ruby/badge.svg)](https://coveralls.io/r/kgathi2/mpayer_ruby)

http://www.smashingmagazine.com/2014/04/08/how-to-build-a-ruby-gem-with-bundler-test-driven-development-travis-ci-and-coveralls-oh-my/

http://blakewilliams.me/blog/developing-gems-with-tdd-and-minitest-pt-1

Mpayer Ruby is a gem that makes it easy to integrate to [Mpayer payment gateway](http://mpayer.co.ke). It allows for railsesque way of interacting with Mpayer objects.
A ruby client that makes it easy to integrate to [Mpayer payment gateway](http://mpayer.co.ke). It allows for railsesque way of interacting with Mpayer objects. Is compatible currently with Mpayer version 1

## Installation

Add this line to your application's Gemfile:

gem requires `ruby ~>2.0`

```ruby
gem 'mpayer_ruby'
```
Expand Down Expand Up @@ -74,8 +68,11 @@ clients = Mpayer::Client.find(123, fetch:false)
Mpayer gem currently supports a few endpoint below

https://app.mpayer.co.ke/api/client

https://app.mpayer.co.ke/api/accounts

https://app.mpayer.co.ke/api/transactions

https://app.mpayer.co.ke/api/payables

All responses are objects and can be accessed with dot notation
Expand Down
2 changes: 1 addition & 1 deletion lib/mpayer/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Mpayer
VERSION = "0.0.1"
VERSION = "0.0.07"
end
3 changes: 2 additions & 1 deletion mpayer_ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.authors = ["Kariuki Gathitu"]
spec.email = ["kgathi2@gmail.com"]

spec.summary = %q{Ruby client for interfacing with http://app.mpayer.co.ke .}
spec.summary = %q{Ruby client for interfacing with http://app.mpayer.co.ke/api }
spec.description = %q{Interfaces with Mpayer payment gateway api }
spec.homepage = "https://github.com/kgathi2/mpayer_ruby"
spec.license = "MIT"
Expand All @@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = '~> 2.0'

spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
Expand Down
1 change: 0 additions & 1 deletion test/mpayer/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def test_initializer
end

def test_client_local_vs_global_configs
# skip
Mpayer.setup do |config|
config.user_no = 'GLOBAL_USER'
config.token = 'GLOBAL_TOKEN'
Expand Down
10 changes: 5 additions & 5 deletions test/mpayer/endpoints/account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def setup
end

def test_account_find_and_all
skip
# skip
accounts = Mpayer::Account.all
assert(accounts.is_a? Array)
account_one = accounts.first
Expand All @@ -16,15 +16,15 @@ def test_account_find_and_all
end

def test_update_account
skip
# skip
account = Mpayer::Account.find(25735)
new_name = account.name.next
account.update(name:new_name)
assert_equal(new_name, account.name)
end

def test_account_aggregates
skip
# skip
options = {
from_date: Time.now - (86400*365),
to_date:nil,
Expand All @@ -37,13 +37,13 @@ def test_account_aggregates
end

def test_get_client_members
skip
# skip
members = Mpayer::Account.find(25735, fetch:false).members
assert(members.is_a?(Array), "Failure message.")
end

def test_get_client_payable_items
skip
# skip
payable_items = Mpayer::Account.find(25735, fetch:false).payable_items
assert(payable_items.is_a?(Array), "Failure message.")
end
Expand Down
10 changes: 5 additions & 5 deletions test/mpayer/endpoints/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def setup
end

def test_client_find_and_all
skip
# skip
clients = Mpayer::Client.all
assert(clients.is_a? Array)
client_one = clients.first
Expand Down Expand Up @@ -37,7 +37,7 @@ def test_create_client
end

def test_get_client_account
skip
# skip
client = Mpayer::Client.find(26, fetch:false)
accounts = client.accounts(per:1,per_page:100)
account = client.account(accounts.first.id)
Expand All @@ -64,19 +64,19 @@ def test_create_new_account
end

def test_get_client_accounts
skip
# skip
accounts = Mpayer::Client.find(26, fetch:false).accounts
assert(accounts.is_a?(Array), "Failure message.")
end

def test_get_client_payables
skip
# skip
accounts = Mpayer::Client.find(26, fetch:false).payables
assert(accounts.is_a?(Array), "Failure message.")
end

def test_get_client_account_transactions
skip
# skip
account_id = 87 # account = client.accounts.last.id
transactions = Mpayer::Client.find(26, fetch:false).transactions(account_id)
assert(transactions.is_a?(Array), "Failure message.")
Expand Down
14 changes: 6 additions & 8 deletions test/mpayer/endpoints/payable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def setup
end

def test_payable_find_and_all
skip
# skip
payables = Mpayer::Payable.all
assert(payables.is_a? Array)
payable_one = payables.first
Expand All @@ -16,17 +16,16 @@ def test_payable_find_and_all
end

def test_search_payable
skip
# skip
payable = Mpayer::Payable.where(ref_id:"KT0041-010000411")
refute_nil(payable, "Failure message.")
assert(payable.is_a?(Mpayer::Payable), "Failure message.")
payable = Mpayer::Payable.where(ref_id:"Ksdfsfsdf000411")
assert_nil(payable, "Failure message.")
assert(payable.is_a?(Mpayer::Payable), "Failure message.")
end

def test_create_payable
skip
def test_create_and_destroy_payable
# skip
payable_items = []
[*0..5].each do |n|
payable_items << {
Expand Down Expand Up @@ -57,12 +56,11 @@ def test_create_payable
}
payable = Mpayer::Payable.create(options)
refute_nil(payable.id, "Failure message.")
end

def test_delete_payable
skip
payable = Mpayer::Payable.find(8818,fetch:false)
payable.destroy
assert_equal(payable.id, nil)
assert_equal(payable.attributes, nil)
end

end
12 changes: 6 additions & 6 deletions test/mpayer/endpoints/transaction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ def setup
end

def test_get_all_transactions
skip
# skip
transactions = Mpayer::Transaction.all(from: Time.now - (86400*400))
assert(transactions.is_a?(Array), "Failure message.")
end

def test_search_transactions
skip
# skip
transaction = Mpayer::Transaction.where(ref_id:"KT0041[P]-010000402")
refute_nil(transaction, "Failure message.")
assert(transaction.is_a?(Mpayer::Transaction), "Failure message.")
end

def test_deposit
skip
# skip
body = {particulars:"particulars",amount:1000, cr_party: "pz_test"}
body.merge!({ref_num:'254720215569'})
# body.merge!({ref_num:''})
deposit = Mpayer::Transaction.deposit(body)
assert(deposit.is_a?(Mpayer::Transaction), "Failure message.")
refute_nil(deposit.id, "Failure message.")
end

def test_withdraw
skip
# skip
body = {particulars:"particulars",amount:10, dr_party: "pz_test"}
withdrawal = Mpayer::Transaction.withdraw(body)
assert(withdrawal.is_a?(Mpayer::Transaction), "Failure message.")
refute_nil(withdrawal.id, "Failure message.")
end

def test_transfer
skip
# skip
body = {particulars:"particulars",amount:10, cr_party: "pz_test2", dr_party:"pz_test" }
transfer = Mpayer::Transaction.transfer(body)
assert(transfer.is_a?(Mpayer::Transaction), "Failure message.")
Expand Down
2 changes: 1 addition & 1 deletion test/mpayer/fetch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestMpayerFetch < Minitest::Test
def test_unauthorised
skip
# skip
Mpayer.setup do |config|
config.user_no = 'GLOBAL_USER'
config.token = 'GLOBAL_TOKEN'
Expand Down

0 comments on commit 761b3ec

Please sign in to comment.