beanie 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/VERSION +1 -1
  4. data/beanie.gemspec +1 -0
  5. data/lib/beanie/api.rb +69 -21
  6. data/lib/beanie/bank_account.rb +11 -1
  7. data/lib/beanie/bank_statement.rb +11 -0
  8. data/lib/beanie/bank_statement_data.rb +16 -0
  9. data/lib/beanie/beanie_alert.rb +10 -0
  10. data/lib/beanie/{contact.rb → bill_of_material.rb} +12 -23
  11. data/lib/beanie/billable.rb +11 -0
  12. data/lib/beanie/bom_item.rb +44 -0
  13. data/lib/beanie/company.rb +27 -0
  14. data/lib/beanie/company_member.rb +9 -0
  15. data/lib/beanie/config_type.rb +12 -0
  16. data/lib/beanie/config_value.rb +8 -0
  17. data/lib/beanie/customer.rb +18 -1
  18. data/lib/beanie/customer_address.rb +63 -0
  19. data/lib/beanie/{contact_address.rb → customer_note.rb} +10 -3
  20. data/lib/beanie/document.rb +11 -0
  21. data/lib/beanie/fixed_asset.rb +11 -0
  22. data/lib/beanie/journal.rb +10 -0
  23. data/lib/beanie/journal_item.rb +10 -0
  24. data/lib/beanie/nominal_account.rb +9 -0
  25. data/lib/beanie/nominal_account_category.rb +9 -0
  26. data/lib/beanie/product.rb +13 -0
  27. data/lib/beanie/product_category.rb +9 -0
  28. data/lib/beanie/product_price.rb +10 -0
  29. data/lib/beanie/production_order.rb +58 -0
  30. data/lib/beanie/purchase_invoice.rb +19 -0
  31. data/lib/beanie/purchase_order.rb +11 -0
  32. data/lib/beanie/purchase_order_item.rb +13 -0
  33. data/lib/beanie/sales_invoice.rb +18 -0
  34. data/lib/beanie/sales_invoice_item.rb +15 -0
  35. data/lib/beanie/sales_order.rb +13 -0
  36. data/lib/beanie/sales_order_item.rb +18 -0
  37. data/lib/beanie/stock_adjustment.rb +13 -0
  38. data/lib/beanie/stock_category.rb +10 -0
  39. data/lib/beanie/stock_item.rb +12 -0
  40. data/lib/beanie/stock_location.rb +8 -0
  41. data/lib/beanie/stock_supplier.rb +13 -0
  42. data/lib/beanie/supplier.rb +14 -1
  43. data/lib/beanie/supplier_address.rb +53 -0
  44. data/lib/beanie/{contact_note.rb → supplier_note.rb} +10 -2
  45. data/lib/beanie/tax_registration.rb +9 -0
  46. data/lib/beanie/vat_record.rb +10 -0
  47. data/lib/beanie/vat_return.rb +15 -0
  48. data/lib/beanie/version.rb +1 -1
  49. data/lib/beanie/work_centre.rb +10 -0
  50. data/lib/beanie/work_centre_group.rb +10 -4
  51. data/lib/beanie.rb +23 -26
  52. metadata +24 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 297dce11f464e9e22ea0b53404a0119a7e18db84
4
- data.tar.gz: 53cc9bcd2dd55924eb3abf17d1147ad004e8aa50
3
+ metadata.gz: d12f97b41e0c32526bf8f6db1f0e7a7db200266d
4
+ data.tar.gz: 219bd84135de543e3e986624b6dec48f10b8899d
5
5
  SHA512:
