lws 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lws.rb +4 -3
- data/lib/lws/corporate_website.rb +146 -0
- data/lib/lws/ticket.rb +291 -0
- data/lib/lws/version.rb +1 -1
- data/lws.gemspec +3 -0
- data/test/test_corporate_website.rb +43 -0
- data/test/test_maps.rb +3 -3
- data/test/test_ticket.rb +114 -0
- metadata +56 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b969aadcfad9114a6722187025085da9bfa790a
|
4
|
+
data.tar.gz: 6510db848490ffd905cbb1be0e1b4e6f712cdc67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36a27f03ed2e17b4e14cb46e799849a35604e4803c2c80475c40de1e6d9ce7d1f7ce1266209036748162272aa6aab824860e3a6c310c4e749b2dac0aae659ef
|
7
|
+
data.tar.gz: ba360a7a0e62573b48ee036b622e5cf5a46b56bd83ee5d935fa02d141ef8d1de9a5599c11944c01736b245fcef71d11f8997deba3b31d457ebe57c8050c57494
|
data/lib/lws.rb
CHANGED
@@ -30,7 +30,8 @@ module LWS
|
|
30
30
|
|
31
31
|
# The list of supported apps (web service libraries) loaded by
|
32
32
|
# {.setup}.
|
33
|
-
SUPPORTED_APPS = [:generic, :auth, :maps, :presence
|
33
|
+
SUPPORTED_APPS = [:generic, :auth, :corporate_website, :maps, :presence,
|
34
|
+
:ticket]
|
34
35
|
|
35
36
|
# @!visibility private
|
36
37
|
class HTTPLogger < Faraday::Response::Middleware
|
@@ -213,7 +214,7 @@ module LWS
|
|
213
214
|
app_module_path = File.dirname(__FILE__)
|
214
215
|
SUPPORTED_APPS.each do |app_name|
|
215
216
|
load "#{app_module_path}/lws/#{app_name}.rb"
|
216
|
-
@app_modules[app_name] = LWS.const_get(app_name.to_s.
|
217
|
+
@app_modules[app_name] = LWS.const_get(app_name.to_s.camelize)
|
217
218
|
end
|
218
219
|
end
|
219
220
|
|
@@ -231,7 +232,7 @@ module LWS
|
|
231
232
|
|
232
233
|
# Returns the app module for the given app name.
|
233
234
|
#
|
234
|
-
# @param [String, Symbol] the app name
|
235
|
+
# @param app_name [String, Symbol] the app name
|
235
236
|
# @return [Module] the app module
|
236
237
|
def self.app_module(app_name)
|
237
238
|
@app_modules[app_name.to_sym]
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# = The corporate website app module
|
2
|
+
#
|
3
|
+
# Copyright © 2016 LeftClick B.V.
|
4
|
+
#
|
5
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
6
|
+
# and/or modified without permission. The software or any of its parts
|
7
|
+
# cannot be used for any other purposes than the LeftClick services and
|
8
|
+
# only during a valid license subscription. For more information, please
|
9
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
10
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
11
|
+
|
12
|
+
module LWS::CorporateWebsite
|
13
|
+
|
14
|
+
unless defined? ENDPOINT
|
15
|
+
# The API endpoint for the corporate website app
|
16
|
+
ENDPOINT = { production: "https://www.leftclick.cloud/",
|
17
|
+
development: "https://www-dev.leftclick.cloud/" }
|
18
|
+
end
|
19
|
+
|
20
|
+
#@!visibility private
|
21
|
+
def self.api
|
22
|
+
LWS.setup_api(LWS.config.endpoints[:corporate_website] ||
|
23
|
+
ENDPOINT[LWS.config.environment])
|
24
|
+
end
|
25
|
+
|
26
|
+
### Generic classes
|
27
|
+
|
28
|
+
# (see Generic::Configuration)
|
29
|
+
class Configuration < LWS::Generic::Configuration
|
30
|
+
use_api LWS::CorporateWebsite.api
|
31
|
+
end
|
32
|
+
|
33
|
+
# (see Generic::Task)
|
34
|
+
class Task < LWS::Generic::Task
|
35
|
+
use_api LWS::CorporateWebsite.api
|
36
|
+
end
|
37
|
+
|
38
|
+
### App specific classes
|
39
|
+
|
40
|
+
# = The article class
|
41
|
+
class Article < LWS::Generic::Model
|
42
|
+
use_api LWS::CorporateWebsite.api
|
43
|
+
|
44
|
+
#@!attribute id [r]
|
45
|
+
# @return [Fixnum] the (unique) ID of the article
|
46
|
+
|
47
|
+
#@!attribute body
|
48
|
+
# @return [String] the body of the article
|
49
|
+
|
50
|
+
#@!attribute key
|
51
|
+
# @return [String] the (page) key of the article
|
52
|
+
|
53
|
+
#@!attribute language
|
54
|
+
# @return [String] the ID of the language of the article (2 character)
|
55
|
+
|
56
|
+
#@!attribute news
|
57
|
+
# @return [Boolean] flag whether the article is a news article
|
58
|
+
|
59
|
+
#@!attribute sitemap
|
60
|
+
# @return [Boolean] flag whether the article is included in the sitemap
|
61
|
+
|
62
|
+
#@!attribute layout
|
63
|
+
# @return [String] the layout used for the article
|
64
|
+
|
65
|
+
#@!attribute menu_key
|
66
|
+
# @return [String] the key of menu the article belongs to
|
67
|
+
|
68
|
+
#@!attribute order
|
69
|
+
# @return [Fixnum] the order (number) of the article withing the page
|
70
|
+
|
71
|
+
#@!attribute picture
|
72
|
+
# @return [String] the path to the picture accompanying the article
|
73
|
+
|
74
|
+
#@!attribute picture_caption
|
75
|
+
# @return [String] the caption for the picture accompanying the article
|
76
|
+
|
77
|
+
#@!attribute picture_url
|
78
|
+
# @return [String] the URL to the picture accompanying the article
|
79
|
+
|
80
|
+
#@!attribute social_avatar
|
81
|
+
# @return [String] the path to the social avatar accompanying the article
|
82
|
+
|
83
|
+
#@!attribute social_avatar_url
|
84
|
+
# @return [String] the URL to the social avatar accompanying the article
|
85
|
+
|
86
|
+
#@!attribute social_location
|
87
|
+
# @return [String] the location of the social user accompanying the article
|
88
|
+
|
89
|
+
#@!attribute social_name
|
90
|
+
# @return [String] the name of the social user accompanying the article
|
91
|
+
|
92
|
+
#@!attribute social_text
|
93
|
+
# @return [String] the text of the social user accompanying the article
|
94
|
+
|
95
|
+
#@!attribute title
|
96
|
+
# @return [String] the title of the article
|
97
|
+
|
98
|
+
#@!attribute created_at
|
99
|
+
# @return [String] the timestamp of when the article was created
|
100
|
+
|
101
|
+
#@!attribute updated_at
|
102
|
+
# @return [String] the timestamp of when the article was last updated
|
103
|
+
|
104
|
+
def initialize(attrs = {})
|
105
|
+
super
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# = The opening hours class
|
110
|
+
class OfficeTime < LWS::Generic::Model
|
111
|
+
use_api LWS::CorporateWebsite.api
|
112
|
+
|
113
|
+
#@!attribute id [r]
|
114
|
+
# @return [Fixnum] the (unique) ID of the office time
|
115
|
+
|
116
|
+
#@!attribute announce
|
117
|
+
# @return [String] the date when the special office times need to be
|
118
|
+
# announced on
|
119
|
+
|
120
|
+
#@!attribute display_text
|
121
|
+
# @return [String] the displayed text of the special office time
|
122
|
+
|
123
|
+
#@!attribute language
|
124
|
+
# @return [String] the ID of the language the office time is for (2 characters)
|
125
|
+
|
126
|
+
#@!attribute motive
|
127
|
+
# @return [String] the special office time motive/key
|
128
|
+
|
129
|
+
#@!attribute start
|
130
|
+
# @return [String] the start date/time of the special office times
|
131
|
+
|
132
|
+
#@!attribute end
|
133
|
+
# @return [String] the end date/time of the special office times
|
134
|
+
|
135
|
+
#@!attribute created_at
|
136
|
+
# @return [String] the timestamp of when the office time was created
|
137
|
+
|
138
|
+
#@!attribute updated_at
|
139
|
+
# @return [String] the timestamp of when the office time was last updated
|
140
|
+
|
141
|
+
def initialize(attrs={})
|
142
|
+
super
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
data/lib/lws/ticket.rb
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
# = The ticket app module
|
2
|
+
#
|
3
|
+
# Copyright © 2016 LeftClick B.V.
|
4
|
+
#
|
5
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
6
|
+
# and/or modified without permission. The software or any of its parts
|
7
|
+
# cannot be used for any other purposes than the LeftClick services and
|
8
|
+
# only during a valid license subscription. For more information, please
|
9
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
10
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
11
|
+
|
12
|
+
module LWS::Ticket
|
13
|
+
|
14
|
+
unless defined? ENDPOINT
|
15
|
+
# The API endpoint for the ticket app
|
16
|
+
ENDPOINT = { production: "https://ticket.leftclick.cloud/",
|
17
|
+
development: "https://ticket-dev.leftclick.cloud/" }
|
18
|
+
end
|
19
|
+
|
20
|
+
#@!visibility private
|
21
|
+
def self.api
|
22
|
+
LWS.setup_api(LWS.config.endpoints[:ticket] ||
|
23
|
+
ENDPOINT[LWS.config.environment])
|
24
|
+
end
|
25
|
+
|
26
|
+
### Generic classes
|
27
|
+
|
28
|
+
# (see Generic::Configuration)
|
29
|
+
class Configuration < LWS::Generic::Configuration
|
30
|
+
use_api LWS::Ticket.api
|
31
|
+
end
|
32
|
+
|
33
|
+
# (see Generic::Task)
|
34
|
+
class Task < LWS::Generic::Task
|
35
|
+
use_api LWS::Ticket.api
|
36
|
+
end
|
37
|
+
|
38
|
+
### App specific classes
|
39
|
+
|
40
|
+
# = The ticket class
|
41
|
+
class Ticket < LWS::Generic::Model
|
42
|
+
use_api LWS::Ticket.api
|
43
|
+
|
44
|
+
#@!attribute id [r]
|
45
|
+
# @return [Fixnum] the (unique) ID of the ticket
|
46
|
+
|
47
|
+
#@!attribute account
|
48
|
+
# @return [LWS::Auth::Account] the account of the user that created the
|
49
|
+
# ticket
|
50
|
+
belongs_to :account, class_name: "LWS::Auth::Account"
|
51
|
+
|
52
|
+
#@!attribute account_id
|
53
|
+
# @return [Fixnum] the ID of the account of the user that created the
|
54
|
+
# ticket
|
55
|
+
|
56
|
+
#@!attribute assignee
|
57
|
+
# @return [LWS::Auth::Account] the account of the user that the ticket
|
58
|
+
# is assigned to
|
59
|
+
belongs_to :assignee, class_name: "LWS::Auth::Account"
|
60
|
+
|
61
|
+
#@!attribute assignee_id
|
62
|
+
# @return [Fixnum] the ID of the account of the user that the ticket
|
63
|
+
# is assigned to
|
64
|
+
|
65
|
+
#@!attribute company
|
66
|
+
# @return [LWS::Auth::Company] the company of the user that created
|
67
|
+
# the ticket
|
68
|
+
belongs_to :company, class_name: "LWS::Auth::Company"
|
69
|
+
|
70
|
+
#@!attribute company_id
|
71
|
+
# @return [Fixnum] the ID of the company of the user that created the
|
72
|
+
# ticket
|
73
|
+
|
74
|
+
#@!attribute description
|
75
|
+
# @return [String] the description (body) of the ticket
|
76
|
+
|
77
|
+
#@!attribute display_name
|
78
|
+
# @return [String] the name of the object the ticket is created for
|
79
|
+
|
80
|
+
#@!attribute due_date
|
81
|
+
# @return [String] the timestamp of when the ticket is due
|
82
|
+
|
83
|
+
#@!attribute group
|
84
|
+
# @return [String] the group (e.g. department/ticket type) the ticket
|
85
|
+
# belongs to
|
86
|
+
belongs_to :group
|
87
|
+
|
88
|
+
#@!attribute group_id
|
89
|
+
# @return [Fixnum] the ID of the group the ticket belongs to
|
90
|
+
|
91
|
+
#@!attribute messages
|
92
|
+
# @return [Array<Message>] the messages associated with the ticket
|
93
|
+
has_many :messages
|
94
|
+
|
95
|
+
#@!attribute owner
|
96
|
+
# @return [LWS::Auth::Company] the company that is currently handling
|
97
|
+
# the ticket
|
98
|
+
belongs_to :owner, class_name: "LWS::Auth::Company"
|
99
|
+
|
100
|
+
#@!attribute owner_id
|
101
|
+
# @return [Fixnum] the ID of the company that is currently handling
|
102
|
+
# the ticket
|
103
|
+
|
104
|
+
#@!attribute priority
|
105
|
+
# @return [Fixnum] the priority (ID) of the ticket
|
106
|
+
|
107
|
+
#@!attribute status
|
108
|
+
# @return [Fixnum] the current ticket status (ID)
|
109
|
+
|
110
|
+
#@!attribute tags
|
111
|
+
# @return [Array<Tag>] the tags associated with the ticket
|
112
|
+
has_many :tags
|
113
|
+
|
114
|
+
#@!attribute target
|
115
|
+
# The target is a string that consists of three parts joined by a dot.
|
116
|
+
# It is the name of the app, followed by the model name, followed
|
117
|
+
# by the model ID. This can be resolved into the object the ticket
|
118
|
+
# is created for/on.
|
119
|
+
#
|
120
|
+
# @return [String] the target of the ticket
|
121
|
+
|
122
|
+
#@!attribute title
|
123
|
+
# @return [String] the title (short description) of the ticket
|
124
|
+
|
125
|
+
#@!attribute created_at
|
126
|
+
# @return [String] the timestamp of when the ticket was created
|
127
|
+
|
128
|
+
#@!attribute updated_at
|
129
|
+
# @return [String] the timestamp of when the ticket was last updated
|
130
|
+
|
131
|
+
def initialize(attrs={})
|
132
|
+
super
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# = The ticket message class
|
137
|
+
class Message < LWS::Generic::Model
|
138
|
+
use_api LWS::Ticket.api
|
139
|
+
|
140
|
+
#@!attribute id [r]
|
141
|
+
# @return [Fixnum] the (unique) ID of the ticket message
|
142
|
+
|
143
|
+
#@!attribute account
|
144
|
+
# @return [LWS::Auth::Account] the account of the user that created the
|
145
|
+
# ticket message
|
146
|
+
belongs_to :account, class_name: "LWS::Auth::Account"
|
147
|
+
|
148
|
+
#@!attribute account_id
|
149
|
+
# @return [Fixnum] the ID of the account of the user that created the
|
150
|
+
# ticket message
|
151
|
+
|
152
|
+
#@!attribute attachments
|
153
|
+
# @return [Array<Attachment>] the attachments associated with the ticket
|
154
|
+
# message
|
155
|
+
has_many :attachments
|
156
|
+
|
157
|
+
#@!attribute company
|
158
|
+
# @return [LWS::Auth::Company] the company of the user that created
|
159
|
+
# the ticket message
|
160
|
+
belongs_to :company, class_name: "LWS::Auth::Company"
|
161
|
+
|
162
|
+
#@!attribute company_id
|
163
|
+
# @return [Fixnum] the ID of the company of the user that created the
|
164
|
+
# ticket message
|
165
|
+
|
166
|
+
#@!attribute message
|
167
|
+
# @return [String] the ticket message body
|
168
|
+
|
169
|
+
#@!attribute status
|
170
|
+
# @return [Fixnum] the new ticket status (ID) set by the message
|
171
|
+
|
172
|
+
#@!attribute ticket
|
173
|
+
# @return [Ticket] the ticket associated with the message
|
174
|
+
belongs_to :ticket
|
175
|
+
|
176
|
+
#@!attribute ticket_id
|
177
|
+
# @return [Fixnum] the ID of the ticket associated with the message
|
178
|
+
|
179
|
+
#@!attribute created_at
|
180
|
+
# @return [String] the timestamp of when the ticket message was created
|
181
|
+
|
182
|
+
#@!attribute updated_at
|
183
|
+
# @return [String] the timestamp of when the ticket message was last
|
184
|
+
# updated
|
185
|
+
|
186
|
+
def initialize(attrs={})
|
187
|
+
super
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# = The ticket message attachment class
|
192
|
+
class Attachment < LWS::Generic::Model
|
193
|
+
use_api LWS::Ticket.api
|
194
|
+
|
195
|
+
#@!attribute id [r]
|
196
|
+
# @return [Fixnum] the (unique) ID of the ticket message attachment
|
197
|
+
|
198
|
+
#@!attribute av_scanned_at
|
199
|
+
# @return [String] the timestamp of when an anti-virus scan on the attached
|
200
|
+
# file was performed
|
201
|
+
|
202
|
+
#@!attribute message
|
203
|
+
# @return [Message] the ticket message associated with the attachment
|
204
|
+
belongs_to :message
|
205
|
+
|
206
|
+
#@!attribute message_id
|
207
|
+
# @return [Fixnum] the ID of the ticket message associated with the
|
208
|
+
# attachment
|
209
|
+
|
210
|
+
#@!attribute name
|
211
|
+
# @return [String] the name of the attachment
|
212
|
+
|
213
|
+
#@!attribute size
|
214
|
+
# @return [Fixnum] the size of the attachment (bytes)
|
215
|
+
|
216
|
+
#@!attribute text
|
217
|
+
# @return [String] the file object attached
|
218
|
+
|
219
|
+
#@!attribute created_at
|
220
|
+
# @return [String] the timestamp of when the ticket message attachment
|
221
|
+
# was created
|
222
|
+
|
223
|
+
#@!attribute updated_at
|
224
|
+
# @return [String] the timestamp of when the ticket message attachment
|
225
|
+
# was last updated
|
226
|
+
|
227
|
+
def initialize(attrs={})
|
228
|
+
super
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
# = The ticket group class
|
233
|
+
class Group < LWS::Generic::Model
|
234
|
+
use_api LWS::Ticket.api
|
235
|
+
|
236
|
+
#@!attribute id [r]
|
237
|
+
# @return [Fixnum] the (unique) ID of the ticket group
|
238
|
+
|
239
|
+
#@!attribute name
|
240
|
+
# @return [String] the name of the ticket group
|
241
|
+
|
242
|
+
#@!attribute slug
|
243
|
+
# @return [String] the slug of the ticket group
|
244
|
+
|
245
|
+
#@!attribute created_at
|
246
|
+
# @return [String] the timestamp of when the ticket group was created
|
247
|
+
|
248
|
+
#@!attribute updated_at
|
249
|
+
# @return [String] the timestamp of when the ticket group was last updated
|
250
|
+
|
251
|
+
def initialize(attrs={})
|
252
|
+
super
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# = The ticket tag class
|
257
|
+
class Tag < LWS::Generic::Model
|
258
|
+
use_api LWS::Ticket.api
|
259
|
+
|
260
|
+
#@!attribute id [r]
|
261
|
+
# @return [Fixnum] the (unique) ID of the ticket tag
|
262
|
+
|
263
|
+
#@!attribute description
|
264
|
+
# @return [String] the description of the ticket tag
|
265
|
+
|
266
|
+
#@!attribute dev_issue_id
|
267
|
+
# @return [Fixnum] the ID of the issue in LeftClick's internal bug
|
268
|
+
# tracking system
|
269
|
+
|
270
|
+
#@!attribute name
|
271
|
+
# @return [String] the name of the ticket tag
|
272
|
+
|
273
|
+
#@!attribute slug
|
274
|
+
# @return [String] the slug of the ticket tag
|
275
|
+
|
276
|
+
#@!attribute ticket
|
277
|
+
# @return [Ticket] the ticket associated with the tag
|
278
|
+
belongs_to :ticket
|
279
|
+
|
280
|
+
#@!attribute created_at
|
281
|
+
# @return [String] the timestamp of when the ticket tag was created
|
282
|
+
|
283
|
+
#@!attribute updated_at
|
284
|
+
# @return [String] the timestamp of when the ticket tag was last updated
|
285
|
+
|
286
|
+
def initialize(attrs={})
|
287
|
+
super
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
data/lib/lws/version.rb
CHANGED
data/lws.gemspec
CHANGED
@@ -15,11 +15,14 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.add_runtime_dependency "faraday_middleware", ">= 0.10.0", "< 1.0"
|
16
16
|
s.add_runtime_dependency 'hashie'
|
17
17
|
s.add_runtime_dependency 'her', '~> 0.8.2'
|
18
|
+
s.add_runtime_dependency 'multi_json'
|
18
19
|
s.add_runtime_dependency 'webmock', '~> 2.1.0'
|
19
20
|
|
21
|
+
s.add_development_dependency "faraday_middleware", ">= 0.10.0", "< 1.0"
|
20
22
|
s.add_development_dependency 'hashie'
|
21
23
|
s.add_development_dependency 'her', '~> 0.8.1'
|
22
24
|
s.add_development_dependency 'minitest'
|
25
|
+
s.add_development_dependency 'multi_json'
|
23
26
|
s.add_development_dependency 'rake', '~> 0.9.2'
|
24
27
|
|
25
28
|
s.files = `git ls-files`.split("\n")
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
3
|
+
#
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
7
|
+
# only during a valid license subscription. For more information, please
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
10
|
+
|
11
|
+
require "test_helper"
|
12
|
+
|
13
|
+
class TestCorporateWebsiteArticle < MiniTest::Test
|
14
|
+
|
15
|
+
include LWS::CorporateWebsite
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@article = Article.all.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_valid_article
|
22
|
+
refute_nil(@article)
|
23
|
+
assert_instance_of(Article, @article)
|
24
|
+
refute_nil(@article.id)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
class TestCorporateWebsiteOfficeTime < MiniTest::Test
|
30
|
+
|
31
|
+
include LWS::CorporateWebsite
|
32
|
+
|
33
|
+
def setup
|
34
|
+
@office_time = OfficeTime.all.first
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_valid_office_time
|
38
|
+
refute_nil(@office_time)
|
39
|
+
assert_instance_of(OfficeTime, @office_time)
|
40
|
+
refute_nil(@office_time.id)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/test/test_maps.rb
CHANGED
@@ -42,9 +42,9 @@ class TestMapsMap < MiniTest::Test
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_valid_map
|
45
|
-
refute_nil(@
|
46
|
-
assert_instance_of(
|
47
|
-
refute_nil(@
|
45
|
+
refute_nil(@marker)
|
46
|
+
assert_instance_of(Marker, @marker)
|
47
|
+
refute_nil(@marker.id)
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_valid_map_associations
|
data/test/test_ticket.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
3
|
+
#
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
7
|
+
# only during a valid license subscription. For more information, please
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
10
|
+
|
11
|
+
require "test_helper"
|
12
|
+
|
13
|
+
class TestTicketTicket < MiniTest::Test
|
14
|
+
|
15
|
+
include LWS::Ticket
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@ticket = Ticket.all.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_valid_ticket
|
22
|
+
refute_nil(@ticket)
|
23
|
+
assert_instance_of(Ticket, @ticket)
|
24
|
+
refute_nil(@ticket.id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_valid_ticket_associations
|
28
|
+
assert_instance_of(LWS::Auth::Account, @ticket.account)
|
29
|
+
assert_instance_of(LWS::Auth::Account, @ticket.assignee)
|
30
|
+
assert_instance_of(LWS::Auth::Company, @ticket.company)
|
31
|
+
assert_instance_of(Group, @ticket.group)
|
32
|
+
assert_instance_of(Message, @ticket.messages.first)
|
33
|
+
# FIXME: Enable when tags are reachable through the API
|
34
|
+
#assert_instance_of(Tag, @ticket.tags.first)
|
35
|
+
assert_instance_of(LWS::Auth::Company, @ticket.owner)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
class TestTicketMessage < MiniTest::Test
|
41
|
+
|
42
|
+
include LWS::Ticket
|
43
|
+
|
44
|
+
def setup
|
45
|
+
@ticket = Ticket.all.first
|
46
|
+
# Messages only exist as child object op tickets
|
47
|
+
@message = @ticket.messages.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_valid_message
|
51
|
+
refute_nil(@message)
|
52
|
+
assert_instance_of(Message, @message)
|
53
|
+
refute_nil(@message.id)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_valid_message_associations
|
57
|
+
assert_instance_of(LWS::Auth::Account, @message.account)
|
58
|
+
assert_instance_of(LWS::Auth::Company, @message.company)
|
59
|
+
assert_instance_of(Ticket, @message.ticket)
|
60
|
+
assert_equal(@message.ticket, @ticket)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class TestTicketAttachment < MiniTest::Test
|
66
|
+
|
67
|
+
include LWS::Ticket
|
68
|
+
|
69
|
+
# FIXME: Implement the tests once the attachments can be reached through
|
70
|
+
# the API
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
class TestTicketGroup < MiniTest::Test
|
75
|
+
|
76
|
+
include LWS::Ticket
|
77
|
+
|
78
|
+
def setup
|
79
|
+
@group = Group.all.first
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_valid_group
|
83
|
+
refute_nil(@group)
|
84
|
+
assert_instance_of(Group, @group)
|
85
|
+
refute_nil(@group.id)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_valid_message_associations
|
89
|
+
# FIXME: Implement this test once tickets of a group and associated
|
90
|
+
# accounts with a group can be reached through the API
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
class TestTicketTag < MiniTest::Test
|
96
|
+
|
97
|
+
include LWS::Ticket
|
98
|
+
|
99
|
+
def setup
|
100
|
+
@tag = Tag.all.first
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_valid_tag
|
104
|
+
refute_nil(@tag)
|
105
|
+
assert_instance_of(Tag, @tag)
|
106
|
+
refute_nil(@tag.id)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_valid_tag_associations
|
110
|
+
# FIXME: Enable when tags are reachable through the API
|
111
|
+
#assert_instance_of(Ticket, @ticket)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeftClick B.V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 0.8.2
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: multi_json
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: webmock
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +86,26 @@ dependencies:
|
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: 2.1.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: faraday_middleware
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.10.0
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '1.0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.10.0
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1.0'
|
75
109
|
- !ruby/object:Gem::Dependency
|
76
110
|
name: hashie
|
77
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +148,20 @@ dependencies:
|
|
114
148
|
- - ">="
|
115
149
|
- !ruby/object:Gem::Version
|
116
150
|
version: '0'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: multi_json
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
117
165
|
- !ruby/object:Gem::Dependency
|
118
166
|
name: rake
|
119
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,10 +195,12 @@ files:
|
|
147
195
|
- copyright.txt
|
148
196
|
- lib/lws.rb
|
149
197
|
- lib/lws/auth.rb
|
198
|
+
- lib/lws/corporate_website.rb
|
150
199
|
- lib/lws/generic.rb
|
151
200
|
- lib/lws/maps.rb
|
152
201
|
- lib/lws/presence.rb
|
153
202
|
- lib/lws/stubbing.rb
|
203
|
+
- lib/lws/ticket.rb
|
154
204
|
- lib/lws/version.rb
|
155
205
|
- lws.gemspec
|
156
206
|
- test/fixtures/auth.yml
|
@@ -158,12 +208,14 @@ files:
|
|
158
208
|
- test/test_api_token_middleware.rb
|
159
209
|
- test/test_auth.rb
|
160
210
|
- test/test_caching.rb
|
211
|
+
- test/test_corporate_website.rb
|
161
212
|
- test/test_generic.rb
|
162
213
|
- test/test_helper.rb
|
163
214
|
- test/test_logger.rb
|
164
215
|
- test/test_maps.rb
|
165
216
|
- test/test_presence.rb
|
166
217
|
- test/test_stubbing.rb
|
218
|
+
- test/test_ticket.rb
|
167
219
|
homepage: https://leftclick.eu/
|
168
220
|
licenses: []
|
169
221
|
metadata: {}
|
@@ -193,9 +245,11 @@ test_files:
|
|
193
245
|
- test/test_api_token_middleware.rb
|
194
246
|
- test/test_auth.rb
|
195
247
|
- test/test_caching.rb
|
248
|
+
- test/test_corporate_website.rb
|
196
249
|
- test/test_generic.rb
|
197
250
|
- test/test_helper.rb
|
198
251
|
- test/test_logger.rb
|
199
252
|
- test/test_maps.rb
|
200
253
|
- test/test_presence.rb
|
201
254
|
- test/test_stubbing.rb
|
255
|
+
- test/test_ticket.rb
|