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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c71119ea0e7317e34acc4ad8706fbedd08042e78
4
- data.tar.gz: 144a39673e41b1a17904210b24af879069d8aef8
3
+ metadata.gz: 1e632fdd6a8305a3df1ea490cb1268d7096d2942
4
+ data.tar.gz: 76a5319a7c8fba7d04340e6de7f02339f8320f98
5
5
  SHA512:
6
- metadata.gz: 5f1ed37b2026761c907f6609e367cb0cce8647780410abd8f058682aa52998a05c17ff2c977f0e54e7afeea88a578104e1f860df396931fbe2dc46ae62b5fa13
7
- data.tar.gz: 9f27014ed8548da91e46cc25038079e0d5dfa33067c3a34d8c95b184ca2194813479c67764ac531a911035ff2e8533d85d41a2711b38015633411edc8900ef91
6
+ metadata.gz: 8eb379908ac8591a3f2d2247b7874a09845aeaa331caa45faaad43a1bc78ef56e6a8c91b1b9801d61699346c95bc1487ea74b1847ac0b5b4563df7aca3bd757b
7
+ data.tar.gz: 731148b2c8939ae47e74f9b20bbbd97d7a2a7c466068527650f5a6e4bd3e73e81afe737adcc5150f0bd4eac517f7f16f8d00d4287f5256fe0e970cd452941d29
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.3.0 - September 19, 2015
2
+
3
+ - Added support for Merchant and Address
4
+
5
+
1
6
  ## 0.2.0 - September 19, 2015
2
7
 
3
8
  - Added support for FeedItems
@@ -0,0 +1,6 @@
1
+ module Mondo
2
+ class Address < Resource
3
+ attr_accessor :address, :city, :region, :country, :postcode, :latitude,
4
+ :longitude, :raw_data
5
+ end
6
+ end
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 transaction
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
@@ -0,0 +1,12 @@
1
+ module Mondo
2
+ class Merchant < Resource
3
+
4
+ attr_accessor :id, :group_id, :logo, :name, :raw_data, :address
5
+
6
+ date_accessor :created
7
+
8
+ def address
9
+ ::Mondo::Address.new(raw_data['address'], self.client)
10
+ end
11
+ end
12
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Mondo
2
- VERSION = '0.2.4'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
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.2.4
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