mondo 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/mondo/address.rb +6 -0
- data/lib/mondo/client.rb +9 -1
- data/lib/mondo/merchant.rb +12 -0
- data/lib/mondo/transaction.rb +10 -2
- data/lib/mondo/version.rb +1 -1
- data/lib/mondo.rb +3 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e632fdd6a8305a3df1ea490cb1268d7096d2942
|
4
|
+
data.tar.gz: 76a5319a7c8fba7d04340e6de7f02339f8320f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eb379908ac8591a3f2d2247b7874a09845aeaa331caa45faaad43a1bc78ef56e6a8c91b1b9801d61699346c95bc1487ea74b1847ac0b5b4563df7aca3bd757b
|
7
|
+
data.tar.gz: 731148b2c8939ae47e74f9b20bbbd97d7a2a7c466068527650f5a6e4bd3e73e81afe737adcc5150f0bd4eac517f7f16f8d00d4287f5256fe0e970cd452941d29
|
data/CHANGELOG.md
CHANGED
data/lib/mondo/client.rb
CHANGED
@@ -85,7 +85,7 @@ module Mondo
|
|
85
85
|
request(method, path, opts)
|
86
86
|
end
|
87
87
|
|
88
|
-
# @method
|
88
|
+
# @method transactions
|
89
89
|
# @return [Transactions] all transactions for this user
|
90
90
|
def transactions(opts = {})
|
91
91
|
raise ClientError.new("You must provide an account id to query transactions") unless self.account_id
|
@@ -95,6 +95,14 @@ module Mondo
|
|
95
95
|
resp.parsed["transactions"].map { |tx| Transaction.new(tx, self) }
|
96
96
|
end
|
97
97
|
|
98
|
+
# @method transaction
|
99
|
+
# @return <Transaction> of the transaction information
|
100
|
+
def transaction(transaction_id, opts = {})
|
101
|
+
resp = api_get("/transactions/#{transaction_id}", opts)
|
102
|
+
return resp unless resp.error.nil?
|
103
|
+
Transaction.new(resp.parsed['transaction'], self)
|
104
|
+
end
|
105
|
+
|
98
106
|
def create_feed_item(params)
|
99
107
|
FeedItem.new(params, self).save
|
100
108
|
end
|
data/lib/mondo/transaction.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
module Mondo
|
2
2
|
class Transaction < Resource
|
3
3
|
|
4
|
-
attr_accessor :id,
|
4
|
+
attr_accessor :id,
|
5
5
|
:description,
|
6
6
|
:amount,
|
7
7
|
:currency,
|
8
|
-
:merchant,
|
9
8
|
:notes,
|
10
9
|
:metadata
|
11
10
|
|
@@ -28,6 +27,15 @@ module Mondo
|
|
28
27
|
self.client.api_patch("/transactions/#{self.id}", metadata: self.metadata)
|
29
28
|
end
|
30
29
|
|
30
|
+
def merchant(opts={})
|
31
|
+
if raw_data['merchant'].kind_of?(Hash)
|
32
|
+
::Mondo::Merchant.new(raw_data['merchant'], client)
|
33
|
+
else
|
34
|
+
self.raw_data['merchant'] = self.client.transaction(self.id, expand: [:merchant]).raw_data['merchant']
|
35
|
+
merchant(opts)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
31
39
|
def tags
|
32
40
|
metadata["tags"]
|
33
41
|
end
|
data/lib/mondo/version.rb
CHANGED
data/lib/mondo.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Mondo
|
2
|
-
|
3
2
|
require 'mondo/client'
|
4
3
|
require 'mondo/version'
|
5
4
|
|
@@ -11,4 +10,7 @@ module Mondo
|
|
11
10
|
require 'mondo/transaction'
|
12
11
|
require 'mondo/feed_item'
|
13
12
|
|
13
|
+
require 'mondo/address'
|
14
|
+
require 'mondo/transaction'
|
15
|
+
require 'mondo/merchant'
|
14
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mondo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Blomfield
|
@@ -111,9 +111,11 @@ files:
|
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|
113
113
|
- lib/mondo.rb
|
114
|
+
- lib/mondo/address.rb
|
114
115
|
- lib/mondo/client.rb
|
115
116
|
- lib/mondo/errors.rb
|
116
117
|
- lib/mondo/feed_item.rb
|
118
|
+
- lib/mondo/merchant.rb
|
117
119
|
- lib/mondo/resource.rb
|
118
120
|
- lib/mondo/response.rb
|
119
121
|
- lib/mondo/transaction.rb
|