beanie 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +4 -0
  3. data/README.md +79 -16
  4. data/Rakefile +8 -1
  5. data/beanie.gemspec +44 -25
  6. data/docs/BankAccount.md +24 -0
  7. data/docs/BankAccountApi.md +154 -0
  8. data/docs/BankAccountInput.md +24 -0
  9. data/docs/ErrorModel.md +9 -0
  10. data/git_push.sh +55 -0
  11. data/lib/beanie/api/bank_account_api.rb +183 -0
  12. data/lib/beanie/api_client.rb +388 -0
  13. data/lib/beanie/api_error.rb +38 -0
  14. data/lib/beanie/configuration.rb +202 -0
  15. data/lib/beanie/models/bank_account.rb +358 -0
  16. data/lib/beanie/models/bank_account_input.rb +357 -0
  17. data/lib/beanie/models/error_model.rb +202 -0
  18. data/lib/beanie/version.rb +13 -30
  19. data/lib/beanie.rb +32 -115
  20. data/spec/api/bank_account_api_spec.rb +71 -0
  21. data/spec/api_client_spec.rb +226 -0
  22. data/spec/configuration_spec.rb +42 -0
  23. data/spec/models/bank_account_input_spec.rb +137 -0
  24. data/spec/models/bank_account_spec.rb +137 -0
  25. data/spec/models/error_model_spec.rb +47 -0
  26. data/spec/spec_helper.rb +111 -0
  27. metadata +174 -71
  28. data/.gitignore +0 -17
  29. data/VERSION +0 -1
  30. data/lib/beanie/api.rb +0 -182
  31. data/lib/beanie/bank_account.rb +0 -44
  32. data/lib/beanie/bank_statement.rb +0 -45
  33. data/lib/beanie/bank_statement_data.rb +0 -51
  34. data/lib/beanie/beanie_alert.rb +0 -66
  35. data/lib/beanie/bill_of_material.rb +0 -44
  36. data/lib/beanie/billable.rb +0 -46
  37. data/lib/beanie/bom_item.rb +0 -44
  38. data/lib/beanie/company.rb +0 -66
  39. data/lib/beanie/company_member.rb +0 -43
  40. data/lib/beanie/config_type.rb +0 -62
  41. data/lib/beanie/config_value.rb +0 -42
  42. data/lib/beanie/customer.rb +0 -51
  43. data/lib/beanie/customer_address.rb +0 -63
  44. data/lib/beanie/customer_note.rb +0 -42
  45. data/lib/beanie/document.rb +0 -71
  46. data/lib/beanie/fixed_asset.rb +0 -45
  47. data/lib/beanie/journal.rb +0 -44
  48. data/lib/beanie/journal_item.rb +0 -44
  49. data/lib/beanie/nominal_account.rb +0 -73
  50. data/lib/beanie/nominal_account_category.rb +0 -49
  51. data/lib/beanie/product.rb +0 -52
  52. data/lib/beanie/product_category.rb +0 -43
  53. data/lib/beanie/product_price.rb +0 -44
  54. data/lib/beanie/production_order.rb +0 -76
  55. data/lib/beanie/purchase_invoice.rb +0 -55
  56. data/lib/beanie/purchase_order.rb +0 -46
  57. data/lib/beanie/purchase_order_item.rb +0 -60
  58. data/lib/beanie/sales_invoice.rb +0 -83
  59. data/lib/beanie/sales_invoice_item.rb +0 -50
  60. data/lib/beanie/sales_order.rb +0 -74
  61. data/lib/beanie/sales_order_item.rb +0 -126
  62. data/lib/beanie/stock_adjustment.rb +0 -70
  63. data/lib/beanie/stock_category.rb +0 -44
  64. data/lib/beanie/stock_item.rb +0 -58
  65. data/lib/beanie/stock_location.rb +0 -42
  66. data/lib/beanie/stock_supplier.rb +0 -48
  67. data/lib/beanie/supplier.rb +0 -48
  68. data/lib/beanie/supplier_address.rb +0 -53
  69. data/lib/beanie/supplier_note.rb +0 -42
  70. data/lib/beanie/tax_registration.rb +0 -59
  71. data/lib/beanie/vat_record.rb +0 -66
  72. data/lib/beanie/vat_return.rb +0 -60
  73. data/lib/beanie/work_centre.rb +0 -99
  74. data/lib/beanie/work_centre_group.rb +0 -50