6
- metadata.gz: 6abf1a6363ef226c8bfc55c0c2ee2ab2326e48c35f2dd3ffe8ae881b2a5ec9283cd8415449ea21d312d5404c1a36a21d064f0506d139cf0c0eef27cfdc28a8c4
7
- data.tar.gz: edbe418d0c04294b8e9e492d3bf07ee1ecb53c07e1d72b774099de7af2d34bfae0b88de765d372ae73c6a3c3be385756872a44b3764636d4a02b3200d8de8356
6
+ metadata.gz: 2842992bf0caa0f58a118cbb6e424b99f3f465a985c3cd23eb3a5ec48611450a037877072d914a71c57d75d59de31eb2808ecad9400c07346b3860bd13c31940
7
+ data.tar.gz: ed3891c4ff76b46fa78373c0fdc99880c932005f7e9f4f79e55b1a1164828ffe22963ceab08c11a46d222393957e03067fdf896d635e03262397fbd06e770eac
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- <<<<<<< HEAD
2
1
  # Beanie API Bindings
3
2
 
4
3
  This gem provides an API interface into the Beanie cloud-based ERP system.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/beanie.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rest-client", "~> 2.0"
23
24
  end
data/lib/beanie/api.rb CHANGED
@@ -31,10 +31,63 @@ require 'active_support/inflector'
31
31
 
32
32
  module Beanie
33
33
  class Api
34
+ #
35
+ # Find all the objects
36
+ def self.all(opts = {})
37
+ data = get(opts)
38
+ objlist = []
39
+ data[new.object_name.pluralize].each do |objdata|
40
+ objlist << new.populate(objdata)
41
+ end
42
+ objlist
43
+ end
44
+
45
+ #
46
+ # Find an object based on its ID
47
+ def self.find(id)
48
+ data = get(:id => id)
49
+ obj = new
50
+ obj.populate(data[obj.object_name])
51
+ end
52
+
53
+ #
54
+ # Save the customer data
55
+ def save!(opts = {})
56
+ data = extract()
57
+ data.delete("id")
58
+ objdata = {object_name => data}
59
+ response = self.class.post(objdata, opts)
60
+ self.populate(response[self.object_name])
61
+ end
62
+
63
+ #
64
+ # Populate the instance variables from the provided hash.
65
+ def populate(data)
66
+ self.instance_variables.each do |var|
67
+ self.instance_variable_set(var, data[field_name(var)])
68
+ end
69
+ self
70
+ end
71
+
72
+ #
73
+ # Populate the instance variables from the provided hash.
74
+ def extract
75
+ data = {}
76
+ self.instance_variables.each do |var|
77
+ data[field_name(var)] = self.instance_variable_get(var)
78
+ end
79
+ data
80
+ end
81
+
82
+ #
83
+ # Determine the field name
84
+ def field_name(var)
85
+ var.to_s.gsub(/^@/, '')
86
+ end
87
+
34
88
  #
35
89
  # Run a REST GET against the Beanie API.
36
90
  def self.get(opts = {})
37
- puts "Beanie GET..."
38
91
  response = RestClient.get(build_url(opts), headers=set_headers)
39
92
  JSON.parse(response.body)
40
93
  end
@@ -42,7 +95,6 @@ module Beanie
42
95
  #
43
96
  # Run a REST PUT against the Beanie API.
44
97
  def self.put(data, opts = {})
45
- puts "Beanie PUT..."
46
98
  response = RestClient.put(build_url(opts), data, headers=set_headers)
47
99
  JSON.parse(response.body)
48
100
  end
@@ -50,15 +102,13 @@ module Beanie
50
102
  #
51
103
  # Run a REST POST against the Beanie API.
52
104
  def self.post(data, opts = {})
53
- puts "Beanie POST..."
54
- response = RestClient.post(build_url(opts), data, headers=set_headers)
105
+ response = RestClient.post(build_url(opts), data.to_json, headers=set_headers)
55
106
  JSON.parse(response.body)
56
107
  end
57
108
 
58
109
  #
59
110
  # Run a REST DELETE against the Beanie API.
60
111
  def self.delete(data, opts = {})
61
- puts "Beanie DELETE..."
62
112
  response = RestClient.delete(build_url(opts), headers=set_headers)
