tindie2easypost 0.1.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 +7 -0
- data/README.md +82 -0
- data/bin/tindie2easypost.rb +125 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1326a63e12d95c6fd0a2671ea3bc922058606268594f82a206740d65011b669d
|
4
|
+
data.tar.gz: e844b0f0545f359a041e7abd4472c3f9f95f78ca61b06cb3a42be44eaa5caa83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '08d53e8569df2c1fd9e659ba9cbaf41f9c5ec0d11ca7172dac04f247e32a0b0ceb5754720dd931c7184228bd4f39f70d6b1ddecf3dd2c9dd6d636723669c1400'
|
7
|
+
data.tar.gz: 1fe9210a45c158b0da89ba2fab56e0b646c90db03d6fdac7ce51e1e2cdef4fbea9600bf8f834954986f7a77d8e5d9fba2d76463fc05620805264a8e3c5f8f6e8
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Tindie2EasyPost CSV Converter
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
This Ruby script converts CSV files exported from Tindie into a format compatible with EasyPost shipping labels. It helps streamline the process of preparing shipping information for small businesses and online sellers.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
- Converts Tindie order CSV to EasyPost-compatible CSV
|
10
|
+
- Command-line interface for easy use
|
11
|
+
- Flexible from-address configuration
|
12
|
+
- Simple and straightforward conversion process
|
13
|
+
|
14
|
+
## Prerequisites
|
15
|
+
|
16
|
+
- Ruby (version 2.7 or higher recommended)
|
17
|
+
- Basic command-line knowledge
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
1. Clone this repository:
|
22
|
+
```bash
|
23
|
+
git clone https://github.com/yourusername/tindie2easypost.git
|
24
|
+
cd tindie2easypost
|
25
|
+
```
|
26
|
+
|
27
|
+
2. Ensure you have Ruby installed:
|
28
|
+
```bash
|
29
|
+
ruby --version
|
30
|
+
```
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
### Basic Usage
|
35
|
+
|
36
|
+
```bash
|
37
|
+
ruby tindie2easypost.rb -i input_tindie_orders.csv -o output_easypost_orders.csv -f 'Your Name,Your Company,Your Phone,Your Email,Your Street,Unit/Suite,Your City,Your State,Your Zip,Your Country'
|
38
|
+
```
|
39
|
+
|
40
|
+
### Command-Line Arguments
|
41
|
+
|
42
|
+
- `-i` or `--input`: Path to the input Tindie CSV file (required)
|
43
|
+
- `-o` or `--output`: Path for the output EasyPost CSV file (required)
|
44
|
+
- `-f` or `--from`: Sender's address details, comma-separated in this order:
|
45
|
+
1. Name
|
46
|
+
2. Company
|
47
|
+
3. Phone
|
48
|
+
4. Email
|
49
|
+
5. Street Address
|
50
|
+
6. Street Address Line 2 (optional)
|
51
|
+
7. City
|
52
|
+
8. State
|
53
|
+
9. Zip/Postal Code
|
54
|
+
10. Country
|
55
|
+
|
56
|
+
### Example
|
57
|
+
|
58
|
+
```bash
|
59
|
+
ruby tindie2easypost.rb -i december_orders.csv -o easypost_shipping.csv -f 'John Doe,Acme Widgets,555-123-4567,john@example.com,123 Business St,Suite 100,Anytown,CA,90210,USA'
|
60
|
+
```
|
61
|
+
|
62
|
+
## Limitations
|
63
|
+
|
64
|
+
- Parcel details (weight, dimensions) are not automatically populated
|
65
|
+
- Carrier information is not automatically filled
|
66
|
+
- Assumes a consistent sender address for all orders
|
67
|
+
|
68
|
+
## Customization
|
69
|
+
|
70
|
+
If you need to add parcel details or carrier information, you can modify the script directly in the conversion method.
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork the repository
|
75
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
76
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
77
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
78
|
+
5. Open a Pull Request
|
79
|
+
|
80
|
+
## License
|
81
|
+
|
82
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
@@ -0,0 +1,125 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
class Tindie2EasyPost
|
7
|
+
def initialize(input_file, output_file, from_address)
|
8
|
+
@input_file = input_file
|
9
|
+
@output_file = output_file
|
10
|
+
@from_address = from_address
|
11
|
+
end
|
12
|
+
|
13
|
+
def convert
|
14
|
+
# Read Tindie CSV
|
15
|
+
tindie_data = CSV.read(@input_file, headers: true)
|
16
|
+
|
17
|
+
# Prepare EasyPost CSV headers
|
18
|
+
easypost_headers = [
|
19
|
+
'to_address.name', 'to_address.company', 'to_address.phone', 'to_address.email',
|
20
|
+
'to_address.street1', 'to_address.street2', 'to_address.city', 'to_address.state',
|
21
|
+
'to_address.zip', 'to_address.country',
|
22
|
+
'from_address.name', 'from_address.company', 'from_address.phone', 'from_address.email',
|
23
|
+
'from_address.street1', 'from_address.street2', 'from_address.city', 'from_address.state',
|
24
|
+
'from_address.zip', 'from_address.country',
|
25
|
+
'parcel.length', 'parcel.width', 'parcel.height', 'parcel.weight',
|
26
|
+
'parcel.predefined_package', 'carrier', 'service'
|
27
|
+
]
|
28
|
+
|
29
|
+
# Write EasyPost CSV
|
30
|
+
CSV.open(@output_file, 'w') do |csv|
|
31
|
+
csv << easypost_headers
|
32
|
+
|
33
|
+
# Predefined from address values
|
34
|
+
from_address_values = [
|
35
|
+
@from_address[:name], # from_address.name
|
36
|
+
@from_address[:company], # from_address.company
|
37
|
+
@from_address[:phone], # from_address.phone
|
38
|
+
@from_address[:email], # from_address.email
|
39
|
+
@from_address[:street1], # from_address.street1
|
40
|
+
@from_address[:street2] || '', # from_address.street2
|
41
|
+
@from_address[:city], # from_address.city
|
42
|
+
@from_address[:state], # from_address.state
|
43
|
+
@from_address[:zip], # from_address.zip
|
44
|
+
@from_address[:country], # from_address.country
|
45
|
+
]
|
46
|
+
|
47
|
+
tindie_data.each do |row|
|
48
|
+
# Map Tindie data to EasyPost format
|
49
|
+
easypost_row = [
|
50
|
+
# To Address
|
51
|
+
"#{row['First Name']} #{row['Last Name']}", # to_address.name
|
52
|
+
row['Company'], # to_address.company
|
53
|
+
row['Phone'], # to_address.phone
|
54
|
+
row['Email'], # to_address.email
|
55
|
+
row['Street'], # to_address.street1
|
56
|
+
'', # to_address.street2 (empty if not in Tindie)
|
57
|
+
row['City'], # to_address.city
|
58
|
+
row['State/Province'], # to_address.state
|
59
|
+
row['Postal/Zip Code'], # to_address.zip
|
60
|
+
row['Country'], # to_address.country
|
61
|
+
|
62
|
+
# From Address (using predefined values)
|
63
|
+
*from_address_values,
|
64
|
+
|
65
|
+
# Parcel details (you'll need to customize these)
|
66
|
+
'', # parcel.length
|
67
|
+
'', # parcel.width
|
68
|
+
'', # parcel.height
|
69
|
+
'', # parcel.weight
|
70
|
+
'', # parcel.predefined_package
|
71
|
+
'', # carrier
|
72
|
+
row['Shipping Method'] # service
|
73
|
+
]
|
74
|
+
|
75
|
+
csv << easypost_row
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
puts "Conversion complete. Output saved to #{@output_file}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Command-line argument parsing
|
84
|
+
options = {}
|
85
|
+
OptionParser.new do |opts|
|
86
|
+
opts.banner = "Usage: tindie2easypost.rb [options]"
|
87
|
+
|
88
|
+
opts.on("-i", "--input INPUT", "Input Tindie CSV file") do |input|
|
89
|
+
options[:input] = input
|
90
|
+
end
|
91
|
+
|
92
|
+
opts.on("-o", "--output OUTPUT", "Output EasyPost CSV file") do |output|
|
93
|
+
options[:output] = output
|
94
|
+
end
|
95
|
+
|
96
|
+
opts.on("-f", "--from NAME,COMPANY,PHONE,EMAIL,STREET1,STREET2,CITY,STATE,ZIP,COUNTRY", Array, "From Address Details") do |from_details|
|
97
|
+
options[:from_address] = {
|
98
|
+
name: from_details[0],
|
99
|
+
company: from_details[1],
|
100
|
+
phone: from_details[2],
|
101
|
+
email: from_details[3],
|
102
|
+
street1: from_details[4],
|
103
|
+
street2: from_details[5],
|
104
|
+
city: from_details[6],
|
105
|
+
state: from_details[7],
|
106
|
+
zip: from_details[8],
|
107
|
+
country: from_details[9]
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end.parse!
|
111
|
+
|
112
|
+
# Validate required arguments
|
113
|
+
unless options[:input] && options[:output] && options[:from_address]
|
114
|
+
puts "Error: Missing required arguments"
|
115
|
+
puts "Usage: ruby tindie2easypost.rb -i input.csv -o output.csv -f 'Your Name,Your Company,Phone,Email,Street1,Street2,City,State,Zip,Country'"
|
116
|
+
exit 1
|
117
|
+
end
|
118
|
+
|
119
|
+
# Run conversion
|
120
|
+
converter = Tindie2EasyPost.new(
|
121
|
+
options[:input],
|
122
|
+
options[:output],
|
123
|
+
options[:from_address]
|
124
|
+
)
|
125
|
+
converter.convert
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tindie2easypost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Spencer Owen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: csv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.14'
|
55
|
+
description: A utility script to transform Tindie order exports into EasyPost-compatible
|
56
|
+
CSV files for shipping label generation.
|
57
|
+
email:
|
58
|
+
- owenspencer@example.com
|
59
|
+
executables:
|
60
|
+
- tindie2easypost.rb
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- README.md
|
65
|
+
- bin/tindie2easypost.rb
|
66
|
+
homepage: https://github.com/spuder/tindie2easypost
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.7.0
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubygems_version: 3.0.3.1
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Convert Tindie CSV files to EasyPost shipping format
|
89
|
+
test_files: []
|