beanie 0.0.1 → 0.0.2

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.
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
@@ -30,5 +30,14 @@
30
30
  module Beanie
31
31
  class ProductCategory < Api
32
32
  attr_accessor :id, :description, :name, :parent_category_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @description = nil
39
+ @name = nil
40
+ @parent_category_id = nil
41
+ end
33
42
  end
34
43
  end
@@ -30,5 +30,15 @@
30
30
  module Beanie
31
31
  class ProductPrice < Api
32
32
  attr_accessor :id, :amount, :effective, :sales_tax_id, :product_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @amount = nil
39
+ @effective = nil
40
+ @sales_tax_id = nil
41
+ @product_id = nil
42
+ end
33
43
  end
34
44
  end
@@ -0,0 +1,58 @@
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 ProductionOrder < Api
32
+ attr_accessor :id, :number, :state, :quantity, :notes, :provisioning
33
+ attr_accessor :sales_order_id, :bill_of_material_id, :work_centre_group_id
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @number = nil
40
+ @state = nil
41
+ @quantity = nil
42
+ @notes = nil
43
+ @provisioning = nil
44
+ @sales_order_id = nil
45
+ @bill_of_material_id = nil
46
+ @work_centre_group_id = nil
47
+ end
48
+
49
+ #
50
+ # Construct the path a little differently...
51
+ def construct_path(opts = {})
52
+ raise ":work_centre_group_id is not defined" unless opts[:work_centre_group_id]
53
+ path = "/work_centre_groups/#{opts[:work_centre_group_id]}/production_orders"
54
+ opts.delete(:work_centre_group_id)
55
+ path
56
+ end
57
+ end
58
+ end
@@ -32,5 +32,24 @@ module Beanie
32
32
  attr_accessor :id, :date, :due_date, :is_credit_note, :is_paid, :local_gross, :number
33
33
  attr_accessor :original_invoice_id, :shipping, :sub_total, :tax, :tax_point
34
34
  attr_accessor :purchase_order_id, :document_id
35
+
36
+ #
37
+ # Initialize instance variables
38
+ def initialize
39
+ @id = nil
40
+ @date = nil
41
+ @due_date = nil
42
+ @is_credit_note = nil
43
+ @is_paid = nil
44
+ @local_gross = nil
45
+ @number = nil
46
+ @original_invoice_id = nil
47
+ @shipping = nil
48
+ @sub_total = nil
49
+ @tax = nil
50
+ @tax_point = nil
51
+ @purchase_order_id = nil
52
+ @document_id = nil
53
+ end
35
54
  end
36
55
  end
@@ -31,5 +31,16 @@ module Beanie
31
31
  class PurchaseOrder < Api
32
32
  attr_accessor :id, :date, :number, :title
33
33
  attr_accessor :currency, :supplier_id
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @date = nil
40
+ @number = nil
41
+ @title = nil
42
+ @currency = nil
43
+ @supplier_id = nil
44
+ end
34
45
  end
35
46
  end
@@ -43,5 +43,18 @@ module Beanie
43
43
  ["Back-Order", STATE_BACKORDER],
44
44
  ["Item Complete", STATE_COMPLETE]
45
45
  ].freeze
46
+
47
+ #
48
+ # Initialize instance variables
49
+ def initialize
50
+ @id = nil
51
+ @description = nil
52
+ @discount = nil
53
+ @quantity = nil
54
+ @state = nil
55
+ @unit_cost = nil
56
+ @purchase_order_id = nil
57
+ @sales_tax = nil
58
+ end
46
59
  end
47
60
  end
@@ -55,6 +55,24 @@ module Beanie
55
55
  ["Overdue (Over 90 days)", STATE_OVERDUE4],
56
56
  ["Overdue (Over 120 days)", STATE_OVERDUE5]
57
57
  ].freeze