63
113
  JSON.parse(response.body)
64
114
  end
@@ -66,22 +116,23 @@ module Beanie
66
116
  #
67
117
  #
68
118
  def self.build_url(opts = {})
69
- puts "BUILD URL. Opts:-"
70
- p opts
71
119
  if opts[:url]
72
- url = "#{Beanie.base_uri}#{opts[:url]}.json"
120
+ url = "#{Beanie.base_uri}#{opts[:url]}"
73
121
  opts.delete(:url)
74
122
  else
75
- url = "#{Beanie.base_uri}/#{new.object_name.pluralize}.json"
123
+ url = "#{Beanie.base_uri}/#{new.construct_path(opts)}"
124
+ end
125
+ if opts[:id]
126
+ url += "/#{opts[:id]}"
127
+ opts.delete(:id)
76
128
  end
129
+ url += ".json"
77
130
  optstr = ""
78
131
  opts.each_key do |key|
79
132
  optstr += (optstr.length == 0) ? "?" : "&"
80
133
  optstr += "#{key.to_s}=#{opts[key]}"
81
134
  end
82
- url += optstr
83
- puts "URL: #{url}"
84
- url
135
+ url + optstr
85
136
  end
86
137
 
87
138
  #
@@ -94,6 +145,12 @@ module Beanie
94
145
  headers
95
146
  end
96
147
 
148
+ #
149
+ # Default mechanism for constructing a path
150
+ def construct_path(opts = {})
151
+ object_name.pluralize
152
+ end
153
+
97
154
  #
98
155
  # Compute a Beanie object name from the class name.
99
156
  def object_name
@@ -104,14 +161,5 @@ module Beanie
104
161
  tr("-", "_").
105
162
  downcase
106
163
  end
107
-
108
- #
109
- # Populate the instance variables from the provided hash.
110
- def populate(data, *vars)
111
- vars.each do |var|
112
- varsym = var.to_s.gsub(/^/, '@').to_sym
113
- self.instance_variable_set(varsym, data[var.to_s])
114
- end
115
- end
116
164
  end
117
165
  end
@@ -29,6 +29,16 @@
29
29
  #
30
30
  module Beanie
31
31
  class BankAccount < Api
32
- attr_accessor :id, :iban, :name, :swift, :nominal_account_id, :contact_id
32
+ attr_accessor :id, :iban, :name, :swift, :nominal_account_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @iban = nil
39
+ @name = nil
40
+ @swift = nil
41
+ @nominal_account_id = nil
42
+ end
33
43
  end
34
44
  end
@@ -30,5 +30,16 @@
30
30
  module Beanie
31
31
  class BankStatement < Api
32
32
  attr_accessor :id, :end_date, :start_date, :upload_file, :bank_account_id, :document_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @end_date = nil
39
+ @start_date = nil
40
+ @upload_file = nil
41
+ @bank_account_id = nil
42
+ @document_id = nil
43
+ end
33
44
  end
34
45
  end
@@ -31,5 +31,21 @@ module Beanie
31
31
  class BankStatementData < Api
32
32
  attr_accessor :id, :cr_amount, :date, :dr_amount, :balance, :bank_statement_id
33
33
  attr_accessor :narrative1, :narrative2, :narrative3, :narrative4, :narrative5
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @cr_amount = nil
40
+ @date = nil
41
+ @dr_amount = nil
42
+ @balance = nil
43
+ @bank_statement_id = nil
44
+ @narrative1 = nil
45
+ @narrative2 = nil
46
+ @narrative3 = nil
47
+ @narrative4 = nil
48
+ @narrative5 = nil
49
+ end
34
50
  end
35
51
  end
@@ -40,6 +40,16 @@ module Beanie
40
40
  ["Acknowledged (Read)", STATE_READ],
41
41
  ["Archived", STATE_ARCHIVED]
