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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e632fdd6a8305a3df1ea490cb1268d7096d2942
4
- data.tar.gz: 76a5319a7c8fba7d04340e6de7f02339f8320f98
3
+ metadata.gz: aa367255403286e6a08a8618b6dacb32ef4f0061
4
+ data.tar.gz: 6565cb07aa4629af082a1d435c1034611ed69e2c
5
5
  SHA512:
6
- metadata.gz: 8eb379908ac8591a3f2d2247b7874a09845aeaa331caa45faaad43a1bc78ef56e6a8c91b1b9801d61699346c95bc1487ea74b1847ac0b5b4563df7aca3bd757b
7
- data.tar.gz: 731148b2c8939ae47e74f9b20bbbd97d7a2a7c466068527650f5a6e4bd3e73e81afe737adcc5150f0bd4eac517f7f16f8d00d4287f5256fe0e970cd452941d29
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
- #<Mondo::Transaction -4GBP EXPRESS OFF LICENSE LONDON GBR tx_00008zxnkK6vh3rvN38W6z>,
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: 3, since: "2015-08-10T23:00:00Z")
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
@@ -8,5 +8,6 @@ module Mondo
8
8
  def address
9
9
  ::Mondo::Address.new(raw_data['address'], self.client)
10
10
  end
11
+
11
12
  end
12
13
  end
@@ -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|
@@ -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
- if raw_data['merchant'].kind_of?(Hash)
32
- ::Mondo::Merchant.new(raw_data['merchant'], client)
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
@@ -1,3 +1,3 @@
1
1
  module Mondo
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Blomfield