autoluv 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/autoluv +4 -0
- data/lib/autoluv/southwestclient.rb +0 -13
- data/lib/autoluv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6041a300159cacdee0647a8d80cdc02455a9d3b75c05fa3a0425083635975f41
|
4
|
+
data.tar.gz: 31f5f4315884761e5943c7f89fe741b985c7f3eb75adab347c693fd1913ef445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e7b8092eb200f0fd8a4db123707fecb6115b325f110bac8b0fbb093e53ece3172c969201faf59fd0ad784b97ed54ba33d39779b577db9f5908d413e057c1035
|
7
|
+
data.tar.gz: e4ed6cf0e6149f4acffbcb4b435829d47ac1031f70f35d0b891b3f2658635082879e9ab6d38114322b9454693f5ac0b5d3a3e23d7df94739178038d0f5f6c401
|
data/bin/autoluv
CHANGED
@@ -10,6 +10,10 @@ to = ARGV[4]
|
|
10
10
|
bcc = ARGV[5]
|
11
11
|
|
12
12
|
begin
|
13
|
+
unless File.exist?(ENV["LUV_HEADERS_FILE"].to_s)
|
14
|
+
abort "Please create a valid Southwest header file before continuing. Learn more: https://github.com/byalextran/southwest-headers"
|
15
|
+
end
|
16
|
+
|
13
17
|
case command.downcase
|
14
18
|
when "schedule"
|
15
19
|
Autoluv::SouthwestClient.schedule(confirmation_number, first_name, last_name, to, bcc)
|
@@ -3,9 +3,6 @@ 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")
|
9
6
|
|
10
7
|
module Autoluv
|
11
8
|
class SouthwestClient
|
@@ -22,8 +19,6 @@ module Autoluv
|
|
22
19
|
TIME_ZONES_PATH = File.expand_path("../../data/airport_time_zones.json", __dir__)
|
23
20
|
|
24
21
|
def self.schedule(confirmation_number, first_name, last_name, to = nil, bcc = nil)
|
25
|
-
self.check_for_header_file
|
26
|
-
|
27
22
|
flights = self.departing_flights(confirmation_number, first_name, last_name)
|
28
23
|
|
29
24
|
flights.each_with_index do |flight, x|
|
@@ -39,8 +34,6 @@ module Autoluv
|
|
39
34
|
end
|
40
35
|
|
41
36
|
def self.check_in(confirmation_number, first_name, last_name, to = nil, bcc = nil)
|
42
|
-
self.check_for_header_file
|
43
|
-
|
44
37
|
check_in = attempt = nil
|
45
38
|
|
46
39
|
# try checking in multiple times in case the our server time is out of sync with Southwest's.
|
@@ -94,12 +87,6 @@ module Autoluv
|
|
94
87
|
DEFAULT_HEADERS.merge({ "X-User-Experience-ID": SecureRandom.uuid })
|
95
88
|
end
|
96
89
|
|
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
|
-
|
103
90
|
def self.departing_flights(confirmation_number, first_name, last_name)
|
104
91
|
reservation = RestClient.get("#{RESERVATION_URL}/#{confirmation_number}?first-name=#{first_name}&last-name=#{last_name}", self.headers)
|
105
92
|
reservation_json = JSON.parse(reservation)
|
data/lib/autoluv/version.rb
CHANGED