mxit_api 0.2.1.pre → 0.2.2.pre

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.
@@ -2,7 +2,7 @@ class MxitApi
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 1
5
+ PATCH = 2
6
6
  BUILD = 'pre'
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -1,5 +1,6 @@
1
1
  class MxitMoneyApi
2
2
 
3
+ BASE_URL = "https://api.mxitmoney.co.za"
3
4
  attr_reader :api_key, :balance
4
5
 
5
6
  def initialize(api_key)
@@ -14,7 +15,7 @@ class MxitMoneyApi
14
15
 
15
16
  def balance
16
17
  return @balance unless @balance.nil?
17
- url = URI.parse('https://m2api.fireid.com/paymentsplatform/rest/v3/push/')
18
+ url = URI.parse("#{BASE_URL}/paymentsplatform/rest/v3/push/")
18
19
  req = Net::HTTP::Get.new(url.path, 'Accept'=>'application/json')
19
20
  req.basic_auth(api_key,"mxit_money_api")
20
21
  response = Net::HTTP.start(url.host, url.port,
@@ -2,7 +2,7 @@ class MxitMoneyApi
2
2
 
3
3
  def issue_money(params)
4
4
  params = Hash[params.map {|k, v| [k.to_s.camelize(:lower), v] }]
5
- url = URI.parse("https://m2api.fireid.com/paymentsplatform/rest/v3/push/issue/#{params.delete('phoneNumber')}?#{params.to_query}")
5
+ url = URI.parse("#{BASE_URL}/paymentsplatform/rest/v3/push/issue/#{params.delete('phoneNumber')}?#{params.to_query}")
6
6
  req = Net::HTTP::Post.new(url.to_s,
7
7
  'Accept'=>'application/json',
8
8
  'Content-Type' =>'application/json')
@@ -2,7 +2,7 @@ class MxitMoneyApi
2
2
 
3
3
  def user_info(params)
4
4
  params.symbolize_keys!
5
- url = URI.parse("https://m2api.fireid.com/paymentsplatform/rest/v3/user/#{params[:id]}?idType=#{(params[:id_type] || 'mxit_id').to_s.camelize(:lower)}")
5
+ url = URI.parse("#{BASE_URL}/paymentsplatform/rest/v3/user/#{params[:id]}?idType=#{(params[:id_type] || 'mxit_id').to_s.camelize(:lower)}")
6
6
  req = Net::HTTP::Get.new(url.to_s, 'Accept'=>'application/json')
7
7
  req.basic_auth(api_key,"mxit_money_api".to_s)
8
8
  http = Net::HTTP.new(url.host, url.port)
data/mxit_api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "mxit_api"
8
- s.version = "0.2.1.pre"
8
+ s.version = "0.2.2.pre"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Grant Speelman"]
12
- s.date = "2013-01-18"
12
+ s.date = "2013-03-07"
13
13
  s.description = "gem to use the Mxit APIs at http://dev.mxit.com/docs/ "
14
14
  s.email = "grant.speelman@unboxedconsulting.com"
15
15
  s.extra_rdoc_files = [
@@ -6,14 +6,14 @@ describe MxitMoneyApi do
6
6
  token_body = %&{
7
7
  "balance": 5000
8
8
  }&
9
- stub_request(:get, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/push/").to_return(:status => 200, :body => token_body, :headers => {})
9
+ stub_request(:get, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/push/").to_return(:status => 200, :body => token_body, :headers => {})
10
10
  end
11
11
 
12
12
  context "new" do
13
13
 
14
14
  it "must post to mxit api requesting token" do
15
15
  MxitMoneyApi.new("3")
16
- assert_requested(:get, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/push/",
16
+ assert_requested(:get, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/push/",
17
17
  :headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby'})
18
18
  end
19
19
 
@@ -52,7 +52,7 @@ describe MxitMoneyApi do
52
52
  end
53
53
 
54
54
  it "must return a hash for search by mxitId" do
55
- stub_request(:get, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/user/m40000000000?idType=mxitId").
55
+ stub_request(:get, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/user/m40000000000?idType=mxitId").
56
56
  with(:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby'}).
57
57
  to_return(:status => 200, :body => @body, :headers => {})
58
58
  profile = @connection.user_info(:id => 'm40000000000')
@@ -64,7 +64,7 @@ describe MxitMoneyApi do
64
64
  end
65
65
 
66
66
  it "must return a hash for search by phoneNumber" do
67
- stub_request(:get, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/user/0712345678?idType=phoneNumber").
67
+ stub_request(:get, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/user/0712345678?idType=phoneNumber").
68
68
  with(:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby'}).
69
69
  to_return(:status => 200, :body => @body, :headers => {})
70
70
  profile = @connection.user_info(:id => '0712345678', :id_type => :phone_number)
@@ -80,7 +80,7 @@ describe MxitMoneyApi do
80
80
  "errorType": "INVALID_MSISDN",
81
81
  "message": "The phone number is incorrect."
82
82
  }&
83
- stub_request(:get, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/user/m40000000001?idType=mxitId").
83
+ stub_request(:get, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/user/m40000000001?idType=mxitId").
84
84
  with(:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby'}).
85
85
  to_return(:status => 500, :body => body, :headers => {})
86
86
  profile = @connection.user_info(:id => 'm40000000001')
@@ -95,7 +95,7 @@ describe MxitMoneyApi do
95
95
  @body = %&{
96
96
  "m2_reference": "886e797d-ff9b-4743-a6a6-908bf588b2f8"
97
97
  }&
98
- stub_request(:post, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/push/issue/0761234567?amountInCents=123&merchantReference=000000001").
98
+ stub_request(:post, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/push/issue/0761234567?amountInCents=123&merchantReference=000000001").
99
99
  to_return(:status => 200, :body => @body, :headers => {})
100
100
  @connection = MxitMoneyApi.new("3")
101
101
  end
@@ -104,7 +104,7 @@ describe MxitMoneyApi do
104
104
  @connection.issue_money(:phone_number => "0761234567",
105
105
  :merchant_reference => "000000001",
106
106
  :amount_in_cents => "123")
107
- assert_requested(:post, "https://3:mxit_money_api@m2api.fireid.com/paymentsplatform/rest/v3/push/issue/0761234567?amountInCents=123&merchantReference=000000001",
107
+ assert_requested(:post, "https://3:mxit_money_api@api.mxitmoney.co.za/paymentsplatform/rest/v3/push/issue/0761234567?amountInCents=123&merchantReference=000000001",
108
108
  :headers => {'Accept'=>'application/json',
109
109
  'User-Agent'=>'Ruby',
110
110
  'Content-Type' =>'application/json'})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mxit_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre
4
+ version: 0.2.2.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  segments:
233
233
  - 0
234
- hash: -4321529454908252784
234
+ hash: 3521331508407363701
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  none: false
237
237
  requirements: