capital_one 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37266853addb740e2d6e646c3f97aad6e51d7d43
4
- data.tar.gz: ce2878b48b6a415b71071b810fdfc73c1b062c2c
3
+ metadata.gz: cbc2f9909981e3e6c28c5ffedaf019df1b8c8331
4
+ data.tar.gz: 3324bd1688e85d433110080cec4144850fa5ea6a
5
5
  SHA512:
6
- metadata.gz: 81a3b93e75eafa60d15067953c6254b13b81b944e17ff5a2f1bb765be72111428e1118971347fd03c9bf4515427f82b6a9762c5e63fa5d74a9b841c1e76a37c2
7
- data.tar.gz: eb62295f194a01999924776dc1d2e238af96e833f284815fe0ff8724601490e67fa0394006b523afaf1a468718425d548f8a7b4467e2e66ab9d9956b67ddf30e
6
+ metadata.gz: 4a19f6ee7e419509ae32fce8b96128585886fb257c4bc81f9a217400cc07efe9e66add806674a1e5a69aff3de3f94a28af3bbbf160d03d5182763c6642755a2b
7
+ data.tar.gz: c9d75359a81e350be15e5497d5dfda449330d0ab2f6f6d3c5eb8e540666759291a4401585401313032fa3f0baaa67e8872aa37fde8959f1947aa02ad5c0a4239
@@ -62,12 +62,13 @@ class Account
62
62
  #Parameters: AccountID, AccountHash
63
63
  #Returns the http response code.
64
64
  def self.updateAccount(accountId, account)
65
+ accountToUpdate = account.to_json
65
66
  url = "#{self.urlWithEntity}/#{accountId}?key=#{self.apiKey}"
66
67
  uri = URI.parse(url)
67
68
  http = Net::HTTP.new(uri.host, uri.port)
68
69
  key = "?key=#{self.apiKey}"
69
- request = Net::HTTP::Put.new(uri.path+key)
70
- request.set_form_data(account)
70
+ request = Net::HTTP::Put.new(uri.path+key, initheader = {'Content-Type' =>'application/json'})
71
+ request.body = accountToUpdate
71
72
  response = http.request(request)
72
73
  return JSON.parse(response.body)
73
74
  end
@@ -73,12 +73,13 @@ class Bill
73
73
  #Returns http response code.
74
74
 
75
75
  def self.updateBill(accountId, billId, bill)
76
+ billToUpdate = bill.to_json
76
77
  url = "#{self.accountBaseUrl}/#{accountId}/bills/#{billId}?key=#{self.apiKey}"
77
78
  uri = URI.parse(url)
78
79
  http = Net::HTTP.new(uri.host, uri.port)
79
80
  key = "?key=#{self.apiKey}"
80
- request = Net::HTTP::Put.new(uri.path+key)
81
- request.set_form_data(bill)
81
+ request = Net::HTTP::Put.new(uri.path+key, initheader = {'Content-Type' =>'application/json'})
82
+ request.body = billToUpdate
82
83
  response = http.request(request)
83
84
  return JSON.parse(response.body)
84
85
  end
@@ -64,12 +64,13 @@ class Customer
64
64
  # }
65
65
  #Returns http response code.
66
66
  def self.updateCustomer(custID, customer)
67
+ customerToUpdate = customer.to_json
67
68
  url = "#{self.urlWithEntity}/#{custID}?key=#{self.apiKey}"
68
69
  uri = URI.parse(url)
69
70
  http = Net::HTTP.new(uri.host, uri.port)
70
71
  key = "?key=#{self.apiKey}"
71
- request = Net::HTTP::Put.new(uri.path+key)
72
- request.set_form_data(customer)
72
+ request = Net::HTTP::Put.new(uri.path+key, initheader = {'Content-Type' =>'application/json'})
73
+ request.body = customerToUpdate
73
74
  response = http.request(request)
74
75
  return JSON.parse(response.body)
75
76
  end
@@ -45,12 +45,13 @@ class Deposit
45
45
  #Creates a new deposit.
46
46
  #Parameters: toAccountId, hashWithDepositData
47
47
  #Returns http response code.
48
- def self.createDeposit(toAcc, json)
48
+ def self.createDeposit(toAcc, deposit)
49
+ depositToCreate = deposit.to_json
49
50
  url = "#{self.urlWithEntity}/#{toAcc}/deposits?key=#{self.apiKey}"
50
51
  uri = URI.parse(url)
51
52
  http = Net::HTTP.new(uri.host, uri.port)
52
53
  request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
53
- request.body = json
54
+ request.body = depositToCreate
54
55
  resp = http.request(request)
55
56
  data = JSON.parse(resp.body)
56
57
  end
@@ -72,6 +73,5 @@ class Deposit
72
73
  key="?key=#{self.apiKey}"
73
74
  request = Net::HTTP::Delete.new(uri.path+key)
74
75
  resp = http.request(request)
75
- data = JSON.parse(resp.body)
76
76
  end
77
77
  end
@@ -71,12 +71,13 @@ class Transaction
71
71
  #Creates a new transaction.
72
72
  #Parameters: toAccountId, hashWithTransacionData
73
73
  #Returns http response code.
74
- def self.createTransaction(toAcc, json)
74
+ def self.createTransaction(toAcc, transaction)
75
+ transactionToCreate = transaction.to_json
75
76
  url = "#{self.urlWithEntity}/#{toAcc}/transactions?key=#{self.apiKey}"
76
77
  uri = URI.parse(url)
77
78
  http = Net::HTTP.new(uri.host, uri.port)
78
79
  request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
79
- request.body = json
80
+ request.body = transactionToCreate
80
81
  resp = http.request(request)
81
82
  data = JSON.parse(resp.body)
82
83
  end
@@ -45,12 +45,13 @@ class Withdrawal
45
45
  #Creates a new withdrawal.
46
46
  #Parameters: toAccountId, hashWithWithdrawalData
47
47
  #Returns http response code.
48
- def self.createWithdrawal(toAcc, json)
48
+ def self.createWithdrawal(toAcc, withdrawal)
49
+ withdrawalToCreate = withdrawal.to_json
49
50
  url = "#{self.urlWithEntity}/#{toAcc}/withdrawals?key=#{self.apiKey}"
50
51
  uri = URI.parse(url)
51
52
  http = Net::HTTP.new(uri.host, uri.port)
52
53
  request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
53
- request.body = json
54
+ request.body = withdrawalToCreate
54
55
  resp = http.request(request)
55
56
  data = JSON.parse(resp.body)
56
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capital_one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Besong
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-05-15 00:00:00.000000000 Z
12
+ date: 2015-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler