autoluv 0.2.3 → 0.3.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/Gemfile +2 -0
- data/README.md +24 -2
- data/lib/autoluv/southwestclient.rb +14 -1
- data/lib/autoluv/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d51c73c3127c1247d9aa92393cb6564946e0f59fadd1e40fd50c5b01c3c1ee4
|
4
|
+
data.tar.gz: 2533c26d888db4d95cafc1165d59423d2d287485a85a271e74b3687dabb7bfb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de5f6df35800981ad99500975c96143d8596ab5cd42437e335c622e246d0dde50ee5790ee134e7eb2356324a5d0a53c993ff6f1101c659bf71dc6161c6033546
|
7
|
+
data.tar.gz: c70a7031a4e27844ff6cfd1579c42b6e746abeca6488d57075a025a17409105d27c85f89365734651e57b9d3e0b79e4776d6c69fcfb837ecde68ce2a1cd61047
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,28 @@ Tested and working on an Ubuntu 20.04 server (hosted by DigitalOcean).
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
+
### Get Southwest Headers
|
16
|
+
|
17
|
+
The Southwest API now requires some randomly generated headers to check in. Because these headers change at a set interval, they need to be constantly refreshed for any check-in script (like this one) to work. To get these headers, please follow the instructions here:
|
18
|
+
|
19
|
+
https://github.com/byalextran/southwest-headers
|
20
|
+
|
21
|
+
Once a cron job has been scheduled, do these steps:
|
22
|
+
|
23
|
+
**Step 1:** Create the file `.autoluv.env` in your user's home directory.
|
24
|
+
|
25
|
+
nano ~/.autoluv.env
|
26
|
+
|
27
|
+
**Step 2:** Copy/paste the following into the text editor.
|
28
|
+
|
29
|
+
LUV_HEADERS_FILE = /PATH/TO/southwest_headers.json
|
30
|
+
|
31
|
+
**Step 3:** Update the path (and filename if changed from the default) to the correct path of the headers file.
|
32
|
+
|
33
|
+
**Step 4:** Hit `Ctrl+O` to save the file and then `Ctrl+X` to exit the text editor.
|
34
|
+
|
35
|
+
### Install Gem
|
36
|
+
|
15
37
|
gem install autoluv
|
16
38
|
|
17
39
|
## Usage
|
@@ -42,7 +64,7 @@ This is optional, however, highly recommended. Especially if a scheduled check-i
|
|
42
64
|
|
43
65
|
Boarding positions are shown for each passenger when a check-in succeeds.
|
44
66
|
|
45
|
-
**Step 1:**
|
67
|
+
**Step 1:** Open/create the file `.autoluv.env` in your user's home directory.
|
46
68
|
|
47
69
|
nano ~/.autoluv.env
|
48
70
|
|
@@ -68,7 +90,7 @@ To verify your SMTP settings, schedule a check-in with invalid information and a
|
|
68
90
|
|
69
91
|
autoluv schedule AAAAAA Fake Name valid@email.com
|
70
92
|
|
71
|
-
If everything is set up correctly, you'll get an email notifying you of an unsuccessful check-in.
|
93
|
+
If everything is set up correctly, you'll get an email notifying you of an unsuccessful check-in.
|
72
94
|
|
73
95
|
### Get Text Instead of Email Notifications
|
74
96
|
|
@@ -3,6 +3,9 @@ require "securerandom"
|
|
3
3
|
require "json"
|
4
4
|
require "tzinfo"
|
5
5
|
require "shellwords"
|
6
|
+
require "dotenv"
|
7
|
+
|
8
|
+
Dotenv.load("#{Dir.home}/.autoluv.env")
|
6
9
|
|
7
10
|
module Autoluv
|
8
11
|
class SouthwestClient
|
@@ -19,6 +22,8 @@ module Autoluv
|
|
19
22
|
TIME_ZONES_PATH = File.expand_path("../../data/airport_time_zones.json", __dir__)
|
20
23
|
|
21
24
|
def self.schedule(confirmation_number, first_name, last_name, to = nil, bcc = nil)
|
25
|
+
self.check_for_header_file
|
26
|
+
|
22
27
|
flights = self.departing_flights(confirmation_number, first_name, last_name)
|
23
28
|
|
24
29
|
flights.each_with_index do |flight, x|
|
@@ -34,6 +39,8 @@ module Autoluv
|
|
34
39
|
end
|
35
40
|
|
36
41
|
def self.check_in(confirmation_number, first_name, last_name, to = nil, bcc = nil)
|
42
|
+
self.check_for_header_file
|
43
|
+
|
37
44
|
check_in = attempt = nil
|
38
45
|
|
39
46
|
# try checking in multiple times in case the our server time is out of sync with Southwest's.
|
@@ -45,7 +52,7 @@ module Autoluv
|
|
45
52
|
begin
|
46
53
|
attempt = x + 1
|
47
54
|
post_data = self.check_in_post_data(confirmation_number, first_name, last_name)
|
48
|
-
check_in = RestClient.post("#{CHECK_IN_URL}", post_data.to_json,
|
55
|
+
check_in = RestClient.post("#{CHECK_IN_URL}", post_data.to_json, JSON.parse(File.read(ENV["LUV_HEADERS_FILE"])))
|
49
56
|
break
|
50
57
|
rescue RestClient::ExceptionWithResponse => ewr
|
51
58
|
sleep(1)
|
@@ -87,6 +94,12 @@ module Autoluv
|
|
87
94
|
DEFAULT_HEADERS.merge({ "X-User-Experience-ID": SecureRandom.uuid })
|
88
95
|
end
|
89
96
|
|
97
|
+
def self.check_for_header_file
|
98
|
+
unless File.exist?(ENV["LUV_HEADERS_FILE"])
|
99
|
+
abort "Please create a valid Southwest header file before continuing. Learn more: https://github.com/byalextran/southwest-headers"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
90
103
|
def self.departing_flights(confirmation_number, first_name, last_name)
|
91
104
|
reservation = RestClient.get("#{RESERVATION_URL}/#{confirmation_number}?first-name=#{first_name}&last-name=#{last_name}", self.headers)
|
92
105
|
reservation_json = JSON.parse(reservation)
|
data/lib/autoluv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoluv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Tran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.2.32
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Easy-to-use gem to check in to Southwest flights automatically. Also supports
|