myob-api 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myob/api/client.rb +22 -7
- data/lib/myob/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811d5f79a8b26836ec00106c574f869b682521b6
|
4
|
+
data.tar.gz: d662c42c636b9558fcecb5230f7e1a4bcabdae35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07626d4621630fa176b4d10a63fe008ca3aeb2ab0a195d3ed0b238e4a1d73f4bd5e230b4eaf263cd0e2ef84193ef29e6f52eaa09a0c3b6691df6db6f619c2f2a
|
7
|
+
data.tar.gz: bc89612b051e0c05cf64302fce29cacbcbcc6a536a7d70bb07a20c798c9a32b0ec28051e84a6ab8529046454f557d4729beac5b5b6997cffe6418795ed1c5742
|
data/lib/myob/api/client.rb
CHANGED
@@ -40,20 +40,35 @@ module Myob
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def headers
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
token = @current_company_file[:token]
|
44
|
+
if token.nil? || token == ''
|
45
|
+
# if token is blank assume we are using federated login - http://myobapi.tumblr.com/post/109848079164/2015-1-release-notes
|
46
|
+
{
|
47
|
+
'x-myobapi-key' => @consumer[:key],
|
48
|
+
'x-myobapi-version' => 'v2',
|
49
|
+
'Content-Type' => 'application/json'
|
50
|
+
}
|
51
|
+
else
|
52
|
+
{
|
53
|
+
'x-myobapi-key' => @consumer[:key],
|
54
|
+
'x-myobapi-version' => 'v2',
|
55
|
+
'x-myobapi-cftoken' => token,
|
56
|
+
'Content-Type' => 'application/json'
|
57
|
+
}
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
def select_company_file(company_file)
|
52
62
|
company_file_id = (self.company_file.all.find {|file| file['Name'] == company_file[:name]} || [])['Id']
|
53
63
|
if company_file_id
|
64
|
+
token = company_file[:token]
|
65
|
+
if (!token || token == '') && company_file[:username] && company_file[:username] != '' && company_file[:password] && company_file[:password] != ''
|
66
|
+
# if we have been given login details, encode them into a token
|
67
|
+
token = Base64.encode64("#{company_file[:username]}:#{company_file[:password]}")
|
68
|
+
end
|
54
69
|
@current_company_file = {
|
55
70
|
:id => company_file_id,
|
56
|
-
:token =>
|
71
|
+
:token => token
|
57
72
|
}
|
58
73
|
end
|
59
74
|
end
|
data/lib/myob/api/version.rb
CHANGED
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.
|
4
|
+
version: '0.9'
|
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-
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.4.6
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: MYOB AccountRight Live API V2
|