shiftnote 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/shiftnote.rb +74 -17
- data/lib/shiftnote/days_of_week_shift.rb +8 -2
- data/lib/shiftnote/days_of_week_shifts.rb +5 -0
- data/lib/shiftnote/employee.rb +26 -0
- data/lib/shiftnote/schedule_this_week.rb +34 -0
- data/lib/shiftnote/shift.rb +144 -0
- data/lib/shiftnote/{employee_overview_view_model.rb → user.rb} +29 -7
- metadata +16 -6
- data/lib/shiftnote/schedule_this_week_view_model.rb +0 -19
- data/lib/shiftnote/shift_view_model.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24825e9ebbda63ba9faf0fd76c83750438962dbf410167c47fbc5ebe884020fe
|
4
|
+
data.tar.gz: 88e4cd763bf6a5cef2516eba9ccfccd9701c4fa48e3d5b8de3bbcf994f8e3705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24bd639a5fce56f0a580cc2ffb54ab868ef2ed52671b62632ba78d8425ef27383698b7f6a3a19ef2b8c0d0de42aa64f3e7077fc38d34868446ce321bda68b50f
|
7
|
+
data.tar.gz: 7dd67473ef2150cc5d821d8ee58335d047e7bdb03fd7235b1acef44fbb76002f51adfc1d0327f6c7c8aa1c5a198b3ce951992141b2d36e3454375f0541cbe37c
|
data/lib/shiftnote.rb
CHANGED
@@ -8,13 +8,18 @@ require 'rails'
|
|
8
8
|
|
9
9
|
# All ShiftNote functionality, whether extended or just here.
|
10
10
|
class ShiftNote
|
11
|
-
# Initialize a new ShiftNote variable, via
|
12
|
-
# @param
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
# Initialize a new ShiftNote variable, via login credentials.
|
12
|
+
# @param username [String] the username of the user.
|
13
|
+
# @param password [String] the password of the user.
|
14
|
+
def initialize(username: nil, password: nil)
|
15
|
+
@credentials = { username: username, password: password }
|
16
|
+
generate_cookie(username, password)
|
16
17
|
end
|
17
18
|
|
19
|
+
# Generate a cookie, based on login credentials.
|
20
|
+
# @param username [String] the username of the user.
|
21
|
+
# @param password [String] the password of the user.
|
22
|
+
# @return [String] the cookie!
|
18
23
|
def generate_cookie(username, password)
|
19
24
|
uri = URI.parse('https://ww1.shiftnote.com/login')
|
20
25
|
request = Net::HTTP::Post.new(uri)
|
@@ -41,9 +46,40 @@ class ShiftNote
|
|
41
46
|
@cookie = response.header['Set-Cookie']
|
42
47
|
end
|
43
48
|
|
44
|
-
#
|
45
|
-
#
|
46
|
-
|
49
|
+
# Useful method (for the gem that is) that gets rid of stuff we don't need.
|
50
|
+
# @!visibility private
|
51
|
+
# @param string [String] a string to scrape the junk off
|
52
|
+
def scrapejunk(string)
|
53
|
+
string.gsub('<script>', '').delete(';').gsub('</script>', '').gsub('window.scheduleMinebindings = ShiftNote.Bind(window.scheduleMinemodel)', '').gsub('window.scheduleMinemodel = ', '')
|
54
|
+
end
|
55
|
+
|
56
|
+
# Method to find the next instance of the given date.
|
57
|
+
# @!visibility private
|
58
|
+
# @param day [String] what day to find
|
59
|
+
def date_of_next(day)
|
60
|
+
date = Date.parse(day)
|
61
|
+
delta = date > Date.today ? 0 : 7
|
62
|
+
date + delta
|
63
|
+
end
|
64
|
+
|
65
|
+
# This is basically an API token.
|
66
|
+
# @return [String] the cookie of the authenticated user
|
67
|
+
def cookie
|
68
|
+
shiftnote = RestClient.get('https://ww1.shiftnote.com/BulletinBoard/', Cookie: @cookie)
|
69
|
+
|
70
|
+
doc = Nokogiri::HTML.parse(shiftnote.body)
|
71
|
+
|
72
|
+
begin
|
73
|
+
doc.search('div#MyScheduleDiv').at('script').text
|
74
|
+
rescue NoMethodError
|
75
|
+
generate_cookie(@credentials[:username], @credentials[:password])
|
76
|
+
end
|
77
|
+
@cookie
|
78
|
+
end
|
79
|
+
|
80
|
+
# Get the information of the currently logged in user.
|
81
|
+
# @return [User] the user
|
82
|
+
def user
|
47
83
|
shiftnote = RestClient.get('https://ww1.shiftnote.com/BulletinBoard/', Cookie: @cookie)
|
48
84
|
|
49
85
|
doc = Nokogiri::HTML.parse(shiftnote.body)
|
@@ -57,24 +93,45 @@ class ShiftNote
|
|
57
93
|
|
58
94
|
data = data.gsub('<script>', '').delete(';').gsub('</script>', '').gsub('window.scheduleMinebindings = ShiftNote.Bind(window.scheduleMinemodel)', '').gsub('window.scheduleMinemodel = ', '')
|
59
95
|
|
60
|
-
|
96
|
+
User.new(JSON.parse(data))
|
97
|
+
end
|
98
|
+
|
99
|
+
# Get an employee (by id)
|
100
|
+
# @param id [Integer] the id of the employee
|
101
|
+
def employee(id)
|
102
|
+
Employee.new(id: id)
|
61
103
|
end
|
62
104
|
|
63
|
-
# @param
|
64
|
-
|
65
|
-
|
66
|
-
|
105
|
+
# @param day [String] what day the week starts on.
|
106
|
+
# @return [ScheduleThisWeek] the schedule for next week.
|
107
|
+
def get_next_week_shifts(day = "Monday")
|
108
|
+
nextmonday = date_of_next(day)
|
109
|
+
|
110
|
+
week2 = RestClient.get("https://ww1.shiftnote.com/Schedules/ScheduleMine/?startDate=#{nextmonday.month}%2F#{nextmonday.day}%2F#{nextmonday.year}&noContainer=true&_=#{Time.now.to_i * 1000}", Cookie: cookie)
|
67
111
|
|
68
112
|
week2doc = Nokogiri::HTML.parse(week2.body)
|
69
113
|
dataweek2 = JSON.parse(scrapejunk(week2doc.at('script').text))
|
70
|
-
|
114
|
+
User.new(dataweek2).schedule_this_week
|
115
|
+
end
|
116
|
+
|
117
|
+
# Send a message to a user (or group of them)
|
118
|
+
# @param recipients [Array<Integer>] who will receive this message
|
119
|
+
def send_message(recipients, subject, body, urgent)
|
120
|
+
data = {
|
121
|
+
"ToUserIDs" => recipients,
|
122
|
+
"Subject" => subject,
|
123
|
+
"Body" => body,
|
124
|
+
"Priority" => urgent
|
125
|
+
}
|
126
|
+
RestClient.post('https://ww1.shiftnote.com/Message/SendMessages', URI.encode_www_form(data), Cookie: @cookie)
|
71
127
|
end
|
72
128
|
end
|
73
129
|
|
74
130
|
# Require files.
|
75
131
|
require_relative 'shiftnote/days_of_week_shift'
|
76
132
|
require_relative 'shiftnote/days_of_week_shifts'
|
77
|
-
require_relative 'shiftnote/
|
133
|
+
require_relative 'shiftnote/employee'
|
78
134
|
require_relative 'shiftnote/errors'
|
79
|
-
require_relative 'shiftnote/
|
80
|
-
require_relative 'shiftnote/
|
135
|
+
require_relative 'shiftnote/schedule_this_week'
|
136
|
+
require_relative 'shiftnote/shift'
|
137
|
+
require_relative 'shiftnote/user'
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# A specific day of a schedule.
|
1
2
|
class ShiftNote::DaysOfWeekShift
|
2
3
|
def initialize(data)
|
3
4
|
@raw = data
|
@@ -5,23 +6,28 @@ class ShiftNote::DaysOfWeekShift
|
|
5
6
|
@raw_shifts = data['Shifts']
|
6
7
|
end
|
7
8
|
|
9
|
+
# @return [Time] the day
|
8
10
|
attr_reader :date
|
9
11
|
|
12
|
+
# @return [Array<Shift>] the shifts this employee is working on this day.
|
10
13
|
def shifts
|
11
14
|
shifts = []
|
12
15
|
@raw_shifts.each do |e|
|
13
|
-
shifts.push ShiftNote::
|
16
|
+
shifts.push ShiftNote::Shift.new(e)
|
14
17
|
end
|
15
18
|
shifts
|
16
19
|
end
|
17
20
|
|
21
|
+
# @return [Integer] the amount shifts this employee is working on this day.
|
18
22
|
def amount_of_shifts
|
19
23
|
@raw_shifts.length
|
20
24
|
end
|
21
25
|
|
26
|
+
# @return [Shift] the first shift this employee is working on this day.
|
22
27
|
def first_shift
|
23
|
-
ShiftNote::
|
28
|
+
ShiftNote::Shift.new(@raw_shifts.first)
|
24
29
|
end
|
25
30
|
|
31
|
+
# @return [JSON] the raw data returned by ShiftNote.
|
26
32
|
attr_reader :raw
|
27
33
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# The days of the week, their shifts.
|
1
2
|
class ShiftNote::DaysOfWeekShifts
|
2
3
|
def initialize(data)
|
3
4
|
@data = data
|
4
5
|
end
|
5
6
|
|
7
|
+
# The days in this week, whether working or not.
|
8
|
+
# @return [Array<DaysOfWeekShift>] the days in this schedule.
|
6
9
|
def days
|
7
10
|
dayz = []
|
8
11
|
@data.each do |e|
|
@@ -11,6 +14,7 @@ class ShiftNote::DaysOfWeekShifts
|
|
11
14
|
dayz
|
12
15
|
end
|
13
16
|
|
17
|
+
# @return [Array<DaysOfWeekShift>] only the days this employee is working.
|
14
18
|
def working_days
|
15
19
|
dayz = []
|
16
20
|
@data.each do |e|
|
@@ -19,6 +23,7 @@ class ShiftNote::DaysOfWeekShifts
|
|
19
23
|
dayz
|
20
24
|
end
|
21
25
|
|
26
|
+
# @return [JSON] the raw data returned by ShiftNote
|
22
27
|
def raw
|
23
28
|
@data
|
24
29
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# An employee.
|
2
|
+
class ShiftNote::Employee
|
3
|
+
def initialize(id: nil)
|
4
|
+
@id = id
|
5
|
+
end
|
6
|
+
|
7
|
+
# @return [Integer] the ID of the employee
|
8
|
+
attr_reader :id
|
9
|
+
|
10
|
+
# Deletes this employee
|
11
|
+
# Quote from the site
|
12
|
+
# This employee may have scheduled shifts.
|
13
|
+
# You can choose to have these assigned shifts converted to house shifts if they are on a published schedule, and template shifts if they are on a draft schedule.
|
14
|
+
# If [false], you will have to manually reassign or delete any shifts assigned to this employee.
|
15
|
+
# [true] will convert assigned shifts to house and template shifts.
|
16
|
+
# @param convert_shifts [true, false] whether to convert these shifts
|
17
|
+
def delete(convert_shifts = false)
|
18
|
+
cooki = cookie
|
19
|
+
puts cooki
|
20
|
+
data = {
|
21
|
+
'EmployeeID' => @id,
|
22
|
+
'ConvertShifts' => convert_shifts,
|
23
|
+
'_' => Time.now.to_i * 1000
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# The schedule for this week.
|
2
|
+
class ShiftNote::ScheduleThisWeek
|
3
|
+
def initialize(data)
|
4
|
+
@raw = data
|
5
|
+
@start_date = Time.parse(data['StartDate'])
|
6
|
+
@end_date = Time.parse(data['EndDate'])
|
7
|
+
@hours = data['Hours']
|
8
|
+
@cost = data['Cost']
|
9
|
+
@shifts = data['Shifts']
|
10
|
+
@schedule = ShiftNote::DaysOfWeekShifts.new(data['DaysOfWeekShifts'])
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Time] the start date of the schedule.
|
14
|
+
attr_reader :start_date
|
15
|
+
|
16
|
+
# @return [Time] the end date of the schedule.
|
17
|
+
attr_reader :end_date
|
18
|
+
|
19
|
+
# @return [Float] the total hours this employee is working this schedule
|
20
|
+
attr_reader :hours
|
21
|
+
|
22
|
+
# The cost is simply hours * rate.
|
23
|
+
# @return [Float] the amount of pay the employee will receive
|
24
|
+
attr_reader :cost
|
25
|
+
|
26
|
+
# @return [Float] the amount of shifts this person has this week.
|
27
|
+
attr_reader :shifts
|
28
|
+
|
29
|
+
# @return [ShiftNote::DaysOfWeekShifts] the schedule for this week
|
30
|
+
attr_reader :schedule
|
31
|
+
|
32
|
+
# @return [JSON] the raw data returned by ShiftNote.
|
33
|
+
attr_reader :raw
|
34
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# A shift, on the schedule. Woah!
|
2
|
+
class ShiftNote::Shift
|
3
|
+
def initialize(data)
|
4
|
+
@raw = data
|
5
|
+
@schedule_id = data['ScheduleId']
|
6
|
+
@schedule_name = data['ScheduleName']
|
7
|
+
@schedule_status_id = data['ScheduleStatusId']
|
8
|
+
@shift_id = data['ShiftId']
|
9
|
+
@employee_id = data['EmployeeId']
|
10
|
+
@employee = data['Employee']
|
11
|
+
@shift_date = Time.parse(data['ShiftDate'])
|
12
|
+
@time_in = Time.parse(data['TimeIn'])
|
13
|
+
@time_out = Time.parse(data['TimeOut'])
|
14
|
+
@position = data['Position']
|
15
|
+
@position_color = data['PositionColor']
|
16
|
+
@internal_location = data['InternalLocation']
|
17
|
+
@open = data['Open']
|
18
|
+
@close = data['Close']
|
19
|
+
@on_call = data['OnCall']
|
20
|
+
@volume = data['Volume']
|
21
|
+
@note = data['Note']
|
22
|
+
@hours = data['Hours']
|
23
|
+
@cost = data['Cost']
|
24
|
+
@is_pending_pickup = data['IsPendingPickUp']
|
25
|
+
@is_pending_manager_approval = data['IsPendingManagerApproval']
|
26
|
+
@is_pending_swap = data['IsPendingSwap']
|
27
|
+
@is_pending_swap_manager_approval = data['IsPendingSwapManagerApproval']
|
28
|
+
@hide_end_times = data['HideEndTimes']
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Integer] the shift's schedule's ID.
|
32
|
+
attr_reader :schedule_id
|
33
|
+
|
34
|
+
# @return [String] the shift's schedule's name
|
35
|
+
attr_reader :schedule_name
|
36
|
+
|
37
|
+
# I have absolutely no idea what the IDs mean.
|
38
|
+
# @return [Integer] the shift's schedule's status ID.
|
39
|
+
attr_reader :schedule_status_id
|
40
|
+
|
41
|
+
# @return [Integer] the shift's ID.
|
42
|
+
attr_reader :shift_id
|
43
|
+
|
44
|
+
# @return [Integer] the employee working this shift's ID.
|
45
|
+
attr_reader :employee_id
|
46
|
+
|
47
|
+
# @return [String] the name of the employee working this Shift.
|
48
|
+
attr_reader :employee
|
49
|
+
|
50
|
+
# @return [Time] the date of this shift.
|
51
|
+
attr_reader :shift_date
|
52
|
+
|
53
|
+
# @return [Time] the time this employee should clock in.
|
54
|
+
attr_reader :time_in
|
55
|
+
|
56
|
+
# @return [Time] the time this employee should clock out.
|
57
|
+
attr_reader :time_out
|
58
|
+
|
59
|
+
# @return [String] the position this employee is working.
|
60
|
+
attr_reader :position
|
61
|
+
|
62
|
+
# Probably used on the website.
|
63
|
+
# @return [String] the color of this position this employee is working.
|
64
|
+
attr_reader :position_color
|
65
|
+
|
66
|
+
# @return [String] the internal location of this shift.
|
67
|
+
attr_reader :internal_location
|
68
|
+
|
69
|
+
# I don't know what this means. Do they open? Is the shift open? What!
|
70
|
+
# It's true or false though.
|
71
|
+
# @return [true, false]
|
72
|
+
attr_reader :open
|
73
|
+
|
74
|
+
# I don't know what this means.
|
75
|
+
# @return [true, false]
|
76
|
+
attr_reader :close
|
77
|
+
|
78
|
+
# I don't know what this means.
|
79
|
+
# @return [true, false]
|
80
|
+
attr_reader :on_call
|
81
|
+
|
82
|
+
# I don't know what this means.
|
83
|
+
# @return [true, false]
|
84
|
+
attr_reader :volume
|
85
|
+
|
86
|
+
# I don't know what this means.
|
87
|
+
# @return [String]
|
88
|
+
attr_reader :note
|
89
|
+
|
90
|
+
# @return [Float] the duration of this shift in hours.
|
91
|
+
attr_reader :hours
|
92
|
+
|
93
|
+
# @return [Float] the cost of this shift for the company
|
94
|
+
attr_reader :cost
|
95
|
+
|
96
|
+
# This is true if this shift is dropped.
|
97
|
+
# This is false if it's been picked up or never was dropped.
|
98
|
+
# @return [true, false] whether this shift is pending pickup
|
99
|
+
def pending_pickup?
|
100
|
+
@is_pending_pickup
|
101
|
+
end
|
102
|
+
|
103
|
+
# If the shift is waiting for the manager to approve it.
|
104
|
+
# @return [true, false] whether this shift is pending manager approval
|
105
|
+
def pending_manager_approval?
|
106
|
+
@is_pending_manager_approval
|
107
|
+
end
|
108
|
+
|
109
|
+
# When a shift is swapped with someone, it waits for them to accept or deny.
|
110
|
+
# Until that happens, this is true.
|
111
|
+
# @return [true, false] is the shift is pending swap.
|
112
|
+
def pending_swap?
|
113
|
+
@is_pending_swap
|
114
|
+
end
|
115
|
+
|
116
|
+
# When the shift swap is approved, the manager needs to approve it.
|
117
|
+
# Until this happens, this is true.
|
118
|
+
# @return [true, false] is the shift is pending swap manager approval.
|
119
|
+
def pending_swap_manager_approval?
|
120
|
+
@is_pending_swap_manager_approval
|
121
|
+
end
|
122
|
+
|
123
|
+
# I wonder what happens when this is true. Hopefully it doesn't break.
|
124
|
+
# @return [true, false] to hide the end time of the shift.
|
125
|
+
def hide_end_times?
|
126
|
+
@hide_end_times
|
127
|
+
end
|
128
|
+
|
129
|
+
# @return [JSON] the raw data returned by ShiftNote
|
130
|
+
attr_reader :raw
|
131
|
+
|
132
|
+
# Releases the shift to an employee.
|
133
|
+
# @param [Integer] the employee ID of the employee to drop this to, leave blank for everyone.
|
134
|
+
# @param [String] the reason for dropping this shift.
|
135
|
+
def release(employee = 0, reason = nil)
|
136
|
+
data = {
|
137
|
+
"ShiftID" => shift_id,
|
138
|
+
"ScheduleID" => schedule_id,
|
139
|
+
"EmployeeId" => employee,
|
140
|
+
"Reason" => reason,
|
141
|
+
"X-Requested-With" => "XMLHttpRequest"
|
142
|
+
}
|
143
|
+
end
|
144
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# An employee.
|
2
|
+
class ShiftNote::User < ShiftNote::Employee
|
2
3
|
def initialize(data)
|
3
4
|
@raw = data
|
4
5
|
@id = data['EmployeeId']
|
@@ -8,8 +9,8 @@ class ShiftNote::EmployeeOverviewViewModel
|
|
8
9
|
'mobile' => data['MobilePhone']
|
9
10
|
}
|
10
11
|
@email = data['Email']
|
11
|
-
@birthday = Time.parse(data['BirthDate'])
|
12
|
-
@schedule_this_week = ShiftNote::
|
12
|
+
@birthday = data['BirthDate'] ? Time.parse(data['BirthDate']) : nil
|
13
|
+
@schedule_this_week = ShiftNote::ScheduleThisWeek.new(data['ScheduleThisWeekViewModel'])
|
13
14
|
@trade_shifts = data['TradeShifts']
|
14
15
|
@trade_shifts_current_day = data['TradeShiftsCurrentDay']
|
15
16
|
@positions = data['ThisEmployeePositions']
|
@@ -36,12 +37,33 @@ class ShiftNote::EmployeeOverviewViewModel
|
|
36
37
|
attr_reader :birthday
|
37
38
|
|
38
39
|
# The user's "Schedule This Week," consider the return type for info
|
39
|
-
# @return [
|
40
|
+
# @return [ScheduleThisWeek]
|
40
41
|
attr_reader :schedule_this_week
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
# Trading (or swapping) means the employee can trade shifts with other employees.
|
44
|
+
# @return [true, false] if this employee can trade (or swap) shifts at all.
|
45
|
+
def trade_shifts?
|
46
|
+
@trade_shifts
|
47
|
+
end
|
48
|
+
|
49
|
+
alias_method :can_swap?, :trade_shifts?
|
50
|
+
|
51
|
+
# Assuming trade_shifts? is true, this method returns if the user can trade shifts
|
52
|
+
# for the given day. Where I work, this is false. Should've thought of that first, Billy.
|
53
|
+
# @return [true, false] if this employee can trade shifts for today's shifts.
|
54
|
+
def trade_shifts_current_day?
|
55
|
+
@trade_shifts_current_day
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [Array<String>] the positions this employee is working.
|
44
59
|
attr_reader :positions
|
60
|
+
|
61
|
+
# @return [Time, nil] the employee's last day, nil if they don't have one (good)
|
45
62
|
attr_reader :last_day
|
63
|
+
|
64
|
+
# @return [Time, nil] the employee's hire date, nil if they don't have one set
|
46
65
|
attr_reader :hire_day
|
66
|
+
|
67
|
+
# @return [JSON] the raw data returned by ShiftNote
|
68
|
+
attr_reader :raw
|
47
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiftnote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -61,20 +61,30 @@ files:
|
|
61
61
|
- lib/shiftnote.rb
|
62
62
|
- lib/shiftnote/days_of_week_shift.rb
|
63
63
|
- lib/shiftnote/days_of_week_shifts.rb
|
64
|
-
- lib/shiftnote/
|
64
|
+
- lib/shiftnote/employee.rb
|
65
65
|
- lib/shiftnote/errors.rb
|
66
|
-
- lib/shiftnote/
|
67
|
-
- lib/shiftnote/
|
66
|
+
- lib/shiftnote/schedule_this_week.rb
|
67
|
+
- lib/shiftnote/shift.rb
|
68
|
+
- lib/shiftnote/user.rb
|
68
69
|
homepage: https://github.com/Chew/ShiftNoteRB
|
69
70
|
licenses:
|
70
71
|
- MIT
|
71
72
|
metadata:
|
72
73
|
bug_tracker_uri: https://github.com/Chew/ShiftNoteRB/issues
|
73
74
|
changelog_uri: https://github.com/Chew/ShiftNoteRB/releases
|
75
|
+
documentation_uri: https://rubydocs.chew.pro/docs/shiftnote
|
74
76
|
homepage_uri: http://github.com/Chew/ShiftNoteRB
|
75
77
|
source_code_uri: http://github.com/Chew/ShiftNoteRB
|
76
78
|
wiki_uri: http://github.com/Chew/ShiftNoteRB/wiki
|
77
|
-
post_install_message:
|
79
|
+
post_install_message: |-
|
80
|
+
Hello! Thanks for using this ShiftNote gem. 0.2.0 introduced some major changes.
|
81
|
+
If this is your first version you can just ignore this message.
|
82
|
+
|
83
|
+
* ShiftNote#employee has been replaced with ShiftNote#user.
|
84
|
+
* "ViewModel" has been removed from all class names.
|
85
|
+
|
86
|
+
Check the documentation server (https://rubydocs.chew.pro/docs/shiftnote) and the GitHub Release (https://github.com/Chew/ShiftNoteRB/releases/tag/0.2.0) to see the full changes!
|
87
|
+
Enjoy :)
|
78
88
|
rdoc_options: []
|
79
89
|
require_paths:
|
80
90
|
- lib
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class ShiftNote::ScheduleThisWeekViewModel
|
2
|
-
def initialize(data)
|
3
|
-
@raw = data
|
4
|
-
@start_date = Time.parse(data['StartDate'])
|
5
|
-
@end_date = Time.parse(data['EndDate'])
|
6
|
-
@hours = data['Hours']
|
7
|
-
@cost = data['Cost']
|
8
|
-
@shifts = data['Shifts']
|
9
|
-
@schedule = ShiftNote::DaysOfWeekShifts.new(data['DaysOfWeekShifts'])
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_reader :start_date
|
13
|
-
attr_reader :end_date
|
14
|
-
attr_reader :hours
|
15
|
-
attr_reader :cost
|
16
|
-
attr_reader :shifts
|
17
|
-
attr_reader :schedule
|
18
|
-
attr_reader :raw
|
19
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
class ShiftNote::ShiftViewModel
|
2
|
-
def initialize(data)
|
3
|
-
@raw = data
|
4
|
-
@schedule_id = data['ScheduleId']
|
5
|
-
@schedule_name = data['ScheduleName']
|
6
|
-
@schedule_status_id = data['ScheduleStatusId']
|
7
|
-
@shift_id = data['ShiftId']
|
8
|
-
@employee_id = data['EmployeeId']
|
9
|
-
@employee = data['Employee']
|
10
|
-
@shift_date = Time.parse(data['ShiftDate'])
|
11
|
-
@time_in = Time.parse(data['TimeIn'])
|
12
|
-
@time_out = Time.parse(data['TimeOut'])
|
13
|
-
@position = data['Position']
|
14
|
-
@position_color = data['PositionColor']
|
15
|
-
@internal_location = data['InternalLocation']
|
16
|
-
@open = data['Open']
|
17
|
-
@close = data['Close']
|
18
|
-
@on_call = data['OnCall']
|
19
|
-
@volume = data['Volume']
|
20
|
-
@note = data['Note']
|
21
|
-
@hours = data['Hours']
|
22
|
-
@cost = data['Cost']
|
23
|
-
@is_pending_pickup = data['IsPendingPickUp']
|
24
|
-
@is_pending_manager_approval = data['IsPendingManagerApproval']
|
25
|
-
@is_pending_swap = data['IsPendingSwap']
|
26
|
-
@is_pending_swap_manager_approval = data['IsPendingSwapManagerApproval']
|
27
|
-
@hide_end_times = data['HideEndTimes']
|
28
|
-
end
|
29
|
-
|
30
|
-
attr_reader :schedule_id
|
31
|
-
attr_reader :schedule_name
|
32
|
-
attr_reader :schedule_status_id
|
33
|
-
attr_reader :shift_id
|
34
|
-
attr_reader :employee_id
|
35
|
-
attr_reader :employee
|
36
|
-
attr_reader :shift_date
|
37
|
-
attr_reader :time_in
|
38
|
-
attr_reader :time_out
|
39
|
-
attr_reader :position
|
40
|
-
attr_reader :position_color
|
41
|
-
attr_reader :internal_location
|
42
|
-
attr_reader :open
|
43
|
-
attr_reader :close
|
44
|
-
attr_reader :on_call
|
45
|
-
attr_reader :volume
|
46
|
-
attr_reader :note
|
47
|
-
attr_reader :hours
|
48
|
-
attr_reader :cost
|
49
|
-
attr_reader :is_pending_pickup
|
50
|
-
attr_reader :is_pending_manager_approval
|
51
|
-
attr_reader :is_pending_swap
|
52
|
-
attr_reader :is_pending_swap_manager_approval
|
53
|
-
attr_reader :hide_end_times
|
54
|
-
attr_reader :raw
|
55
|
-
|
56
|
-
# Releases the shift
|
57
|
-
def release(employee = 0)
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|