58
+
59
+ #
60
+ # Initialize instance variables
61
+ def initialize
62
+ @id = nil
63
+ @date = nil
64
+ @due_date = nil
65
+ @number = nil
66
+ @is_credit_note = nil
67
+ @local_gross = nil
68
+ @shipping = nil
69
+ @sub_total = nil
70
+ @tax = nil
71
+ @tax_point = nil
72
+ @sales_order_id = nil
73
+ @original_invoice = nil
74
+ @state = nil
75
+ end
58
76
 
59
77
  #
60
78
  # Show the state in a useful format
@@ -31,5 +31,20 @@ module Beanie
31
31
  class SalesInvoiceItem < Api
32
32
  attr_accessor :id, :description, :discount, :quantity, :run_date, :run_length, :unit_cost
33
33
  attr_accessor :sales_invoice_id, :sales_order_item_id, :sales_tax
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @description = nil
40
+ @discount = nil
41
+ @quantity = nil
42
+ @run_date = nil
43
+ @run_length = nil
44
+ @unit_cost = nil
45
+ @sales_invoice_id = nil
46
+ @sales_order_item_id = nil
47
+ @sales_tax = nil
48
+ end
34
49
  end
35
50
  end
@@ -30,5 +30,18 @@
30
30
  module Beanie
31
31
  class SalesOrder < Api
32
32
  attr_accessor :id, :cash_customer_ref, :number, :date, :title, :your_ref, :currency, :customer_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @cash_customer_ref = nil
39
+ @number = nil
40
+ @date = nil
41
+ @title = nil
42
+ @your_ref = nil
43
+ @currency = nil
44
+ @customer_id = nil
45
+ end
33
46
  end
34
47
  end
@@ -75,6 +75,24 @@ module Beanie
75
75
  ["Quarterly Rate", SERVICE_PERIOD_QUARTERLY],
76
76
  ["Annual Rate", SERVICE_PERIOD_ANNUALLY]
77
77
  ].freeze
78
+
79
+ #
80
+ # Initialize instance variables
81
+ def initialize
82
+ @id = nil
83
+ @completion = nil
84
+ @description = nil
85
+ @discount = nil
86
+ @frequency = nil
87
+ @quantity = nil
88
+ @rundate = nil
89
+ @state = nil
90
+ @sales_order_id = nil
91
+ @product_id = nil
92
+ @service_period = nil
93
+ @unit_cost = nil
94
+ @sales_tax = nil
95
+ end
78
96
 
79
97
  #
80
98
  # Pretty name for the state
@@ -47,6 +47,19 @@ module Beanie
47
47
  ["Move from Inventory", TYPE_FROM_INVENTORY],
48
48
  ["Spoilage", TYPE_SPOILAGE]
49
49
  ].freeze
50
+
51
+ #
52
+ # Initialize instance variables
53
+ def initialize
54
+ @id = nil
55
+ @effective = nil
56
+ @adjustment_type = nil
57
+ @amount = nil
58
+ @note = nil
59
+ @stock_item_id = nil
60
+ @stock_supplier_id = nil
61
+ @purchase_order_item_id = nil
62
+ end
50
63
 
51
64
  #
52
65
  # Convert the type into a useful name
@@ -30,5 +30,15 @@
30
30
  module Beanie
31
31
  class StockCategory < Api
32
32
  attr_accessor :id, :code, :name, :description, :nominal_account_id
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @code = nil
39
+ @name = nil
40
+ @description = nil
41
+ @nominal_account_id = nil
42
+ end
33
43
  end
34
44
  end
@@ -42,5 +42,17 @@ module Beanie
42
42
  ["Work In Progress", TYPE_WORK_IN_PROGRESS],
43
43
  ["Finished Goods", TYPE_FINISHED_GOODS]
44
44
  ].freeze
45
+
46
+ #
47
+ # Initialize instance variables
48
+ def initialize
49
+ @id = nil
50
+ @description = nil
51
+ @item_type = nil
52
+ @name = nil
53
+ @sku = nil
54
+ @stock_category_id = nil
55
+ @unit_of_measure = nil
56
+ end
45
57
  end
46
58
  end
@@ -30,5 +30,13 @@
30
30
  module Beanie
31
31
  class StockLocation < Api