@@ -1,48 +0,0 @@
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 Supplier < Api
32
- attr_accessor :id, :balance, :state, :supplier_vat, :terms, :lead_time, :minimum_order_amount
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
47
- end
48
- end
@@ -1,53 +0,0 @@
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
@@ -1,42 +0,0 @@
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 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
41
- end
42
- end
@@ -1,59 +0,0 @@
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 TaxRegistration < Api
32
- attr_accessor :id, :tax_type, :number, :nominal_account_id
33
-
34
- TAX_TYPE_CORPORATE = 0
35
- TAX_TYPE_SALES = 1
36
- TAX_TYPE_PAYROLL = 2
37
-
38
- TAX_TYPE_NAMES = [
39
- ["Corporation Tax", TAX_TYPE_CORPORATE],
40
- ["VAT", TAX_TYPE_SALES],
41
- ["PAYE", TAX_TYPE_PAYROLL]
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
52
-
53
- #
54
- # Tax Type as a name
55
- def tax_type_name
56
- TAX_TYPE_NAMES[tax_type][0]
57
- end
58
- end
59
- end
@@ -1,66 +0,0 @@
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 VatRecord < Api
32
- attr_accessor :id, :amount, :record_type, :vat_return_id, :sales_tax_rate
33
-
34
- TYPE_SALES = 0
35
- TYPE_PURCHASES = 1
36
- TYPE_GOODS_FROM = 2
37
- TYPE_GOODS_TO = 3
38
- TYPE_SERVICES_FROM = 4
39
- TYPE_SERVICES_TO = 5
40
-
41
- TYPE_NAMES = [
42
- ["Sales", TYPE_SALES],
43
- ["Purchases", TYPE_PURCHASES],
44
- ["Goods From", TYPE_GOODS_FROM],
45
- ["Goods To", TYPE_GOODS_TO],
46
- ["Services From", TYPE_SERVICES_FROM],
47
- ["Services To", TYPE_SERVICES_TO]
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
59
-
60
- #
61
- # Conver the record type into a string
62
- def record_type_name
63
- TYPE_NAMES[self.record_type][0]
64
- end
65
- end
66
- end
@@ -1,60 +0,0 @@
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 VatReturn < Api
32
- attr_accessor :id, :start_date, :end_date, :return_type, :purchase, :sales
33
- attr_accessor :goods_from, :goods_to, :services_from, :services_to
34
-
35
- RETURN_TYPE_ORIGINAL = 0
36
- RETURN_TYPE_SUPPLEMENTARY = 1
37
- RETURN_TYPE_AMENDED = 2
38
-
39
- RETURN_TYPES = [
40
- ["Original Return", RETURN_TYPE_ORIGINAL],
41
- ["Supplementary Return", RETURN_TYPE_SUPPLEMENTARY],
42
- ["Amended Return", RETURN_TYPE_AMENDED]
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
59
- end
60
- end
@@ -1,99 +0,0 @@
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 WorkCentre < Api
32
- attr_accessor :id, :name, :state, :location, :description, :work_centre_group_id
33
-
34
- STATE_UNKNOWN = 0
35
- STATE_DONE = 1
36
- STATE_CANCELLED = 2
37
- STATE_DELETED = 3
38
- STATE_MAINTENANCE = 4
39
- STATE_OFFLINE = 5
40
- STATE_READY = 6
41
- STATE_BUSY = 7
42
- STATE_FINISHED = 8
43
-
44
- STATE_NAMES = [
45
- ["Unknown State", STATE_UNKNOWN],
46
- ["Done", STATE_DONE],
47
- ["Cancelled", STATE_CANCELLED],
48
- ["* DELETED *", STATE_DELETED],
49
- ["Maintenance Mode", STATE_MAINTENANCE],
50
- ["Offline (Unavailable)", STATE_OFFLINE],
51
- ["Ready for Work", STATE_READY],
52
- ["Working (Busy)", STATE_BUSY],
53
- ["Work Completed", STATE_FINISHED]
54
- ].freeze
55
-
56
- #
57
- # Initialize instance variables
58
- def initialize
59
- @id = nil
60
- @name = nil
61
- @state = nil
62
- @location = nil
63
- @description = nil
64
- @work_centre_group_id = nil
65
- end
66
-
67
- #
68
- # State name
69
- def state_name
70
- STATE_NAMES[@state][0]
71
- end
72
-
73
- #
74
- # Get the private data
75
- def private_data
76
- response = WorkCentre.get(:url => "/work_centres/#{@id}/private_data")
77
- response["data"]
78
- end
79
-
80
- #
81
- # Update/set the private data
82
- def private_data=(data)
83
- pdata = {:data => data}
84
- response = WorkCentre.post(pdata, :url => "/work_centres/#{@id}/private_data")
85
- end
86
-
87
- #
88
- # Construct the path a little differently...
89
- def construct_path(opts = {})
90
- if opts[:work_centre_group_id]
91
- path = "/work_centre_groups/#{opts[:work_centre_group_id]}/work_centres"
92
- opts.delete(:work_centre_group_id)
93
- else
94
- path = "/work_centres"
95
- end
96
- path
97
- end
98
- end
99
- end
@@ -1,50 +0,0 @@
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 WorkCentreGroup < Api
32
- attr_accessor :id, :code, :name, :description
33
-
34
- #
35
- # Initialize instance variables
36
- def initialize
37
- @id = nil
38
- @code = nil
39
- @name = nil
40
- @description = nil
41
- end
42
-
43
- #
44
- # Find a work centre group by code
45
- def self.find_by_code(code)
46
- data = self.get(:code => code)
47
- new.populate(data['work_centre_group'])
48
- end
49
- end
50
- end