myob-api 0.2.0 → 0.2.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: df2831ae79d4a7fe595b41d880ae810a3056661e
4
- data.tar.gz: a2f14d8e44951ef9299b967eb326d82658a92e23
3
+ metadata.gz: 9ef80a14f547ae468f20fa07170184aca8417eb7
4
+ data.tar.gz: 4161ecc3956d6a4dc9a3c4882a6d9948300a7660
5
5
  SHA512:
6
- metadata.gz: 24bf1a9394ab64e65d8b261d2469af77a97dcdc9648dfe9b38a83e7caa68d053a2eeefc9e5d2751d1263e6c625e7084cbf838d991f287db81fb429a6bb64e896
7
- data.tar.gz: f0ed4e36b247ecebf5abdddcfd02d69f70683aa35a3e50002c8c05f94683cbb1216db2b5d1621014e07240b88cdff1d78322d2b0cd78bc8bb8db316cd5695032
6
+ metadata.gz: c06514b379ebdaccaa94fd4f3d9427b3f5669ed36e99b475a23a3c479f59e6bae0facdda3c65110b12575648db07b63f745299c18ce24c7f05f239326169bfc7
7
+ data.tar.gz: a6eea9fe94c3e77d5aa529d28164f6134a7ad70ffafe872deb312786718b01116d4b99a8a2dd143990f0a57d163c72c7256936701e5b9a2f7d685782c5b70b9e
@@ -4,6 +4,7 @@ require 'myob/api/helpers'
4
4
 
5
5
  require 'myob/api/models/base'
6
6
  require 'myob/api/models/company_file'
7
+ require 'myob/api/models/company'
7
8
 
8
9
  require 'myob/api/models/contact'
9
10
  require 'myob/api/models/customer'
@@ -15,4 +16,4 @@ require 'myob/api/models/wage'
15
16
 
16
17
  require 'myob/api/models/timesheet'
17
18
 
18
- require 'myob/api/client'
19
+ require 'myob/api/client'
@@ -11,6 +11,8 @@ module Myob
11
11
  def initialize(options)
12
12
  model :CompanyFile
13
13
 
14
+ model :Company
15
+
14
16
  model :Contact
15
17
  model :Customer
16
18
  model :Employee
@@ -62,7 +64,7 @@ module Myob
62
64
  company_file_id = self.company_file.first('Name' => company_file[:name])['Id']
63
65
  @current_company_file = {
64
66
  :id => company_file_id,
65
- :token => Base64.encode64("#{company_file[:username]}:#{company_file[:password]}"),
67
+ :token => company_file[:token] || Base64.encode64("#{company_file[:username]}:#{company_file[:password]}"),
66
68
  }
67
69
  end
68
70
 
@@ -78,4 +80,4 @@ module Myob
78
80
 
79
81
  end
80
82
  end
81
- end
83
+ end
@@ -12,10 +12,11 @@ module Myob
12
12
  module Api
13
13
  module Helpers
14
14
  def model(model_name)
15
- variable_name = "@#{model_name.to_s.underscore}_model".to_sym
15
+ method_name = model_name.to_s.underscore
16
+ variable_name = "@#{method_name}_model".to_sym
16
17
  unless instance_variable_defined?(variable_name)
17
18
  instance_variable_set(variable_name, Myob::Api::Model.const_get("#{model_name}".to_sym).new(self, model_name.to_s))
18
- self.define_singleton_method("#{model_name.to_s.underscore}".to_sym) do
19
+ self.define_singleton_method(method_name.to_sym) do
19
20
  instance_variable_get(variable_name)
20
21
  end
21
22
  end
@@ -23,4 +24,4 @@ module Myob
23
24
  end
24
25
  end
25
26
  end
26
- end
27
+ end
@@ -91,4 +91,4 @@ module Myob
91
91
  end
92
92
  end
93
93
  end
94
- end
94
+ end
@@ -0,0 +1,8 @@
1
+ module Myob
2
+ module Api
3
+ module Model
4
+ class Company < Base
5
+ end
6
+ end
7
+ end
8
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class CompanyFile < Myob::Api::Model::Base
4
+ class CompanyFile < Base
5
5
  def model_route
6
6
  ''
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,8 +1,8 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class Contact < Myob::Api::Model::Base
4
+ class Contact < Base
5
5
  end
6
6
  end
7
7
  end
8
- end
8
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class Customer < Myob::Api::Model::Base
4
+ class Customer < Base
5
5
  def model_route
6
6
  'Contact/Customer'
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class Employee < Myob::Api::Model::Base
4
+ class Employee < Base
5
5
  def model_route
6
6
  'Contact/Employee'
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class EmployeePayrollDetail < Myob::Api::Model::Base
4
+ class EmployeePayrollDetail < Base
5
5
  def model_route
6
6
  'Contact/EmployeePayrollDetails'
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class PayrollCategory < Myob::Api::Model::Base
4
+ class PayrollCategory < Base
5
5
  def model_route
6
6
  'Payroll/PayrollCategory'
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class Timesheet < Myob::Api::Model::Base
4
+ class Timesheet < Base
5
5
  def model_route
6
6
  'Payroll/Timesheet'
7
7
  end
@@ -24,4 +24,4 @@ module Myob
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -1,11 +1,11 @@
1
1
  module Myob
2
2
  module Api
3
3
  module Model
4
- class Wage < Myob::Api::Model::Base
4
+ class Wage < Base
5
5
  def model_route
6
6
  'Payroll/PayrollCategory/Wage'
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Myob
2
2
  module Api
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lumley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-08 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -69,6 +69,7 @@ files:
69
69
  - lib/myob/api/client.rb
70
70
  - lib/myob/api/helpers.rb
71
71
  - lib/myob/api/models/base.rb
72
+ - lib/myob/api/models/company.rb
72
73
  - lib/myob/api/models/company_file.rb
73
74
  - lib/myob/api/models/contact.rb
74
75
  - lib/myob/api/models/customer.rb