myob-api 0.7.1 → 0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cda26bcb6e112f93c6c09d12d440fc18c5c9f09e
4
- data.tar.gz: 0fac8887d4ffc6cbc1d9abfd406c6f7eeb320c31
3
+ metadata.gz: fd7d16454a5dd331bfb7ead95ff73e6bca504987
4
+ data.tar.gz: 354d7ee0fdfa37a0d467afb72742f50982a1e725
5
5
  SHA512:
6
- metadata.gz: 10bb4f5ea9a7d69121bb4f4d491d8b5bfeaec85260209c5fa6cf753f85b516a71f561018c4261436610c449ae47feffa1eb2aaa1fb4bc8a118c9fcd29206513c
7
- data.tar.gz: f0581a3a3f9797783ba5dc2b7a69e4dbe6f0b089fffd16cf75ba11bf031c43247600a67934cbe9410387263d99948fb2a7c2314ba3250e998c8dd4d7d76c3580
6
+ metadata.gz: f509295319d486f9d2a13f726e575d7500af66cafa96a8d4b0d33d4a5f2f27d2bec0551871cbc42ec20aece085ccd68fdca279a03d8eb185e7ec107f883f1107
7
+ data.tar.gz: 77e5b218728121d9e7bc75651152746ecaa4b08828af61b1f1453ba273719a25d4385cda1d7730e629c608505fcb1d77d448e588187fb295a9839b72b1306506
data/README.md CHANGED
@@ -36,7 +36,7 @@ The MYOB API uses 3 legged OAuth2. If you don't want to roll your own, or use th
36
36
  end
37
37
 
38
38
  def myob_client
39
- @api_client = Myob::Api::Client.new({
39
+ @myob_client ||= Myob::Api::Client.new({
40
40
  :consumer => {
41
41
  :key => YOUR_CONSUMER_KEY,
42
42
  :secret => YOUR_CONSUMER_SECRET,
@@ -160,7 +160,7 @@ To create a new entity, call #save on its model, passing through a hash that rep
160
160
  #### Updating an entity
161
161
 
162
162
  To update an existing entity, call #save on its model, passing through a hash you got from the API. This hash should include a `UID` parameter (which is included by default when you get the data).
163
-
163
+
164
164
  user = api_client.employee.all["Items"].last
165
165
  user['FirstName'] = 'New First Name'
166
166
  api_client.employee.save(user)
@@ -49,11 +49,13 @@ module Myob
49
49
  end
50
50
 
51
51
  def select_company_file(company_file)
52
- company_file_id = self.company_file.first('Name' => company_file[:name])['Id']
53
- @current_company_file = {
54
- :id => company_file_id,
55
- :token => company_file[:token] || Base64.encode64("#{company_file[:username]}:#{company_file[:password]}"),
56
- }
52
+ company_file_id = (self.company_file.all.find {|file| file['Name'] == company_file[:name]} || [])['Id']
53
+ if company_file_id
54
+ @current_company_file = {
55
+ :id => company_file_id,
56
+ :token => company_file[:token] || Base64.encode64("#{company_file[:username]}:#{company_file[:password]}"),
57
+ }
58
+ end
57
59
  end
58
60
 
59
61
  def connection
@@ -1,5 +1,5 @@
1
1
  module Myob
2
2
  module Api
3
- VERSION = "0.7.1"
3
+ VERSION = "0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myob-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lumley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2