capital_one 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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.3.0
4
+ version: 0.4.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-20 00:00:00.000000000 Z
12
+ date: 2015-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -124,14 +124,16 @@ files:
124
124
  - lib/capital_one/branch.rb
125
125
  - lib/capital_one/customer.rb
126
126
  - lib/capital_one/deposit.rb
127
- - lib/capital_one/transaction.rb
127
+ - lib/capital_one/merchant.rb
128
+ - lib/capital_one/purchase.rb
129
+ - lib/capital_one/transfer.rb
128
130
  - lib/capital_one/version.rb
129
131
  - lib/capital_one/withdrawal.rb
130
132
  homepage: https://github.com/Shwheelz/capital_one
131
133
  licenses:
132
134
  - MIT
133
135
  metadata:
134
- allowed_push_host: https://rubygems.org
136
+ allowed_push_host: http://rubygems.org
135
137
  post_install_message:
136
138
  rdoc_options: []
137
139
  require_paths:
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  version: '0'
149
151
  requirements: []
150
152
  rubyforge_project:
151
- rubygems_version: 2.4.5
153
+ rubygems_version: 2.0.14
152
154
  signing_key:
153
155
  specification_version: 4
154
156
  summary: Connects to the Capital One API
@@ -1,103 +0,0 @@
1
- class Transaction
2
-
3
- def self.urlWithEntity
4
- return Config.baseUrl + "/accounts"
5
- end
6
-
7
- def self.url
8
- return Config.baseUrl
9
- end
10
-
11
- def self.apiKey
12
- return Config.apiKey
13
- end
14
-
15
-
16
- # *** GET ***
17
- #==getAllByAccountId
18
- #Get all transactions for a specific account where that account is the payer or payee
19
- #Returns an array of hashes.
20
- #Parameters: AccountID
21
- #Returns an array of hashes containing the transactions for that account where that account is the payer or payee.
22
- def self.getAllByAccountId(accID)
23
- url = "#{self.urlWithEntity}/#{accID}/transactions?key=#{self.apiKey}"
24
- resp = Net::HTTP.get_response(URI.parse(url))
25
- data = JSON.parse(resp.body)
26
- return data
27
- end
28
-
29
- # *** GET ***
30
- #==getAllByAccountIdPayer
31
- #Get all transactions for a specific account where that account is the payer
32
- #Returns an array of hashes.
33
- #Parameters: AccountID
34
- #Returns an array of hashes containing the transactions for that account where that account is the payer.
35
- def self.getAllByAccountIdPayer(accID)
36
- url = "#{self.urlWithEntity}/#{accID}/transactions?type=payer&key=#{self.apiKey}"
37
- resp = Net::HTTP.get_response(URI.parse(url))
38
- data = JSON.parse(resp.body)
39
- return data
40
- end
41
-
42
- # *** GET ***
43
- #==getAllByAccountIdPayee
44
- #Get all transactions for a specific account where that account is the payee
45
- #Returns an array of hashes.
46
- #Parameters: AccountID
47
- #Returns an array of hashes containing the transactions for that account where that account is the payee.
48
- def self.getAllByAccountIdPayee(accID)
49
- url = "#{self.urlWithEntity}/#{accID}/transactions?type=payee&key=#{self.apiKey}"
50
- resp = Net::HTTP.get_response(URI.parse(url))
51
- data = JSON.parse(resp.body)
52
- return data
53
- end
54
-
55
- #==getOneByAccountIdTransactionId
56
- # Get a specific transaction from a specific account.
57
- #Parameters: AccountID, TransactionId
58
- # Returns a hash with the specified transaction
59
-
60
- def self.getOneByAccountIdTransactionId(accID, tranID)
61
- url = "#{self.urlWithEntity}/#{accID}/transactions/#{tranID}?key=#{self.apiKey}"
62
- resp = Net::HTTP.get_response(URI.parse(url))
63
- data = JSON.parse(resp.body)
64
- end
65
-
66
-
67
- # *** POST ***
68
-
69
- # Create a new transaction between 2 accounts
70
- #==createTransaction
71
- #Creates a new transaction.
72
- #Parameters: toAccountId, hashWithTransacionData
73
- #Returns http response code.
74
- def self.createTransaction(toAcc, transaction)
75
- transactionToCreate = transaction.to_json
76
- url = "#{self.urlWithEntity}/#{toAcc}/transactions?key=#{self.apiKey}"
77
- uri = URI.parse(url)
78
- http = Net::HTTP.new(uri.host, uri.port)
79
- request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})
80
- request.body = transactionToCreate
81
- resp = http.request(request)
82
- data = JSON.parse(resp.body)
83
- end
84
-
85
-
86
- # *** DELETE ***
87
-
88
- #==deleteTransaction
89
- #Deletes a specified transaction from a specified account.
90
- #Parameters: AccountID, TransactionID
91
- #Returns http response code.
92
- #=Note:
93
- #This does not actually delete the transaction from the database, it only sets it's
94
- #status to 'cancelled'
95
- def self.deleteTransaction(accID, transID)
96
- url = "#{self.urlWithEntity}/#{accID}/transactions/#{transID}?key=#{self.apiKey}"
97
- uri = URI.parse(url)
98
- http = Net::HTTP.new(uri.host, uri.port)
99
- key="?key=#{self.apiKey}"
100
- request = Net::HTTP::Delete.new(uri.path+key)
101
- resp = http.request(request)
102
- end
103
- end