32
32
  attr_accessor :id, :description, :name
33
+
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @description = nil
39
+ @name = nil
40
+ end
33
41
  end
34
42
  end
@@ -31,5 +31,18 @@ module Beanie
31
31
  class StockSupplier < Api
32
32
  attr_accessor :id, :priority, :supplier_partno, :lot_size, :lead_time, :last_price
33
33
  attr_accessor :stock_item_id, :supplier_id
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @priority = nil
40
+ @supplier_partno = nil
41
+ @lot_size = nil
42
+ @lead_time = nil
43
+ @last_price = nil
44
+ @stock_item_id = nil
45
+ @supplier_id = nil
46
+ end
34
47
  end
35
48
  end
@@ -30,6 +30,19 @@
30
30
  module Beanie
31
31
  class Supplier < Api
32
32
  attr_accessor :id, :balance, :state, :supplier_vat, :terms, :lead_time, :minimum_order_amount
33
- attr_accessor :contact_id, :currency
33
+ attr_accessor :currency
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @balance = nil
40
+ @state = nil
41
+ @supplier_vat = nil
42
+ @terms = nil
43
+ @lead_time = nil
44
+ @minimum_order_amount = nil
45
+ @currency = nil
46
+ end
34
47
  end
35
48
  end
@@ -0,0 +1,53 @@
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 SupplierAddress < Api
32
+ attr_accessor :id, :label, :name, :address1, :address2, :address3, :city
33
+ attr_accessor :state_county, :zip_postcode, :country, :email, :phone, :website
34
+
35
+ #
36
+ # Initialize instance variables
37
+ def initialize
38
+ @id = nil
39
+ @label = nil
40
+ @name = nil
41
+ @address1 = nil
42
+ @address2 = nil
43
+ @address3 = nil
44
+ @city = nil
45
+ @state_county = nil
46
+ @zip_postcode = nil
47
+ @country = nil
48
+ @email = nil
49
+ @phone = nil
50
+ @website = nil
51
+ end
52
+ end
53
+ end
@@ -28,7 +28,15 @@
28
28
  # POSSIBILITY OF SUCH DAMAGE.
29
29
  #
30
30
  module Beanie
31
- class ContactNote < Api
32
- attr_accessor :id, :contact_id, :note, :member_id
31
+ class SupplierNote < 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
33
41
  end
34
42
  end
@@ -40,6 +40,15 @@ module Beanie
40
40
  ["VAT", TAX_TYPE_SALES],
41
41
  ["PAYE", TAX_TYPE_PAYROLL]
42
42
  ].freeze
43
+
44
+ #
45
+ # Initialize instance variables
46
+ def initialize
47
+ @id = nil
48
+ @tax_type = nil
49
+ @number = nil
50
+ @nominal_account_id = nil
51
+ end
43
52
 
44
53
  #
45
54
  # Tax Type as a name
@@ -46,6 +46,16 @@ module Beanie
46
46
  ["Services From", TYPE_SERVICES_FROM],
47
47
  ["Services To", TYPE_SERVICES_TO]
48
48
  ].freeze
49
+
50
+ #
51
+ # Initialize instance variables
52
+ def initialize
53
+ @id = nil
54
+ @amount = nil
55
+ @record_type = nil
56
+ @vat_return_id = nil
57
+ @sales_tax_rate = nil
58
+ end
49
59
 
50
60
  #
51
61
  # Conver the record type into a string
@@ -41,5 +41,20 @@ module Beanie
41
41
  ["Supplementary Return", RETURN_TYPE_SUPPLEMENTARY],
42
42
  ["Amended Return", RETURN_TYPE_AMENDED]
43
43
  ].freeze
44
+
45
+ #
46
+ # Initialize instance variables
47
+ def initialize
48
+ @id = nil
49
+ @start_date = nil
50
+ @end_date = nil
51
+ @return_type = nil
52
+ @purchase = nil
53
+ @sales = nil
54
+ @goods_from = nil
55
+ @goods_to = nil
56
+ @services_from = nil
57
+ @services_to = nil
58
+ end
44
59
  end