42
42
  ].freeze
43
+
44
+ #
45
+ # Initialize instance variables
46
+ def initialize
47
+ @id = nil
48
+ @state = nil
49
+ @message = nil
50
+ @url = nil
51
+ @member_id = nil
52
+ end
43
53
 
44
54
  #
45
55
  # Printable form of the state name
@@ -28,28 +28,17 @@
28
28
  # POSSIBILITY OF SUCH DAMAGE.
29
29
  #
30
30
  module Beanie
31
- class Contact < Api
32
- attr_accessor :id, :first_name, :last_name, :suffix, :title, :company_name, :email, :phone, :website
33
- attr_accessor :id, :address1, :address2, :address3, :city, :state_county, :zip_postcode, :country
34
-
35
- TITLE_NONE = 0
36
- TITLE_MR = 1
37
- TITLE_MRS = 2
38
- TITLE_MS = 3
39
- TITLE_MASTER = 4
40
- TITLE_DR = 5
41
- TITLE_FR = 6
42
- TITLE_REV = 7
43
-
44
- TITLE_NAMES = [
45
- ["", TITLE_NONE],
46
- ["Mr", TITLE_MR],
47
- ["Mrs", TITLE_MRS],
48
- ["Ms", TITLE_MS],
49
- ["Master", TITLE_MASTER],
50
- ["Dr", TITLE_DR],
51
- ["Fr", TITLE_FR],
52
- ["Rev", TITLE_REV]
53
- ].freeze
31
+ class ProductionOrder < Api
32
+ attr_accessor :id, :name, :revision, :description, :stock_item_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @name = nil
39
+ @revision = nil
40
+ @description = nil
41
+ @stock_item_id = nil
42
+ end
54
43
  end
55
44
  end
@@ -31,5 +31,16 @@ module Beanie
31
31
  class Billable < Api
32
32
  attr_accessor :id, :sales_invoice_item_id, :sales_order_item_id
33
33
  attr_accessor :quantity, :start, :description
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @sales_invoice_item_id = nil
40
+ @sales_order_item_id = nil
41
+ @quantity = nil
42
+ @start = nil
43
+ @description = nil
44
+ end
34
45
  end
35
46
  end
@@ -0,0 +1,44 @@
1
+ #
2
+ # Copyright (c) 2017-2018, AltoYield Limited. All rights reserved.
3
+ #
4
+ # This is free software; you can redistribute it and/or modify it
5
+ # under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2, or (at your option)
7
+ # any later version.
8
+ #
9
+ # It is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
+ # for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License along
15
+ # with this product; see the file COPYING. If not, write to the Free
16
+ # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY ALTOYIELD LIMITED "AS IS" AND ANY EXPRESS
19
+ # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ # ARE DISCLAIMED. IN NO EVENT SHALL ALTOYIELD LIMITED BE LIABLE FOR
22
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
+ # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
+ # POSSIBILITY OF SUCH DAMAGE.
29
+ #
30
+ module Beanie
31
+ class BomItem < Api
32
+ attr_accessor :id, :stock_item_id, :quantity, :notes, :designators
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @stock_item_id = nil
39
+ @quantity = nil
40
+ @notes = nil
41
+ @designators = nil
42
+ end
43
+ end
44
+ end
@@ -36,5 +36,32 @@ module Beanie
36
36
  attr_accessor :sales_shipping_nominal_account_id
37
37
  attr_accessor :accounts_receivable_nominal_account_id
38
38
  attr_accessor :accounts_payable_nominal_account_id
