merch_calendar 0.1.0.rc3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -7
- data/README.md +18 -19
- data/lib/merch_calendar/fiscal_year_calendar.rb +3 -3
- data/lib/merch_calendar/version.rb +1 -1
- data/lib/merch_calendar.rb +1 -0
- data/merch_calendar.gemspec +0 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c82e19a6628132edf5ef227e08d270fc8e1aa3ef
|
4
|
+
data.tar.gz: 6bcc92b82007ee4cf137435092ac7df7f6f24a33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a532b4acdd1a97639b1894b53181279f750531fd5ac99b2d5f95d40f9cc5330a26b17f8eb85e5304f8a9477596378c22db4355c0f6f39b6766c93730c5e945fd
|
7
|
+
data.tar.gz: 6360b4c0c3c20d6565dae5fc83f2e089c50f6b0fa159a9af99211363316bd3be8bebe5075c5a0bb79253d22a85cd63e53f6dd9e9979c22d6c495569429e8967a
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
merch_calendar (0.1.0
|
4
|
+
merch_calendar (0.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://www.rubygems.org/
|
8
8
|
specs:
|
9
|
-
byebug (9.0.6)
|
10
9
|
coderay (1.1.1)
|
11
10
|
coveralls (0.8.13)
|
12
11
|
json (~> 1.8)
|
@@ -18,13 +17,10 @@ GEM
|
|
18
17
|
docile (1.1.5)
|
19
18
|
json (1.8.3)
|
20
19
|
method_source (0.8.2)
|
21
|
-
pry (0.10.
|
20
|
+
pry (0.10.4)
|
22
21
|
coderay (~> 1.1.0)
|
23
22
|
method_source (~> 0.8.1)
|
24
23
|
slop (~> 3.4)
|
25
|
-
pry-byebug (3.4.2)
|
26
|
-
byebug (~> 9.0)
|
27
|
-
pry (~> 0.10)
|
28
24
|
rake (10.5.0)
|
29
25
|
rspec (3.4.0)
|
30
26
|
rspec-core (~> 3.4.0)
|
@@ -57,7 +53,6 @@ DEPENDENCIES
|
|
57
53
|
coveralls
|
58
54
|
merch_calendar!
|
59
55
|
pry
|
60
|
-
pry-byebug
|
61
56
|
rake
|
62
57
|
rspec (>= 3.0.0)
|
63
58
|
simplecov
|
data/README.md
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
[![Code Climate](https://codeclimate.com/github/stitchfix/merch_calendar/badges/gpa.svg)](https://codeclimate.com/github/stitchfix/merch_calendar)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/stitchfix/merch_calendar/badge.svg)](https://coveralls.io/r/stitchfix/merch_calendar)
|
7
7
|
|
8
|
-
This gem allows for finding retail/merchandising weeks for a given date, along with manipulating the retail calendar.
|
8
|
+
This gem allows for finding retail/merchandising weeks for a given date, along with manipulating the retail calendar.
|
9
|
+
This gem is used at [Stitch Fix](http://www.stitchfix.com/).
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
@@ -24,29 +25,27 @@ For converting a date into a `MerchWeek` object.
|
|
24
25
|
|
25
26
|
```ruby
|
26
27
|
merch_week = MerchCalendar::MerchWeek.from_date("2014-01-01")
|
27
|
-
puts merch_week.year # 2013 (the merch year associated with this date)
|
28
|
-
puts merch_week.month # 12 (the julian month that the date falls in)
|
29
|
-
puts merch_week.week # 5 (the week number within the month)
|
30
|
-
puts merch_week.year_week # 48 (the week number within the year)
|
31
|
-
puts merch_week.quarter # 2
|
32
28
|
|
33
|
-
|
34
|
-
|
29
|
+
merch_week.year # 2013 (the merch year associated with this date)
|
30
|
+
merch_week.month # 12 (the julian month that the date falls in)
|
31
|
+
merch_week.week # 5 (the week number within the month)
|
32
|
+
merch_week.year_week # 48 (the week number within the year)
|
33
|
+
merch_week.quarter # 2
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
merch_week.start_of_week # <Date: 2013-12-29>
|
36
|
+
merch_week.end_of_week # <Date: 2014-01-04>
|
38
37
|
|
39
|
-
|
40
|
-
|
38
|
+
merch_week.start_of_month # <Date: 2013-12-01>
|
39
|
+
merch_week.end_of_month # <Date: 2014-01-04>
|
41
40
|
|
42
|
-
|
43
|
-
|
41
|
+
merch_week.start_of_year # <Date: 2013-02-03>
|
42
|
+
merch_week.end_of_year # <Date: 2014-02-01>
|
44
43
|
|
45
44
|
# Formatting
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
merch_week.to_s # "Dec W5"
|
46
|
+
merch_week.to_s(:short) # "Dec W5"
|
47
|
+
merch_week.to_s(:long) # "2013:48 Dec W5"
|
48
|
+
merch_week.to_s(:elasticsearch) # "2013-12w05"
|
50
49
|
```
|
51
50
|
|
52
51
|
|
@@ -104,7 +103,7 @@ retail_calendar.end_of_week(2017, 4, 1)
|
|
104
103
|
```
|
105
104
|
|
106
105
|
### Offset fiscal year calendars
|
107
|
-
Some companies, one of which being Stitch Fix, operate on a fiscal year calendar that is offset
|
106
|
+
Some companies, one of which being Stitch Fix, operate on a fiscal year calendar that is offset from
|
108
107
|
the traditional retail calendar. The `MerchCalendar::FiscalYearCalendar` class allows you to easily
|
109
108
|
offset the start of year to match your fiscal calendar.
|
110
109
|
|
@@ -80,7 +80,7 @@ module MerchCalendar
|
|
80
80
|
private
|
81
81
|
|
82
82
|
# Offsets the quarter based on the fiscal year quarter offset
|
83
|
-
# returns:
|
83
|
+
# returns: offset [year, quarter]
|
84
84
|
def offset_quarter(year, quarter)
|
85
85
|
# first quarter in fiscal calendar is Q3 of retail calendar of previous year
|
86
86
|
if quarter >= 1 + @fy_quarter_offset.abs
|
@@ -91,7 +91,7 @@ module MerchCalendar
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Offsets the month based on the fiscal year quarter offset
|
94
|
-
# returns:
|
94
|
+
# returns: offset [year, month]
|
95
95
|
def offset_month(year, month)
|
96
96
|
# 3 - number of months in a quarter
|
97
97
|
month_offset = @fy_quarter_offset * 3
|
@@ -104,7 +104,7 @@ module MerchCalendar
|
|
104
104
|
end
|
105
105
|
|
106
106
|
# Offsets the year based on the fiscal year quarter offset
|
107
|
-
# returns:
|
107
|
+
# returns: offset year
|
108
108
|
def offset_year(year)
|
109
109
|
if @fy_quarter_offset < 0
|
110
110
|
year -= 1
|
data/lib/merch_calendar.rb
CHANGED
data/merch_calendar.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merch_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitch Dempsey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -81,20 +81,6 @@ dependencies:
|
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: pry-byebug
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
84
|
description: Utility for manipulating dates within a 4-5-4 retail calendar
|
99
85
|
email:
|
100
86
|
- opensource@stitchfix.com
|
@@ -142,9 +128,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
128
|
version: '0'
|
143
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
130
|
requirements:
|
145
|
-
- - "
|
131
|
+
- - ">="
|
146
132
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
133
|
+
version: '0'
|
148
134
|
requirements: []
|
149
135
|
rubyforge_project:
|
150
136
|
rubygems_version: 2.6.12
|