45
60
  end
@@ -28,5 +28,5 @@
28
28
  # POSSIBILITY OF SUCH DAMAGE.
29
29
  #
30
30
  module Beanie
31
- VERSION = "0.0.1"
31
+ VERSION = "0.0.2"
32
32
  end
@@ -31,6 +31,16 @@ module Beanie
31
31
  class WorkCentre < Api
32
32
  attr_accessor :id, :name, :location, :description, :work_centre_group_id
33
33
 
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @name = nil
39
+ @location = nil
40
+ @description = nil
41
+ @work_centre_group_id = nil
42
+ end
43
+
34
44
  #
35
45
  # Find all work centres under a specific work centre group
36
46
  def self.find_all_by_group(work_centre_group_id)
@@ -31,14 +31,20 @@ module Beanie
31
31
  class WorkCentreGroup < Api
32
32
  attr_accessor :id, :code, :name, :description
33
33
 
34
+ #
35
+ # Initialize instance variables
36
+ def initialize
37
+ @id = nil
38
+ @code = nil
39
+ @name = nil
40
+ @description = nil
41
+ end
42
+
34
43
  #
35
44
  # Find a work centre group by code
36
45
  def self.find_by_code(code)
37
46
  data = self.get(:code => code)
38
- wcg_data = data['work_centre_group']
39
- wcg = new
40
- wcg.populate(wcg_data, :id, :code, :name, :description)
41
- wcg
47
+ new.populate(data['work_centre_group'])
42
48
  end
43
49
  end
44
50
  end
data/lib/beanie.rb CHANGED
@@ -35,50 +35,53 @@ require 'rest-client'
35
35
  require 'json'
36
36
 
37
37
  require File.dirname(__FILE__) + '/beanie/api'
38
+ require File.dirname(__FILE__) + '/beanie/version'
39
+ require File.dirname(__FILE__) + '/beanie/company'
40
+ require File.dirname(__FILE__) + '/beanie/company_member'
38
41
  require File.dirname(__FILE__) + '/beanie/bank_account'
39
- require File.dirname(__FILE__) + '/beanie/bank_statement_data'
40
42
  require File.dirname(__FILE__) + '/beanie/bank_statement'
43
+ require File.dirname(__FILE__) + '/beanie/bank_statement_data'
41
44
  require File.dirname(__FILE__) + '/beanie/beanie_alert'
42
45
  require File.dirname(__FILE__) + '/beanie/billable'
43
- require File.dirname(__FILE__) + '/beanie/company_member'
44
- require File.dirname(__FILE__) + '/beanie/company'
46
+ require File.dirname(__FILE__) + '/beanie/bill_of_material'
47
+ require File.dirname(__FILE__) + '/beanie/bom_item'
45
48
  require File.dirname(__FILE__) + '/beanie/config_type'
46
49
  require File.dirname(__FILE__) + '/beanie/config_value'
47
- require File.dirname(__FILE__) + '/beanie/contact_address'
48
- require File.dirname(__FILE__) + '/beanie/contact_note'
49
- require File.dirname(__FILE__) + '/beanie/contact'
50
50
  require File.dirname(__FILE__) + '/beanie/customer'
51
+ require File.dirname(__FILE__) + '/beanie/customer_address'
52
+ require File.dirname(__FILE__) + '/beanie/customer_note'
51
53
  require File.dirname(__FILE__) + '/beanie/document'
52
54
  require File.dirname(__FILE__) + '/beanie/fixed_asset'
53
- require File.dirname(__FILE__) + '/beanie/journal_item'
54
55
  require File.dirname(__FILE__) + '/beanie/journal'
56
+ require File.dirname(__FILE__) + '/beanie/journal_item'
55
57
  require File.dirname(__FILE__) + '/beanie/nominal_account_category'
56
58
  require File.dirname(__FILE__) + '/beanie/nominal_account'
57
59
  require File.dirname(__FILE__) + '/beanie/product_category'