39
+
40
+ #
41
+ # Initialize instance variables
42
+ def initialize
43
+ @id = nil
44
+ @name = nil
45
+ @email = nil
46
+ @address1 = nil
47
+ @address2 = nil
48
+ @address3 = nil
49
+ @city = nil
50
+ @state_county = nil
51
+ @website = nil
52
+ @phone = nil
53
+ @fax = nil
54
+ @zip_postcode = nil
55
+ @registration = nil
56
+ @next_fye = nil
57
+ @runcom = nil
58
+ @country = nil
59
+ @currency = nil
60
+ @invoice_template_id = nil
61
+ @purchase_shipping_nominal_account_id = nil
62
+ @sales_shipping_nominal_account_id = nil
63
+ @accounts_receivable_nominal_account_id = nil
64
+ @accounts_payable_nominal_account_id = nil
65
+ end
39
66
  end
40
67
  end
@@ -30,5 +30,14 @@
30
30
  module Beanie
31
31
  class CompanyMember < Api
32
32
  attr_accessor :id, :member_id, :role, :member_email
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @member_id = nil
39
+ @role = nil
40
+ @member_email = nil
41
+ end
33
42
  end
34
43
  end
@@ -30,6 +30,18 @@
30
30
  module Beanie
31
31
  class ConfigType < Api
32
32
  attr_accessor :id, :defvalue, :description, :name, :regexp, :tag, :typecode
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @defvalue = nil
39
+ @description = nil
40
+ @name = nil
41
+ @regexp = nil
42
+ @tag = nil
43
+ @typecode = nil
44
+ end
33
45
 
34
46
  TYPE_BOOLEAN = 0
35
47
  TYPE_INTEGER = 1
@@ -30,5 +30,13 @@
30
30
  module Beanie
31
31
  class ConfigValue < Api
32
32
  attr_accessor :id, :value, :config_type
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @value = nil
39
+ @config_type = nil
40
+ end
33
41
  end
34
42
  end
@@ -29,6 +29,23 @@
29
29
  #
30
30
  module Beanie
31
31
  class Customer < Api
32
- attr_accessor :id, :balance, :state, :terms, :customer_vat, :contact_id, :currency
32
+ attr_accessor :id, :name, :state, :balance, :terms, :customer_vat, :currency
33
+ attr_accessor :internal_ref, :credit_limit, :credit_hold, :invoice_method
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @name = nil
40
+ @state = nil
41
+ @balance = nil
42
+ @terms = nil
43
+ @customer_vat = nil
44
+ @currency = nil
45
+ @internal_ref = nil
46
+ @credit_limit = nil
47
+ @credit_hold = nil
48
+ @invoice_method = nil
49
+ end
33
50
  end
34
51
  end
@@ -0,0 +1,63 @@
1
+ #
2
+ # Copyright (c) 2017-2018, AltoYield Limited. All rights reserved.
3
+ #
4
+ # This is free software; you can redistribute it and/or modify it
5
+ # under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2, or (at your option)
7
+ # any later version.
8
+ #
9
+ # It is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
+ # for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License along
15
+ # with this product; see the file COPYING. If not, write to the Free
16
+ # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY ALTOYIELD LIMITED "AS IS" AND ANY EXPRESS
19
+ # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ # ARE DISCLAIMED. IN NO EVENT SHALL ALTOYIELD LIMITED BE LIABLE FOR
22
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
+ # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
+ # POSSIBILITY OF SUCH DAMAGE.
29
+ #
30
+ module Beanie
31
+ class CustomerAddress < Api
32
+ attr_accessor :customer_id, :id, :label, :name, :address1, :address2, :address3, :city
33
+ attr_accessor :state_county, :zip_postcode, :country_id, :email, :phone, :website
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @customer_id = nil
40
+ @label = nil
41
+ @name = nil
42
+ @address1 = nil
43
+ @address2 = nil
44
+ @address3 = nil
45
+ @city = nil
46
+ @state_county = nil
47
+ @zip_postcode = nil
48
+ @country = nil
49
+ @email = nil
50
+ @phone = nil
51
+ @website = nil
52
+ end
53
+
54
+ #
55
+ # Construct the path a little differently...
56
+ def construct_path(opts = {})
57
+ raise ":customer_id is not defined" unless opts[:customer_id]
58
+ path = "/customers/#{opts[:customer_id]}/customer_addresses"
59
+ opts.delete(:customer_id)
60
+ path
61
+ end
62
+ end
63
+ end
@@ -28,8 +28,15 @@
28
28
  # POSSIBILITY OF SUCH DAMAGE.
