Blame view

README.md 4.78 KB
0c0af54a   Isaac Lewis   error handling; c...
1
  # syspro-ruby
31f9a345   Isaac Lewis   init; some tests
2
  
a381e465   Ryker Labbee   Update readme, in...
3
  Originally developed and maintained by Wildland Labs, syspro-ruby is an adapter gem to connect to SYSPRO 7 ERP installations. This gem can be used to connect to the SYSPRO 7 WCF Service and build Ruby applications on top of your SYSPRO data.
31f9a345   Isaac Lewis   init; some tests
4
5
6
7
8
9
  
  ## Installation
  
  Add this line to your application's Gemfile:
  
  ```ruby
8ba9739c   Ryker Labbee   Update readme wit...
10
  gem 'syspro-ruby', git: 'https://git.zom.io/labbeemint/syspro-ruby.git'
31f9a345   Isaac Lewis   init; some tests
11
12
13
14
  ```
  
  And then execute:
  
8ba9739c   Ryker Labbee   Update readme wit...
15
      $ bundle install
31f9a345   Isaac Lewis   init; some tests
16
17
18
  
  ## Usage
  
0c0af54a   Isaac Lewis   error handling; c...
19
20
21
22
23
24
25
26
27
  ### Utilities
  
  #### Logon
  
  ```rb
  user_id = Syspro::Logon.logon(username, password, company_id, company_password)
  ```
  `user_id` will be a `UserId` object that contains the `guid` supplied by SYSPRO. You will use this guid to make further requests to SYSPRO.
  
9a47698f   Isaac Lewis   typo
28
  #### GetLogonProfile
0c0af54a   Isaac Lewis   error handling; c...
29
30
  
  ```rb
9a47698f   Isaac Lewis   typo
31
  user_profile = Syspro::GetLogonProfile.get_logon_profile(guid)
0c0af54a   Isaac Lewis   error handling; c...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  ```
  `user_profile` will be a `UserProfile` object that contains the following:
    - `company_name`
    - `operator_code`
    - `operator_group`
    - `operator_email_address`
    - `operator_location`
    - `operator_language_code`
    - `system_language`
    - `accounting_date`
    - `company_date`
    - `default_ar_branch`
    - `default_ap_branch`
    - `default_bank`
    - `default_warehouse`
    - `default_customer`
    - `system_site_id`
    - `system_nationality_code`
    - `local_currency_code`
    - `currency_description`
    - `default_requisition_user`
    - `xml_to_html_transform`
    - `css_style`
    - `css_suffix`
    - `decimal_format`
    - `date_format`
    - `functional_role`
    - `database_type`
    - `syspro_version`
    - `enet_version`
    - `syspro_server_bit_width`
  
  #### Logoff
  
  ```rb
  logged_off = Syspro::Logoff.logoff(guid)
  ```
  `logged_off` will be `true` if the user has been successfully logged off, and will contain an error string if an error has occured.
31f9a345   Isaac Lewis   init; some tests
70
  
724c1cbe   Isaac Lewis   add to readme; fi...
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
  ### Query
  
  #### Browse
  Browse returns a paginated view of a particular table.
  
  This is an example using the generic Browse Business Object, `COMBRW`.
  ```rb
  combrw = Syspro::BusinessObject::ComBrw.new
  combrw.browse_name = "InvMaster"
  combrw.start_condition = ""
  combrw.return_rows = 5
  combrw.filters = []
  combrw.table_name = "InvMaster"
  combrw.title = "StockCodes"
  combrw.columns = [
    {name: "StockCode"}
  ]
  
  browse_result = combrw.call(user_id.guid)
  ```
  
  `browse_result` will be a BrowseObject, which has the following structure:
  
  ```rb
  {
    title: "Title",
    rows: [ { name: "", value: "", data_type: "" } ],
    next_prev_key:  { name: "", text: "" },
    header_details: { name: "", text: "" }
  }
  ```
  
  #### Query
  
  Query gives control over joins between multiple tables over a single Business Object.
  
  This is an example using the generic Query Business Object, `COMFND`.
  
  ```rb
  comfnd = Syspro::BusinessObjects::ComFnd.new
  comfnd.table_name = "InvMaster"
  comfnd.return_rows = 5
  comfnd.columns = [
    {
      name: "StockCode"
    }
  ]
  comfnd.expressions = [
    {
      andor: "And",
      column: "StockCode",
      condition: "EQ",
      value: "02"
    }
  ]
  comfnd.order_by = "StockCode"
  
  query_result = comfnd.call(user_id.guid)
  ```
  
  This will return a QueryObject, which looks like this:
  
  ```rb
  {
    header_details: { name: "", text: "" },
    rows: [ { name: "", value: "" } ],
    row_count: 1
  }
  ```
  
  #### Fetch
  
  Fetch selects the `TOP 1` of the query.
  
  This is an example using the generic Fetch Business Object, `COMFCH`.
  
  ```rb
  comfch = Syspro::BusinessObjects::ComFch.new
  comfch.table_name = "InvMaster"
  comfch.key = "02"
  comfch.optional_keys = []
  comfch.full_key_provided = false
  comfch.default_type = ""
  comfch.espresso_fetch = true
  
  fetch_result = comfch.call(user_id.guid)
  ```
  
  This will return a FetchObject, with the following structure:
  
  ```rb
  {
    table_name: "",
    columns: [ { name: "", value: "" } ]
  }
  ```
  
31f9a345   Isaac Lewis   init; some tests
168
169
  ## Development
  
87fd11a1   Isaac Lewis   reorg
170
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31f9a345   Isaac Lewis   init; some tests
171
172
173
174
175
  
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
  
  ## Contributing
  
bbf1c61a   Joe Weakley   Updated documenta...
176
177
  Run `bundle exec rake` and ensure everything looks good.
  
0c0af54a   Isaac Lewis   error handling; c...
178
  Bug reports and pull requests are welcome on GitHub at https://github.com/ike/syspro-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
31f9a345   Isaac Lewis   init; some tests
179
180
181
182
183
184
185
  
  ## License
  
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
  
  ## Code of Conduct
  
bbf1c61a   Joe Weakley   Updated documenta...
186
  Everyone interacting in the Syspro project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wildland/code-of-conduct).