label_me 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +82 -0
- data/Rakefile +1 -0
- data/label_me.gemspec +25 -0
- data/lib/label_me/order/customer.rb +36 -0
- data/lib/label_me/order/line_item.rb +31 -0
- data/lib/label_me/order/recipient.rb +57 -0
- data/lib/label_me/order.rb +44 -0
- data/lib/label_me/sales_all/object.rb +21 -0
- data/lib/label_me/sales_all/row.rb +144 -0
- data/lib/label_me/sales_all.rb +6 -0
- data/lib/label_me/version.rb +3 -0
- data/lib/label_me.rb +6 -0
- data/spec/csv/sales_all.csv +5 -0
- data/spec/label_me/order/customer_spec.rb +80 -0
- data/spec/label_me/order/line_item_spec.rb +70 -0
- data/spec/label_me/order/recipient_spec.rb +128 -0
- data/spec/label_me/order_spec.rb +88 -0
- data/spec/label_me/sales_all/object_spec.rb +35 -0
- data/spec/label_me/sales_all/row_spec.rb +195 -0
- data/spec/label_me/sales_all_spec.rb +4 -0
- data/spec/label_me_spec.rb +5 -0
- data/spec/spec_helper.rb +1 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b4875cee0717b9db48fc57a321333178792520c
|
4
|
+
data.tar.gz: 9cdc90141afed79b69436b41848a54e1b84aba32
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 835bc577cb97b0a0f57cae276b238616b5c7d76a45707827594284f460f086256e29d56aeece633057a4486e68a1ff17cf2682c9dd52a5acd6665291933ba543
|
7
|
+
data.tar.gz: b387aba2c6c9a3c20c8ac95aa1940a2ce8f20984c0aac622068dbdbbcae38fadf5ec10c60ce24496d7dcb797392819e1ac440e4d69237213be24efaed0453de7
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 OSA Shunsuke
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# LabelMe
|
2
|
+
|
3
|
+
LabelMe is an easy accessor for ColorMe Order CSV.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'label_me', github: "xxxcaqui/label_me"
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
rows = LabelMe::SalesAll::Row.parse("sales_all.csv")
|
21
|
+
|
22
|
+
rows.first.order_id #=> "12342345"
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
## Attributes for LabelMe::SalesAll::Row
|
27
|
+
|
28
|
+
### General
|
29
|
+
|
30
|
+
| Column in CSV | Accessor method |
|
31
|
+
|------|------|
|
32
|
+
|売上ID|order_id|
|
33
|
+
|受注日|order_date|
|
34
|
+
|
35
|
+
### Customer
|
36
|
+
|
37
|
+
| Column in CSV | Accessor method |
|
38
|
+
|------|------|
|
39
|
+
|購入者 顧客ID|customer_id|
|
40
|
+
|購入者 名前|customer_name|
|
41
|
+
|購入者 郵便番号|customer_postal_code|
|
42
|
+
|購入者 都道府県, 購入者 住所|customer_address|
|
43
|
+
|購入者 メールアドレス|customer_email|
|
44
|
+
|購入者 電話番号|customer_phone_number|
|
45
|
+
|送料合計|total_shipping_charge|
|
46
|
+
|メッセージカード手数料合計|total_message_card_charge|
|
47
|
+
|入金状態|paid?|
|
48
|
+
|
49
|
+
### Recipient
|
50
|
+
|
51
|
+
| Column in CSV | Accessor method |
|
52
|
+
|------|------|
|
53
|
+
|配送先ID|recipient_id|
|
54
|
+
|配送先 名前|recipient_name|
|
55
|
+
|配送先 フリガナ|recipient_kana|
|
56
|
+
|配送先 郵便番号|recipient_postal_code|
|
57
|
+
|配送先 都道府県名, 配送先 住所|recipient_address|
|
58
|
+
|配送先 電話番号|recipient_phone_number|
|
59
|
+
|配送希望日|wished_delivery_date|
|
60
|
+
|配送希望時間|wished_delivery_timezone|
|
61
|
+
|配送先 熨斗(のし)|recipient_labeling|
|
62
|
+
|配送先 メッセージカード種類|recipient_message_card_type|
|
63
|
+
|配送先 メッセージカード内容|recipient_message_card_body|
|
64
|
+
|配送先 備考|recipient_notes|
|
65
|
+
|
66
|
+
### Line Item
|
67
|
+
|
68
|
+
| Column in CSV | Accessor method |
|
69
|
+
|------|------|
|
70
|
+
|売上詳細ID|line_item_id|
|
71
|
+
|購入商品 商品ID|line_item_code|
|
72
|
+
|購入商品 販売価格(消費税込)|line_item_unit_price|
|
73
|
+
|購入商品 販売個数|line_item_quantity|
|
74
|
+
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
1. Fork it
|
79
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
80
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
81
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
82
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/label_me.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'label_me/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "label_me"
|
8
|
+
spec.version = LabelMe::VERSION
|
9
|
+
spec.authors = ["OSA Shunsuke"]
|
10
|
+
spec.email = ["hhelibebcnofnenamg@gmail.com"]
|
11
|
+
spec.description = %q{Parser and accessor for order CSV file in ColorMe.}
|
12
|
+
spec.summary = %q{Easy to access ColorMe order CSV.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "grafter"
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module LabelMe
|
2
|
+
class Order
|
3
|
+
class Customer
|
4
|
+
def initialize(row)
|
5
|
+
@number = row.customer_id.to_i
|
6
|
+
@name = row.customer_name
|
7
|
+
@email = row.customer_email
|
8
|
+
@phone_number = row.customer_phone_number
|
9
|
+
@address = row.customer_address
|
10
|
+
@postal_code = row.customer_postal_code
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :number
|
14
|
+
attr_accessor :name
|
15
|
+
attr_accessor :email
|
16
|
+
attr_accessor :phone_number
|
17
|
+
attr_accessor :address
|
18
|
+
attr_accessor :postal_code
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
{
|
22
|
+
number: number,
|
23
|
+
name: name,
|
24
|
+
email: email,
|
25
|
+
phone_number: phone_number,
|
26
|
+
address: address,
|
27
|
+
postal_code: postal_code
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def ===(other)
|
32
|
+
self.number == other.number
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module LabelMe
|
2
|
+
class Order
|
3
|
+
class LineItem
|
4
|
+
def initialize(row)
|
5
|
+
@number = row.line_item_id.to_i
|
6
|
+
@quantity = row.line_item_quantity.to_i
|
7
|
+
@unit_price = row.line_item_unit_price.to_i
|
8
|
+
@code = row.line_item_code
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_accessor :number
|
12
|
+
attr_accessor :quantity
|
13
|
+
attr_accessor :unit_price
|
14
|
+
attr_accessor :code
|
15
|
+
|
16
|
+
def to_hash
|
17
|
+
{
|
18
|
+
number: number,
|
19
|
+
quantity: quantity,
|
20
|
+
unit_price: unit_price,
|
21
|
+
code: code
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def ===(other)
|
26
|
+
self.number == other.number
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module LabelMe
|
2
|
+
class Order
|
3
|
+
class Recipient
|
4
|
+
require "label_me/order/line_item"
|
5
|
+
|
6
|
+
def initialize(row)
|
7
|
+
@number = row.recipient_id.to_i
|
8
|
+
@name = row.recipient_name
|
9
|
+
@kana = row.recipient_kana
|
10
|
+
@address = row.recipient_address
|
11
|
+
@phone_number = row.recipient_phone_number
|
12
|
+
@postal_code = row.recipient_postal_code
|
13
|
+
@labeling = row.recipient_labeling
|
14
|
+
@message_card = row.recipient_message_card_type.to_s + " " + row.recipient_message_card_body.to_s
|
15
|
+
@notes = row.recipient_notes
|
16
|
+
@wished_delivery_date = row.wished_delivery_date
|
17
|
+
@wished_delivery_timezone = row.wished_delivery_timezone
|
18
|
+
@line_items = [LabelMe::Order::LineItem.new(row)]
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :number
|
22
|
+
attr_accessor :name
|
23
|
+
attr_accessor :kana
|
24
|
+
attr_accessor :address
|
25
|
+
attr_accessor :phone_number
|
26
|
+
attr_accessor :postal_code
|
27
|
+
attr_accessor :labeling
|
28
|
+
attr_accessor :message_card
|
29
|
+
attr_accessor :notes
|
30
|
+
attr_accessor :wished_delivery_date
|
31
|
+
attr_accessor :wished_delivery_timezone
|
32
|
+
attr_accessor :line_items
|
33
|
+
|
34
|
+
def to_hash
|
35
|
+
{
|
36
|
+
number: number,
|
37
|
+
name: name,
|
38
|
+
kana: kana,
|
39
|
+
address: address,
|
40
|
+
phone_number: phone_number,
|
41
|
+
postal_code: postal_code,
|
42
|
+
labeling: labeling,
|
43
|
+
message_card: message_card,
|
44
|
+
notes: notes,
|
45
|
+
wished_delivery_date: wished_delivery_date,
|
46
|
+
wished_delivery_timezone: wished_delivery_timezone,
|
47
|
+
line_items_attributes: line_items.map(&:to_hash)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def ===(other)
|
52
|
+
self.number == other.number
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module LabelMe
|
2
|
+
class Order
|
3
|
+
require "label_me/order/customer"
|
4
|
+
require "label_me/order/recipient"
|
5
|
+
|
6
|
+
def initialize(row)
|
7
|
+
@number = row.order_id.to_i
|
8
|
+
@order_date = row.order_date
|
9
|
+
@paid = row.paid?
|
10
|
+
@shipping_charge = row.total_shipping_charge
|
11
|
+
@message_card_charge = row.total_message_card_charge
|
12
|
+
@customer = LabelMe::Order::Customer.new(row)
|
13
|
+
@recipients = [LabelMe::Order::Recipient.new(row)]
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :number
|
17
|
+
attr_accessor :order_date
|
18
|
+
attr_accessor :shipping_charge
|
19
|
+
attr_accessor :message_card_charge
|
20
|
+
attr_accessor :customer
|
21
|
+
attr_accessor :recipients
|
22
|
+
|
23
|
+
def paid?
|
24
|
+
@paid
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_hash
|
28
|
+
{
|
29
|
+
number: number,
|
30
|
+
order_date: order_date,
|
31
|
+
paid?: paid?,
|
32
|
+
shipping_charge: shipping_charge,
|
33
|
+
message_card_charge: message_card_charge,
|
34
|
+
customer_attributes: customer.to_hash,
|
35
|
+
recipients_attributes: recipients.map(&:to_hash),
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def ===(other)
|
40
|
+
self.number == other.number
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
module LabelMe
|
3
|
+
module SalesAll
|
4
|
+
class Object
|
5
|
+
require "label_me/sales_all/row"
|
6
|
+
require "grafter"
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def parse(csv_path)
|
10
|
+
LabelMe::SalesAll::Row.parse(csv_path).map{|order_row| LabelMe::Order.new(order_row) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def build(csv_path)
|
14
|
+
parse(csv_path).graft(operator: :===, branch: :recipients) do |recipients|
|
15
|
+
recipients.graft(operator: :===, branch: :line_items)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
module LabelMe
|
3
|
+
module SalesAll
|
4
|
+
class Row
|
5
|
+
require 'csv'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def parse(csv_path)
|
9
|
+
open(csv_path, "r:windows-31j:utf-8") do |file|
|
10
|
+
return CSV.new(file, headers: true).map{|row| LabelMe::SalesAll::Row.new(row) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(row)
|
16
|
+
@row = row
|
17
|
+
end
|
18
|
+
|
19
|
+
############################################################
|
20
|
+
# Accessors for general column
|
21
|
+
############################################################
|
22
|
+
|
23
|
+
def order_id
|
24
|
+
@row["売上ID"].to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
def order_date
|
28
|
+
Date.parse(@row["受注日"])
|
29
|
+
end
|
30
|
+
|
31
|
+
############################################################
|
32
|
+
# Accessors for customer column
|
33
|
+
############################################################
|
34
|
+
|
35
|
+
def customer_id
|
36
|
+
@row["購入者 顧客ID"].to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def customer_name
|
40
|
+
@row["購入者 名前"].to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
def customer_postal_code
|
44
|
+
@row["購入者 郵便番号"].to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
def customer_address
|
48
|
+
@row["購入者 都道府県"].to_s + @row["購入者 住所"].to_s
|
49
|
+
end
|
50
|
+
|
51
|
+
def customer_email
|
52
|
+
@row["購入者 メールアドレス"].to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
def customer_phone_number
|
56
|
+
@row["購入者 電話番号"].to_s
|
57
|
+
end
|
58
|
+
|
59
|
+
def total_shipping_charge
|
60
|
+
@row["送料合計"].to_i
|
61
|
+
end
|
62
|
+
|
63
|
+
def total_message_card_charge
|
64
|
+
@row["メッセージカード手数料合計"].to_i
|
65
|
+
end
|
66
|
+
|
67
|
+
def paid?
|
68
|
+
/入金済/ === @row["入金状態"]
|
69
|
+
end
|
70
|
+
|
71
|
+
############################################################
|
72
|
+
# Accessors for recipient column
|
73
|
+
############################################################
|
74
|
+
|
75
|
+
def recipient_id
|
76
|
+
@row["配送先ID"].to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
def recipient_name
|
80
|
+
@row["配送先 名前"].to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
def recipient_kana
|
84
|
+
@row["配送先 フリガナ"].to_s
|
85
|
+
end
|
86
|
+
|
87
|
+
def recipient_postal_code
|
88
|
+
@row["配送先 郵便番号"].to_s
|
89
|
+
end
|
90
|
+
|
91
|
+
def recipient_address
|
92
|
+
@row["配送先 都道府県名"].to_s + @row["配送先 住所"].to_s
|
93
|
+
end
|
94
|
+
|
95
|
+
def recipient_phone_number
|
96
|
+
@row["配送先 電話番号"].to_s
|
97
|
+
end
|
98
|
+
|
99
|
+
def wished_delivery_date
|
100
|
+
@row["配送希望日"].to_s
|
101
|
+
end
|
102
|
+
|
103
|
+
def wished_delivery_timezone
|
104
|
+
@row["配送希望時間"].to_s
|
105
|
+
end
|
106
|
+
|
107
|
+
def recipient_labeling
|
108
|
+
@row["配送先 熨斗(のし)"].to_s
|
109
|
+
end
|
110
|
+
|
111
|
+
def recipient_message_card_type
|
112
|
+
@row["配送先 メッセージカード種類"].to_s
|
113
|
+
end
|
114
|
+
|
115
|
+
def recipient_message_card_body
|
116
|
+
@row["配送先 メッセージカード内容"].to_s
|
117
|
+
end
|
118
|
+
|
119
|
+
def recipient_notes
|
120
|
+
@row["配送先 備考"].to_s
|
121
|
+
end
|
122
|
+
|
123
|
+
############################################################
|
124
|
+
# Accessors for line item column
|
125
|
+
############################################################
|
126
|
+
|
127
|
+
def line_item_id
|
128
|
+
@row["売上詳細ID"].to_s
|
129
|
+
end
|
130
|
+
|
131
|
+
def line_item_code
|
132
|
+
@row["購入商品 商品ID"].to_s
|
133
|
+
end
|
134
|
+
|
135
|
+
def line_item_unit_price
|
136
|
+
@row["購入商品 販売価格(消費税込)"].to_i
|
137
|
+
end
|
138
|
+
|
139
|
+
def line_item_quantity
|
140
|
+
@row["購入商品 販売個数"].to_i
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
data/lib/label_me.rb
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
����ID,��,PC�E�g�ы敪,�w���� �ڋqID,�w���� ���O,�w���� �X�֔ԍ�,�w���� �s���{��,�w���� �Z��,�w���� ���[���A�h���X,�w���� �d�b�ԍ�,���i�̍��v���z(�ō�),�����(���i���v�ɑ���),�������v,���ώ萔��,���l�萔�����v,���b�Z�[�W�J�[�h�萔�����v,���b�s���O�萔�����v,�V���b�v�|�C���g�ɂ�銄�����z,�O���|�C���g�ɂ�銄�����z,��������,�������z,�����v���z,���ϕ��@,�������,�������,���[��,�������[��,�������[��,�g�p�V���b�v�|�C���g��,�g�pGMO�Ƃ��Ƃ��|�C���g��,�V���b�v�|�C���g�������,�l���V���b�v�|�C���g��,���l,�z����ID,�z���� ���O,�z���� �t���K�i,�z���� �X�֔ԍ�,�z���� �s���{����,�z���� �Z��,�z���� �d�b�ԍ�,�z���� �z����Ж�,�z����]��,�z����]����,�z���� ���l�i�̂��j,�z���� ���b�Z�[�W�J�[�h���,�z���� ���b�Z�[�W�J�[�h���e,�z���� ���b�s���O,�z���� ����,�z���� ���l�萔��,�z���� ���b�Z�[�W�J�[�h�萔��,�z���� ���b�s���O�萔��,�z���� ���v�i���i�܂ށj,�z���� ���l,�������,����ڍ�ID,�w�����i �^��,�w�����i ���iID,�w�����i ���i��,�w�����i �̔����i(����ō�),�w�����i ����,�w�����i �̔���,�w�����i ���v
|
2
|
+
12342345,2013/01/18,PC���璍��,23453456,���������,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������402,kurumi@example.com,098-765-4321,1786,85,600,0,0,0,0,0,0,,0,1786,�N���W�b�g����,������,������,�����M,�����M,�����M,0,0,���|�C���g,0,,34564567,�����C,�����Z�V���E,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������401,0987-65-4321,�e���[�J�[����z���Ǝ�,�ݒ�Ȃ�,14��-16��,�̂�,���b�Z�[�W�J�[�hA,�a����,,0,,,,1786,���l���ł�,������,45675678,,56786789,�ʂ邢�ʈ���,893,,2,1786
|
3
|
+
12342345,2013/01/18,PC���璍��,23453456,���������,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������402,kurumi@example.com,098-765-4321,1786,85,600,0,0,0,0,0,0,,0,1786,�N���W�b�g����,������,������,�����M,�����M,�����M,0,0,���|�C���g,0,,34564567,�����C,�����Z�V���E,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������401,0987-65-4321,�e���[�J�[����z���Ǝ�,�ݒ�Ȃ�,14��-16��,�̂�,���b�Z�[�W�J�[�hA,�a����,,0,,,,1786,���l���ł�,������,45675679,,56786789,�ʂ邢�ʈ���,893,,2,1786
|
4
|
+
12342345,2013/01/18,PC���璍��,23453456,���������,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������402,kurumi@example.com,098-765-4321,1786,85,600,0,0,0,0,0,0,,0,1786,�N���W�b�g����,������,������,�����M,�����M,�����M,0,0,���|�C���g,0,,34564568,�����C,�����Z�V���E,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������401,0987-65-4321,�e���[�J�[����z���Ǝ�,�ݒ�Ȃ�,14��-16��,�̂�,���b�Z�[�W�J�[�hA,�a����,,0,,,,1786,���l���ł�,������,45675678,,56786789,�ʂ邢�ʈ���,893,,2,1786
|
5
|
+
12342346,2013/01/18,PC���璍��,23453456,���������,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������402,kurumi@example.com,098-765-4321,1786,85,600,0,0,0,0,0,0,,0,1786,�N���W�b�g����,������,������,�����M,�����M,�����M,0,0,���|�C���g,0,,34564567,�����C,�����Z�V���E,1000001,�����s,��c�摫��5����7�Ԓn2�����C������������401,0987-65-4321,�e���[�J�[����z���Ǝ�,�ݒ�Ȃ�,14��-16��,�̂�,���b�Z�[�W�J�[�hA,�a����,,0,,,,1786,���l���ł�,������,45675678,,56786789,�ʂ邢�ʈ���,893,,2,1786
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::Order::Customer do
|
5
|
+
before do
|
6
|
+
order = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
7
|
+
@customer = order.customer
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "attributes" do
|
11
|
+
describe "#number" do
|
12
|
+
it "should return customer number" do
|
13
|
+
expect(@customer.number).to eq(23453456)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#name" do
|
18
|
+
it "should return customer name" do
|
19
|
+
expect(@customer.name).to eq("桃瀬くるみ")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#email" do
|
24
|
+
it "should return customer email" do
|
25
|
+
expect(@customer.email).to eq("kurumi@example.com")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#phone_number" do
|
30
|
+
it "should return customer phone number" do
|
31
|
+
expect(@customer.phone_number).to eq("098-765-4321")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#address" do
|
36
|
+
it "should return customer address" do
|
37
|
+
expect(@customer.address).to match(/東京都大田区足柄.+402/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#postal_code" do
|
42
|
+
it "should return customer postal code" do
|
43
|
+
expect(@customer.postal_code).to eq("1000001")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#to_hash" do
|
49
|
+
it "should return Hash" do
|
50
|
+
hash = @customer.to_hash
|
51
|
+
expect(hash[:number]).to eq(23453456)
|
52
|
+
expect(hash[:name]).to eq("桃瀬くるみ")
|
53
|
+
expect(hash[:email]).to eq("kurumi@example.com")
|
54
|
+
expect(hash[:phone_number]).to eq("098-765-4321")
|
55
|
+
expect(hash[:address]).to match(/東京都大田区足柄.+402/)
|
56
|
+
expect(hash[:postal_code]).to eq("1000001")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#===" do
|
61
|
+
before do
|
62
|
+
@customer1 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.customer
|
63
|
+
@customer2 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.customer
|
64
|
+
end
|
65
|
+
|
66
|
+
context "same attributes" do
|
67
|
+
it "should return true" do
|
68
|
+
expect(@customer1 === @customer2).to eq(true)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "different attributes" do
|
73
|
+
it "should return false" do
|
74
|
+
@customer2.number = 1
|
75
|
+
expect(@customer1 === @customer2).to eq(false)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::Order::LineItem do
|
5
|
+
before do
|
6
|
+
order = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
7
|
+
recipient = order.recipients.first
|
8
|
+
@line_item = recipient.line_items.first
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "attributes" do
|
12
|
+
describe "#number" do
|
13
|
+
it "should return line item number" do
|
14
|
+
expect(@line_item.number).to eq(45675678)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#quantity" do
|
19
|
+
it "should return line item quantity" do
|
20
|
+
expect(@line_item.quantity).to eq(2)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#unit_price" do
|
25
|
+
it "should return line item unit price" do
|
26
|
+
expect(@line_item.unit_price).to eq(893)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#code" do
|
31
|
+
it "should return line item code" do
|
32
|
+
expect(@line_item.code).to eq("56786789")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#to_hash" do
|
38
|
+
before do
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return Hash" do
|
43
|
+
hash = @line_item.to_hash
|
44
|
+
expect(hash[:number]).to eq(45675678)
|
45
|
+
expect(hash[:quantity]).to eq(2)
|
46
|
+
expect(hash[:unit_price]).to eq(893)
|
47
|
+
expect(hash[:code]).to eq("56786789")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#===" do
|
52
|
+
before do
|
53
|
+
@line_item1 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.recipients.first.line_items.first
|
54
|
+
@line_item2 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.recipients.first.line_items.first
|
55
|
+
end
|
56
|
+
|
57
|
+
context "same attributes" do
|
58
|
+
it "should return true" do
|
59
|
+
expect(@line_item1 === @line_item2).to eq(true)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "different attributes" do
|
64
|
+
it "should return false" do
|
65
|
+
@line_item2.number = 1
|
66
|
+
expect(@line_item1 === @line_item2).to eq(false)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::Order::Recipient do
|
5
|
+
before do
|
6
|
+
order = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
7
|
+
@recipient = order.recipients.first
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "attributes" do
|
11
|
+
describe "#number" do
|
12
|
+
it "should return recipient number" do
|
13
|
+
expect(@recipient.number).to eq(34564567)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#name" do
|
18
|
+
it "should return recipient name" do
|
19
|
+
expect(@recipient.name).to eq("桃瀬修")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#kana" do
|
24
|
+
it "should return recipient kana" do
|
25
|
+
expect(@recipient.kana).to eq("モモセシュウ")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#address" do
|
30
|
+
it "should return recipient address" do
|
31
|
+
expect(@recipient.address).to match(/東京都大田区足柄.+401/)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#pnohe_number" do
|
36
|
+
it "should return recipient phone number" do
|
37
|
+
expect(@recipient.phone_number).to eq("0987-65-4321")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#postal_code" do
|
42
|
+
it "should return recipient postal code" do
|
43
|
+
expect(@recipient.postal_code).to eq("1000001")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#labeling" do
|
48
|
+
it "should return labeling" do
|
49
|
+
expect(@recipient.labeling).to eq("のし")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#message_card" do
|
54
|
+
it "should return message card" do
|
55
|
+
expect(@recipient.message_card).to match(/メッセージカードA/)
|
56
|
+
expect(@recipient.message_card).to match(/誕生日/)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#notes" do
|
61
|
+
it "should return recipient notes" do
|
62
|
+
expect(@recipient.notes).to match(/備考欄です/)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "#wished_delivery_date" do
|
67
|
+
it "should return recipient wished delivery date" do
|
68
|
+
expect(@recipient.wished_delivery_date).to match(/設定なし/)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#wished_deivery_timezone" do
|
73
|
+
it "should return recipient wished delivery timezone" do
|
74
|
+
expect(@recipient.wished_delivery_timezone).to match(/14時\-16時/)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#recipients" do
|
79
|
+
it "should return instances of LabelMe::Order::LineItem" do
|
80
|
+
line_items = @recipient.line_items
|
81
|
+
expect(line_items).to be_an_instance_of(Array)
|
82
|
+
expect(line_items.size).to eq(1)
|
83
|
+
expect(line_items.all?{|line_item| line_item.is_a? LabelMe::Order::LineItem }).to be_true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#to_hash" do
|
89
|
+
it "should return Hash" do
|
90
|
+
hash = @recipient.to_hash
|
91
|
+
expect(hash[:number]).to eq(34564567)
|
92
|
+
expect(hash[:name]).to eq("桃瀬修")
|
93
|
+
expect(hash[:kana]).to eq("モモセシュウ")
|
94
|
+
expect(hash[:address]).to match(/東京都大田区足柄.+401/)
|
95
|
+
expect(hash[:phone_number]).to eq("0987-65-4321")
|
96
|
+
expect(hash[:postal_code]).to eq("1000001")
|
97
|
+
expect(hash[:labeling]).to eq("のし")
|
98
|
+
expect(hash[:message_card]).to match(/メッセージカードA/)
|
99
|
+
expect(hash[:message_card]).to match(/誕生日/)
|
100
|
+
expect(hash[:notes]).to match(/備考欄です/)
|
101
|
+
expect(hash[:wished_delivery_date]).to match(/設定なし/)
|
102
|
+
expect(hash[:wished_delivery_timezone]).to match(/14時\-16時/)
|
103
|
+
expect(hash[:line_items_attributes]).to eq([@recipient.line_items.first.to_hash])
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#===" do
|
108
|
+
before do
|
109
|
+
@recipient1 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.recipients.first
|
110
|
+
@recipient2 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first.recipients.first
|
111
|
+
end
|
112
|
+
|
113
|
+
context "same attributes" do
|
114
|
+
it "should return true" do
|
115
|
+
expect(@recipient1 === @recipient2).to eq(true)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context "different attributes" do
|
120
|
+
it "should return false" do
|
121
|
+
@recipient2.number = 1
|
122
|
+
expect(@recipient1 === @recipient2).to eq(false)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::Order do
|
5
|
+
before do
|
6
|
+
@order = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "attributes" do
|
10
|
+
describe "#number" do
|
11
|
+
it "should return order number" do
|
12
|
+
expect(@order.number).to eq(12342345)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#order_date" do
|
17
|
+
it "should return order date" do
|
18
|
+
expect(@order.order_date).to eq(Date.new(2013,1,18))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#paid?" do
|
23
|
+
it "should return payment status" do
|
24
|
+
expect(@order.paid?).to eq(true)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#shipping_charge" do
|
29
|
+
it "should return shipping charge" do
|
30
|
+
expect(@order.shipping_charge).to eq(600)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#message_card_charge" do
|
35
|
+
it "should return message card chaarge" do
|
36
|
+
expect(@order.message_card_charge).to eq(0)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#customer" do
|
41
|
+
it "should return instance of LabelMe::Order::Customer" do
|
42
|
+
expect(@order.customer).to be_an_instance_of(LabelMe::Order::Customer)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#recipients" do
|
47
|
+
it "should return instances of LabelMe::Order::Recipient" do
|
48
|
+
recipients = @order.recipients
|
49
|
+
expect(recipients).to be_an_instance_of(Array)
|
50
|
+
expect(recipients.size).to eq(1)
|
51
|
+
expect(recipients.all?{|recipient| recipient.is_a? LabelMe::Order::Recipient }).to be_true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#to_hash" do
|
57
|
+
it "should return Hash" do
|
58
|
+
hash = @order.to_hash
|
59
|
+
expect(hash[:number]).to eq(12342345)
|
60
|
+
expect(hash[:order_date]).to eq(Date.new(2013,1,18))
|
61
|
+
expect(hash[:paid?]).to eq(true)
|
62
|
+
expect(hash[:shipping_charge]).to eq(600)
|
63
|
+
expect(hash[:message_card_charge]).to eq(0)
|
64
|
+
expect(hash[:customer_attributes]).to eq(@order.customer.to_hash)
|
65
|
+
expect(hash[:recipients_attributes]).to eq([@order.recipients.first.to_hash])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#===" do
|
70
|
+
before do
|
71
|
+
@order1 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
72
|
+
@order2 = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv").first
|
73
|
+
end
|
74
|
+
|
75
|
+
context "same attributes" do
|
76
|
+
it "should return true" do
|
77
|
+
expect(@order1 === @order2).to eq(true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "different attributes" do
|
82
|
+
it "should return false" do
|
83
|
+
@order2.number = 1
|
84
|
+
expect(@order1 === @order2).to eq(false)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::SalesAll::Object do
|
5
|
+
describe "class methods" do
|
6
|
+
describe ".parse" do
|
7
|
+
before do
|
8
|
+
@orders = LabelMe::SalesAll::Object.parse("spec/csv/sales_all.csv")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return Array of LabelMe::SalesAll::Row" do
|
12
|
+
expect(@orders).to be_a_kind_of(Array)
|
13
|
+
expect(@orders.size).to eq(4)
|
14
|
+
expect(@orders.all?{|order| order.is_a? LabelMe::Order }).to be_true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".build" do
|
19
|
+
before do
|
20
|
+
@orders = LabelMe::SalesAll::Object.build("spec/csv/sales_all.csv")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return tree structured instances of LabelMe::Order" do
|
24
|
+
@orders.each{|order| puts order.to_hash}
|
25
|
+
expect(@orders.size).to eq(2)
|
26
|
+
expect(@orders[0].recipients.size).to eq(2)
|
27
|
+
expect(@orders[0].recipients[0].line_items.size).to eq(2)
|
28
|
+
expect(@orders[0].recipients[0].line_items.size).to eq(2)
|
29
|
+
expect(@orders[0].recipients[1].line_items.size).to eq(1)
|
30
|
+
expect(@orders[1].recipients.size).to eq(1)
|
31
|
+
expect(@orders[1].recipients[0].line_items.size).to eq(1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe LabelMe::SalesAll::Row do
|
5
|
+
describe "class methods" do
|
6
|
+
describe ".parse" do
|
7
|
+
before do
|
8
|
+
@orders = LabelMe::SalesAll::Row.parse("spec/csv/sales_all.csv")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return Array of LabelMe::SalesAll::Row" do
|
12
|
+
expect(@orders).to be_a_kind_of(Array)
|
13
|
+
expect(@orders.size).to eq(4)
|
14
|
+
expect(@orders.all?{|order| order.is_a? LabelMe::SalesAll::Row }).to be_true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "instance methods" do
|
20
|
+
before do
|
21
|
+
orders = LabelMe::SalesAll::Row.parse("spec/csv/sales_all.csv")
|
22
|
+
@row = orders.first
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "general columns" do
|
26
|
+
describe "#order_id" do
|
27
|
+
it "should return 売上ID" do
|
28
|
+
expect(@row.order_id).to eq("12342345")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#order_date" do
|
33
|
+
it "should return 受注日" do
|
34
|
+
expect(@row.order_date).to eq(Date.new(2013,1,18))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "customer columns" do
|
40
|
+
describe "#customer_id" do
|
41
|
+
it "should return 購入者 顧客ID" do
|
42
|
+
expect(@row.customer_id).to eq("23453456")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#customer_name" do
|
47
|
+
it "should return 購入者 名前" do
|
48
|
+
expect(@row.customer_name).to eq("桃瀬くるみ")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#customer_postal_code" do
|
53
|
+
it "should return 購入者 郵便番号" do
|
54
|
+
expect(@row.customer_postal_code).to eq("1000001")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#customer_address" do
|
59
|
+
it "should return 購入者 都道府県 and 購入者 住所" do
|
60
|
+
expect(@row.customer_address).to match(/東京都大田区足柄.+402/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#customer_email" do
|
65
|
+
it "should return 購入者 メールアドレス" do
|
66
|
+
expect(@row.customer_email).to eq("kurumi@example.com")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#customer_phone_number" do
|
71
|
+
it "should return 購入者 電話番号" do
|
72
|
+
expect(@row.customer_phone_number).to eq("098-765-4321")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "#total_shipping_charge" do
|
77
|
+
it "should return 送料合計" do
|
78
|
+
expect(@row.total_shipping_charge).to eq(600)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#total_message_card_charge" do
|
83
|
+
it "should return メッセージカード手数料合計" do
|
84
|
+
expect(@row.total_message_card_charge).to eq(0)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#paid?" do
|
89
|
+
it "should return 入金状態" do
|
90
|
+
expect(@row.paid?).to eq(true)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "recipient columns" do
|
96
|
+
describe "#recipient_id" do
|
97
|
+
it "should return 配送先ID" do
|
98
|
+
expect(@row.recipient_id).to eq("34564567")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "#recipient_name" do
|
103
|
+
it "should return 配送先 名前" do
|
104
|
+
expect(@row.recipient_name).to eq("桃瀬修")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "#recipient_kana" do
|
109
|
+
it "should return 配送先 フリガナ" do
|
110
|
+
expect(@row.recipient_kana).to eq("モモセシュウ")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "#recipient_postal_code" do
|
115
|
+
it "should return 配送先 郵便番号" do
|
116
|
+
expect(@row.recipient_postal_code).to eq("1000001")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#recipient_address" do
|
121
|
+
it "should return 配送先 都道府県名 and 配送先 住所" do
|
122
|
+
expect(@row.recipient_address).to match(/東京都大田区足柄.+401/)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "#recipient_phone_number" do
|
127
|
+
it "should return 配送先 電話番号" do
|
128
|
+
expect(@row.recipient_phone_number).to eq("0987-65-4321")
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "#wished_delivery_date" do
|
133
|
+
it "should return 配送希望日" do
|
134
|
+
expect(@row.wished_delivery_date).to eq("設定なし")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "#wished_delivery_timezone" do
|
139
|
+
it "should return 配送希望時間" do
|
140
|
+
expect(@row.wished_delivery_timezone).to eq("14時-16時")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "#recipient_labeling" do
|
145
|
+
it "should return 配送先 熨斗(のし)" do
|
146
|
+
expect(@row.recipient_labeling).to eq("のし")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "#recipient_message_card_type" do
|
151
|
+
it "should return 配送先 メッセージカード種類" do
|
152
|
+
expect(@row.recipient_message_card_type).to eq("メッセージカードA")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe "#recipient_message_card_body" do
|
157
|
+
it "should return 配送先 メッセージカード内容" do
|
158
|
+
expect(@row.recipient_message_card_body).to eq("誕生日")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "#recipient_notes" do
|
163
|
+
it "should return 配送先 備考" do
|
164
|
+
expect(@row.recipient_notes).to eq("備考欄です")
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "line item columns" do
|
170
|
+
describe "#line_item_id" do
|
171
|
+
it "should return 売上詳細ID" do
|
172
|
+
expect(@row.line_item_id).to eq("45675678")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe "#line_item_code" do
|
177
|
+
it "should return 購入商品 商品ID" do
|
178
|
+
expect(@row.line_item_code).to eq("56786789")
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
describe "#line_item_unit_price" do
|
183
|
+
it "should return 購入商品 販売価格(消費税込)" do
|
184
|
+
expect(@row.line_item_unit_price).to eq(893)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "#line_item_quantity" do
|
189
|
+
it "should return 購入商品 販売個数" do
|
190
|
+
expect(@row.line_item_quantity).to eq(2)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "label_me"
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: label_me
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OSA Shunsuke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: grafter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Parser and accessor for order CSV file in ColorMe.
|
70
|
+
email:
|
71
|
+
- hhelibebcnofnenamg@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- label_me.gemspec
|
83
|
+
- lib/label_me.rb
|
84
|
+
- lib/label_me/order.rb
|
85
|
+
- lib/label_me/order/customer.rb
|
86
|
+
- lib/label_me/order/line_item.rb
|
87
|
+
- lib/label_me/order/recipient.rb
|
88
|
+
- lib/label_me/sales_all.rb
|
89
|
+
- lib/label_me/sales_all/object.rb
|
90
|
+
- lib/label_me/sales_all/row.rb
|
91
|
+
- lib/label_me/version.rb
|
92
|
+
- spec/csv/sales_all.csv
|
93
|
+
- spec/label_me/order/customer_spec.rb
|
94
|
+
- spec/label_me/order/line_item_spec.rb
|
95
|
+
- spec/label_me/order/recipient_spec.rb
|
96
|
+
- spec/label_me/order_spec.rb
|
97
|
+
- spec/label_me/sales_all/object_spec.rb
|
98
|
+
- spec/label_me/sales_all/row_spec.rb
|
99
|
+
- spec/label_me/sales_all_spec.rb
|
100
|
+
- spec/label_me_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
homepage: ''
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.0.3
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Easy to access ColorMe order CSV.
|
126
|
+
test_files:
|
127
|
+
- spec/csv/sales_all.csv
|
128
|
+
- spec/label_me/order/customer_spec.rb
|
129
|
+
- spec/label_me/order/line_item_spec.rb
|
130
|
+
- spec/label_me/order/recipient_spec.rb
|
131
|
+
- spec/label_me/order_spec.rb
|
132
|
+
- spec/label_me/sales_all/object_spec.rb
|
133
|
+
- spec/label_me/sales_all/row_spec.rb
|
134
|
+
- spec/label_me/sales_all_spec.rb
|
135
|
+
- spec/label_me_spec.rb
|
136
|
+
- spec/spec_helper.rb
|