29
29
  #
30
30
  module Beanie
31
- class ContactAddress < Api
32
- attr_accessor :id, :address_type, :address1, :address2, :address3, :city, :state_county
33
- attr_accessor :zip_postcode, :contact_id, :country
31
+ class CustomerNote < Api
32
+ attr_accessor :id, :member, :note
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @member = nil
39
+ @note = nil
40
+ end
34
41
  end
35
42
  end
@@ -50,6 +50,17 @@ module Beanie
50
50
  ["Contracts", CATEGORY_CONTRACTS],
51
51
  ["Miscellaneous", CATEGORY_MISCELLANEOUS]
52
52
  ].freeze
53
+
54
+ #
55
+ # Initialize instance variables
56
+ def initialize
57
+ @id = nil
58
+ @bxref = nil
59
+ @mime_type = nil
60
+ @size = nil
61
+ @src_file = nil
62
+ @category = nil
63
+ end
53
64
 
54
65
  #
55
66
  # Display a name for the document category
@@ -30,5 +30,16 @@
30
30
  module Beanie
31
31
  class FixedAsset < Api
32
32
  attr_accessor :id, :acquired, :cost, :name, :value, :nominal_account_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @acquired = nil
39
+ @cost = nil
40
+ @name = nil
41
+ @value = nil
42
+ @nominal_account_id = nil
43
+ end
33
44
  end
34
45
  end
@@ -30,5 +30,15 @@
30
30
  module Beanie
31
31
  class Journal < Api
32
32
  attr_accessor :id, :date, :folio, :title, :number
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @date = nil
39
+ @folio = nil
40
+ @title = nil
41
+ @number = nil
42
+ end
33
43
  end
34
44
  end
@@ -30,5 +30,15 @@
30
30
  module Beanie
31
31
  class JournalItem < Api
32
32
  attr_accessor :id, :amount, :is_credit, :journal_id, :nominal_account_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @amount = nil
39
+ @is_credit = nil
40
+ @journal_id = nil
41
+ @nominal_account_id = nil
42
+ end
33
43
  end
34
44
  end
@@ -30,5 +30,14 @@
30
30
  module Beanie
31
31
  class NominalAccount < Api
32
32
  attr_accessor :id, :code, :name, :nominal_account_category_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @code = nil
39
+ @name = nil
40
+ @nominal_account_category_id = nil
41
+ end
33
42
  end
34
43
  end
@@ -54,6 +54,15 @@ module Beanie
54
54
  ["Other Expense", NA_TYPE_OTHER_EXPENSE],
55
55
  ["Other Income", NA_TYPE_OTHER_INCOME]
56
56
  ].freeze
57
+
58
+ #
59
+ # Initialize instance variables
60
+ def initialize
61
+ @id = nil
62
+ @na_type = nil
63
+ @name = nil
64
+ @parent_category_id = nil
65
+ end
57
66
 
58
67
  #
59
68
  # Show proper name for type
@@ -32,6 +32,19 @@ module Beanie
32
32
  attr_accessor :id, :description, :name, :sku, :is_service
33
33
  attr_accessor :nominal_account_id, :product_category_id, :unit_of_measure
34
34
 
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @description = nil
40
+ @name = nil
41
+ @sku = nil
42
+ @is_service = nil
43
+ @nominal_account_id = nil
44
+ @product_category_id = nil
45
+ @unit_of_measure = nil
46
+ end
47
+
35
48
  def self.find_by_name(name)
36
49
  puts "Find by name: #{name}"
37
50
  Beanie.find("products", "name", name)