58
- require File.dirname(__FILE__) + '/beanie/product_price'
59
60
  require File.dirname(__FILE__) + '/beanie/product'
61
+ require File.dirname(__FILE__) + '/beanie/product_price'
62
+ require File.dirname(__FILE__) + '/beanie/work_centre_group'
63
+ require File.dirname(__FILE__) + '/beanie/work_centre'
64
+ require File.dirname(__FILE__) + '/beanie/production_order'
60
65
  require File.dirname(__FILE__) + '/beanie/purchase_invoice'
61
- require File.dirname(__FILE__) + '/beanie/purchase_order_item'
62
66
  require File.dirname(__FILE__) + '/beanie/purchase_order'
63
- require File.dirname(__FILE__) + '/beanie/sales_invoice_item'
67
+ require File.dirname(__FILE__) + '/beanie/purchase_order_item'
64
68
  require File.dirname(__FILE__) + '/beanie/sales_invoice'
65
- require File.dirname(__FILE__) + '/beanie/sales_order_item'
69
+ require File.dirname(__FILE__) + '/beanie/sales_invoice_item'
66
70
  require File.dirname(__FILE__) + '/beanie/sales_order'
67
- require File.dirname(__FILE__) + '/beanie/stock_adjustment'
71
+ require File.dirname(__FILE__) + '/beanie/sales_order_item'
72
+ require File.dirname(__FILE__) + '/beanie/stock_location'
68
73
  require File.dirname(__FILE__) + '/beanie/stock_category'
69
74
  require File.dirname(__FILE__) + '/beanie/stock_item'
70
- require File.dirname(__FILE__) + '/beanie/stock_location'
75
+ require File.dirname(__FILE__) + '/beanie/stock_adjustment'
71
76
  require File.dirname(__FILE__) + '/beanie/stock_supplier'
72
77
  require File.dirname(__FILE__) + '/beanie/supplier'
78
+ require File.dirname(__FILE__) + '/beanie/supplier_address'
79
+ require File.dirname(__FILE__) + '/beanie/supplier_note'
73
80
  require File.dirname(__FILE__) + '/beanie/tax_registration'
74
81
  require File.dirname(__FILE__) + '/beanie/vat_record'
75
82
  require File.dirname(__FILE__) + '/beanie/vat_return'
76
- require File.dirname(__FILE__) + '/beanie/version'
77
- require File.dirname(__FILE__) + '/beanie/work_centre_group'
78
- require File.dirname(__FILE__) + '/beanie/work_centre'
79
83
 
80
84
  module Beanie
81
- @@base_uri = 'https://bean.ie'
82
85
  @@token = nil
83
86
 
84
87
  class << self
@@ -90,11 +93,9 @@ module Beanie
90
93
  end
91
94
 
92
95
  def self.connect(opts = {})
96
+ @base_uri = opts[:base_uri] ? opts[:base_uri] : 'https://bean.ie'
93
97
  @api_key = opts[:api_key] if opts[:api_key]
94
98
  @secret_key = opts[:secret_key] if opts[:secret_key]
95
- p opts
96
- puts "API KEY: #{@api_key}"
97
- puts "SECRET: #{@secret_key}"
98
99
  end
99
100
 
100
101
  def self.get_token
@@ -109,7 +110,7 @@ module Beanie
109
110
  'See https://bean.ie/en/apikey for details or email support@bean.ie ' \
110
111
  'for further assistance.')
111
112
  end
112
- url = "#{@@base_uri}/api/authenticate"
113
+ url = "#{@base_uri}/api/authenticate"
113
114
  data = {:api_key => @api_key, :secret_key => @secret_key}
114
115
  response = RestClient.post(url, data.to_json, :content_type => :json, :accept => :json)
115
116
  puts "Token response: #{response.code} (data: #{response.body})"
@@ -121,10 +122,6 @@ module Beanie
121
122
  end
122
123
 
123
124
  def self.base_uri
124
- @@base_uri
125
- end
126
-
127
- def self.base_uri=(uri)
128
- @@base_uri = uri
125
+ @base_uri
129
126
  end
130
127
  end