mondo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -23
- data/lib/mondo/merchant.rb +1 -0
- data/lib/mondo/resource.rb +8 -1
- data/lib/mondo/transaction.rb +4 -12
- data/lib/mondo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa367255403286e6a08a8618b6dacb32ef4f0061
|
4
|
+
data.tar.gz: 6565cb07aa4629af082a1d435c1034611ed69e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d92c08341d38b0641b3d32f886f9237dd823889752410b665b7de62ac6d68dc21e993b49d0285feca7a15f2e1b0c211d76f96a843e27389d5a7070e3d5febb
|
7
|
+
data.tar.gz: 816df40624d8911aaca5f23a02ceb2ba62435bb9a5b296ad0af6374190c0df7dc7a53e7843a159a1df01f11cc541e6ac7bcb095e0e04ed46eb9b63349ea7f0b4
|
data/README.md
CHANGED
@@ -37,39 +37,24 @@ mondo.transactions
|
|
37
37
|
#<Mondo::Transaction -31GBP OZONE COFFEE ROASTERS UNITED KINGDO GBR tx_00008zrYsmW9IVgPz3bUiv>,
|
38
38
|
#<Mondo::Transaction -26GBP LAN TANA LONDON GBR tx_00008zru1CYoS6lW6nhpeD>,
|
39
39
|
#<Mondo::Transaction -5GBP PRET A MANGER LONDON GBR tx_00008zvemPnUEdNo8attNB>,
|
40
|
-
|
41
|
-
#<Mondo::Transaction -13GBP LOWER EAST SIDE DELI LONDON EC2A GBR tx_00008zy3PP7LTxxiXVEXAn>,
|
42
|
-
#<Mondo::Transaction -6GBP OZONE COFFEE ROASTERS LONDON GBR tx_00008zy8VxynHJGWOqY3aD>,
|
43
|
-
#<Mondo::Transaction -28GBP FGW SELF SERVICE PADDINGTON GBR tx_00008zyGtoILjhPUwlZli5>,
|
44
|
-
#<Mondo::Transaction -6GBP EXPRESS OFF LICENSE LONDON GBR tx_00008zzwuRFvGsQCml15Kj>
|
40
|
+
etc...
|
45
41
|
]
|
46
42
|
|
47
|
-
mondo.transactions(expand: :merchant, limit:
|
43
|
+
mondo.transactions(expand: [:merchant], limit: 2, since: "2015-08-10T23:00:00Z")
|
48
44
|
=> [
|
49
45
|
#<Mondo::Transaction -6GBP OZONE COFFEE ROASTERS LONDON GBR tx_00008zy8VxynHJGWOqY3aD>,
|
50
46
|
#<Mondo::Transaction -28GBP FGW SELF SERVICE PADDINGTON GBR tx_00008zyGtoILjhPUwlZli5>,
|
51
|
-
#<Mondo::Transaction -6GBP EXPRESS OFF LICENSE LONDON GBR tx_00008zzwuRFvGsQCml15Kj>
|
52
47
|
]
|
53
48
|
|
49
|
+
# Fetch a single transaction
|
50
|
+
mondo.transaction(tx_00008zvemPnUEdNo8attNB)
|
51
|
+
=> #<Mondo::Transaction -5GBP PRET A MANGER LONDON GBR tx_00008zvemPnUEdNo8attNB>
|
52
|
+
|
53
|
+
|
54
54
|
# TODO - make a Merchant object
|
55
55
|
mondo.transactions.last.merchant
|
56
56
|
=>
|
57
|
-
{
|
58
|
-
"id"=>"merch_00008z40hJLCkWMs15lQDx",
|
59
|
-
"group_id"=>"grp_00008yEdbBXWcsqVNdftbd",
|
60
|
-
"created"=>"2015-08-15T11:07:04Z",
|
61
|
-
"name"=>"East Midlands Trains",
|
62
|
-
"logo"=>"https://pbs.twimg.com/profile_images/532472643694235648/vxJSda4F_400x400.png",
|
63
|
-
"address"=>{
|
64
|
-
"address"=>"St Pancras Station",
|
65
|
-
"city"=>"London",
|
66
|
-
"region"=>"",
|
67
|
-
"country"=>"GBR",
|
68
|
-
"postcode"=>"NW1 2QP",
|
69
|
-
"latitude"=>51.531427,
|
70
|
-
"longitude"=>-0.126133
|
71
|
-
}
|
72
|
-
}
|
57
|
+
#<Mondo::Merchant merch_000090ER75UzBxejYTIb4r {"id"=>"merch_000090ER75UzBxejYTIb4r", "group_id"=>"grp_00008yEdfHhvbwnQcsYryL", "created"=>"2015-09-19T09:42:16Z", "name"=>"Department Of Coffee And Social Affairs", "logo"=>"http://avatars.io/twitter/deptofcoffee/?size=large", "address"=>{"address"=>"14-16 Leather Ln", "city"=>"London", "region"=>"Greater London", "country"=>"GB", "postcode"=>"EC1N 7SU", "latitude"=>51.519348553897686, "longitude"=>-0.1090317964553833}}>
|
73
58
|
```
|
74
59
|
|
75
60
|
## Update Transaction Tags
|
data/lib/mondo/merchant.rb
CHANGED
data/lib/mondo/resource.rb
CHANGED
@@ -3,7 +3,6 @@ module Mondo
|
|
3
3
|
|
4
4
|
attr_accessor :client, :raw_data
|
5
5
|
|
6
|
-
|
7
6
|
def initialize(hash={}, client)
|
8
7
|
self.raw_data = hash
|
9
8
|
self.client = client
|
@@ -11,6 +10,14 @@ module Mondo
|
|
11
10
|
self.to_s
|
12
11
|
end
|
13
12
|
|
13
|
+
def to_s
|
14
|
+
"#<#{self.class} #{raw_data}>"
|
15
|
+
end
|
16
|
+
|
17
|
+
def inspect
|
18
|
+
self.to_s
|
19
|
+
end
|
20
|
+
|
14
21
|
class << self
|
15
22
|
def date_writer(*args)
|
16
23
|
args.each do |attr|
|
data/lib/mondo/transaction.rb
CHANGED
@@ -10,14 +10,6 @@ module Mondo
|
|
10
10
|
|
11
11
|
date_accessor :created
|
12
12
|
|
13
|
-
def to_s
|
14
|
-
"#<#{self.class} #{self.amount_with_currency} #{self.description} #{id}>"
|
15
|
-
end
|
16
|
-
|
17
|
-
def inspect
|
18
|
-
self.to_s
|
19
|
-
end
|
20
|
-
|
21
13
|
# TODO - proper currency library
|
22
14
|
def amount_with_currency
|
23
15
|
"#{amount/100}#{currency}"
|
@@ -28,12 +20,12 @@ module Mondo
|
|
28
20
|
end
|
29
21
|
|
30
22
|
def merchant(opts={})
|
31
|
-
|
32
|
-
|
33
|
-
else
|
23
|
+
unless raw_data['merchant'].kind_of?(Hash)
|
24
|
+
# Go and refetch the transaction with merchant info expanded
|
34
25
|
self.raw_data['merchant'] = self.client.transaction(self.id, expand: [:merchant]).raw_data['merchant']
|
35
|
-
merchant(opts)
|
36
26
|
end
|
27
|
+
|
28
|
+
::Mondo::Merchant.new(raw_data['merchant'], client)
|
37
29
|
end
|
38
30
|
|
39
31
|
def tags
|
data/lib/mondo/version.rb
CHANGED