borderbot 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d2274f6905c2b8d416d8ac0d29214394e413bfaf
4
+ data.tar.gz: 9e690424ba3f69d305ca780844ace37e8437f3a3
5
+ SHA512:
6
+ metadata.gz: 1c57b153a324d1315c46432125a3126feaf503f27fbeebea6bb37047733236c1dea029185f9f2d381991df3013d5e78bbf818fc7ca29fe12def05f6c365c6629
7
+ data.tar.gz: a00f6c267fbd995106e6829364f32f67936d572acf493d4592cc9d803a3054b861359e6efb8d13fd1c771231eab985c19d38982cd62b7758e67e8d0d7ffd0db8
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at burguer@gmail.com . All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gem 'nokogiri'
3
+ # Specify your gem's dependencies in borderbot.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sergio Burgueño
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
2
+ [![Build Status](https://travis-ci.org/burguer80/borderbot.svg?branch=master)](https://travis-ci.org/burguer80/borderbot)
3
+ <!--
4
+
5
+
6
+ <!-- [![Coverage Status](https://coveralls.io/repos/github/burguer80/borderbot/badge.svg?branch=master)](https://coveralls.io/github/burguer80/borderbot?branch=master) -->
7
+ -->
8
+ # Borderbot
9
+
10
+ Borderbot is a easy way to get the border wait times from
11
+ [U.S. Customs and Border Protection Border Wait Times](https://bwt.cbp.gov).
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'borderbot'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install borderbot
28
+
29
+ ## Usage
30
+ Tell Borderbot do his job.
31
+ ```ruby
32
+ agent = Borderbot.go #To fetch, parse, sort and optimize the data.
33
+ ```
34
+
35
+ Access Borderbot Agent data.
36
+ ```ruby
37
+ agent.ports # Array with ports data
38
+ agent.bwt_url # XML url from Border Wait Times
39
+ agent.executed_at # Date and time from the execution time
40
+ ```
41
+ Ports array skeleton
42
+ ```ruby
43
+ agent.ports.class #=> Array
44
+ agent.ports[0].keys #=> [:updateTime, :portNumber, :portStatus, :portName, :crossingName, :data]
45
+ agent.ports[0][:updateTime].strftime("%A %b %d %H:%M") #=> "Wednesday Feb 22 17:00"
46
+ agent.ports[0][:portNumber] #=> "250301"
47
+ agent.ports[0][:portStatus] #=> "Open"
48
+ agent.ports[0][:portName] #=> "Calexico"
49
+ agent.ports[0][:crossingName] #=> "East"
50
+ ```
51
+
52
+
53
+ Ports array skeleton
54
+ ```ruby
55
+ agent.ports[0][:data]
56
+ ## This is the data skeleton, so if there is data related to the port Borderbot will create a hash key/value with the port data, but if there is no valid data value ex.(N/A, null) it will be excluded, so Borderbot will return a Array optimized including only the meaningful data.
57
+
58
+ ```
59
+
60
+ Port data sample **agent.ports[0][:data]**
61
+ ```ruby
62
+ agent.ports[0][:data]
63
+ #=>
64
+ {
65
+ :commercial => {
66
+ :standard_lanes => {
67
+ :operational_status => "no delay",
68
+ :lanes_open => 2,
69
+ :delay_minutes => 5
70
+ },
71
+ :FAST_lanes => {
72
+ :operational_status => "no delay",
73
+ :lanes_open => 1,
74
+ :delay_minutes => 0
75
+ }
76
+ },
77
+ :passenger => {
78
+ :NEXUS_SENTRI_lanes => {
79
+ :operational_status => "no delay",
80
+ :lanes_open => 1,
81
+ :delay_minutes => 0
82
+ },
83
+ :ready_lanes => {
84
+ :operational_status => "delay",
85
+ :lanes_open => 4,
86
+ :delay_minutes => 10
87
+ },
88
+ :standard_lanes => {
89
+ :operational_status => "delay",
90
+ :lanes_open => 2,
91
+ :delay_minutes => 15
92
+ }
93
+ },
94
+ :pedestrian => {
95
+ :standard_lanes => {
96
+ :operational_status => "no delay",
97
+ :lanes_open => 2,
98
+ :delay_minutes => 0
99
+ }
100
+ },
101
+ :construction_notice => {
102
+ :"#cdata-section" => "Calexico/East Ready Lane is open west side of port; Passenger Hrs Mon-Fri 3:00AM to Midnight, Sat/Sun 6:00AM to Midnight. Go to www.getyouhome.gov for info. Tune into AM 1610 for border crossing info"
103
+ }
104
+ }
105
+ ```
106
+
107
+
108
+ ## Contributing to Borderbot gem
109
+
110
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/borderbot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
111
+
112
+
113
+ ## License
114
+
115
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "borderbot"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/borderbot.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'borderbot/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "borderbot"
8
+ spec.version = Borderbot::VERSION
9
+ spec.authors = ["Sergio Burgueño"]
10
+ spec.email = ["burguer@gmail.com"]
11
+
12
+ spec.summary = %q{Borders wait times for ruby programmers}
13
+ spec.description = %q{Get latest borders wait time from U.S. Customs and Border Patrol website parsed as a ruby easy to use hash}
14
+ spec.homepage = "https://github.com/burguer80/borderbot"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.13"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "coveralls"
30
+ end
data/coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/lib/borderbot.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "borderbot/version"
2
+ require "borderbot/agent"
3
+
4
+ module Borderbot
5
+ def self.go
6
+ Agent.new
7
+ end
8
+ end
@@ -0,0 +1,29 @@
1
+ # Welcome to the Agent Class
2
+ # this is a a clone of a Borderbot
3
+ # it will obbey ruby programmers.
4
+
5
+ require "borderbot/qcore"
6
+
7
+ class Agent
8
+ attr_reader :bwt_url, :executed_at, :ports
9
+
10
+ def initialize
11
+ @bwt_url = Qcore.new.bwt_url
12
+ @ports = nil
13
+ @executed_at = nil
14
+ compute
15
+ end
16
+
17
+ def compute
18
+ #New Query Core instance
19
+ queryCore = Qcore.new
20
+ #Get XML data from BWT website
21
+ bwtXML = queryCore.get_bwt_xml_data
22
+ #set the ordereded ports into @ports
23
+ @ports = queryCore.extract_ports(bwtXML)
24
+ #set the last execution time
25
+ @executed_at = DateTime.now
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,150 @@
1
+ # Welcome to Dcore( Data Sorting Core )
2
+ # Here is where all data is sorted.
3
+ require "borderbot/hash"
4
+
5
+ class Dcore
6
+
7
+ def zortificate_ports(bwtXML)
8
+ #bwtXML converted to hash for easy usage
9
+ bwtHASH = Hash.from_xml(bwtXML.to_s)
10
+ #ports array
11
+ ports = []
12
+
13
+ for port in bwtHASH[:border_wait_time][:port]
14
+ crossingName, portName, updateTime, portNumber, portStatus, data = parsePortData(port)
15
+ zortificatedPort = {
16
+ updateTime: updateTime,
17
+ portNumber: portNumber,
18
+ portStatus: portStatus,
19
+ portName: portName,
20
+ crossingName: crossingName,
21
+ data: data
22
+ }
23
+ ports.push(zortificatedPort)
24
+ end
25
+ return ports
26
+ end
27
+
28
+ def parsePortData(port)
29
+ #Get Update time
30
+ updateTime = getUpdateTime(port)
31
+ if !updateTime.nil?
32
+ #Get Data values
33
+ data = getPortData(port)
34
+ #Get Port status value
35
+ portStatus = port[:port_status]
36
+ #Get Port number
37
+ portNumber = port[:port_number]
38
+ #get port name
39
+ portName = port[:port_name]
40
+ #get port name
41
+ crossingName = port[:crossing_name]
42
+ #Return to DataPort()
43
+ return [crossingName, portName, updateTime, portNumber, portStatus, data]
44
+ else
45
+ return nil
46
+ end
47
+ end
48
+
49
+ def getUpdateTime(port)
50
+ dateStr = port[:date]
51
+
52
+ #check all options
53
+ updateTimesArray = []
54
+ if port[:commercial_vehicle_lanes][:standard_lanes][:update_time] != nil then updateTimesArray.push(port[:commercial_vehicle_lanes][:standard_lanes][:update_time]) end
55
+ if port[:commercial_vehicle_lanes][:FAST_lanes][:update_time] != nil then updateTimesArray.push(port[:commercial_vehicle_lanes][:FAST_lanes][:update_time]) end
56
+ if port[:passenger_vehicle_lanes][:NEXUS_SENTRI_lanes][:update_time] != nil then updateTimesArray.push(port[:passenger_vehicle_lanes][:NEXUS_SENTRI_lanes][:update_time]) end
57
+ if port[:passenger_vehicle_lanes][:ready_lanes][:update_time] != nil then updateTimesArray.push(port[:passenger_vehicle_lanes][:ready_lanes][:update_time]) end
58
+ if port[:passenger_vehicle_lanes][:standard_lanes][:update_time] != nil then updateTimesArray.push(port[:passenger_vehicle_lanes][:standard_lanes][:update_time]) end
59
+ if port[:pedestrian_lanes][:ready_lanes][:update_time] != nil then updateTimesArray.push(port[:pedestrian_lanes][:ready_lanes][:update_time]) end
60
+ if port[:pedestrian_lanes][:standard_lanes][:update_time] != nil then updateTimesArray.push(port[:pedestrian_lanes][:standard_lanes][:update_time]) end
61
+
62
+ if updateTimesArray.size > 0 && updateTimesArray.uniq.size == 1 && updateTimesArray[0].class == String
63
+ timeStr = updateTimesArray[0]
64
+ timeStr = timeStr.gsub('Noon', '12:00 pm')
65
+ timeStr = timeStr.gsub('Midnight', '12:00 am')
66
+ timeStr = timeStr.gsub(' 0:', ' 12:')
67
+ timeCleaned = timeStr.slice(3, timeStr.length)
68
+ response = DateTime.strptime(dateStr + ' ' + timeCleaned, '%m/%d/%Y %I:%M %p %Z')
69
+ else
70
+ response = nil
71
+ end
72
+ return response
73
+ end
74
+
75
+ def getLaneData(lane)
76
+ laneData = {}
77
+ case lane[:operational_status]
78
+ when 'N/A'
79
+ laneData[:operational_status] = 'N/A'
80
+
81
+ when 'Lanes Closed'
82
+ laneData[:operational_status] = 'Lanes Closed'
83
+
84
+ when 'no delay'
85
+ laneData[:operational_status] = 'no delay'
86
+ laneData[:lanes_open] = lane[:lanes_open].to_i
87
+ laneData[:delay_minutes] = lane[:delay_minutes].to_i
88
+
89
+ when 'delay'
90
+ laneData[:operational_status] = 'delay'
91
+ laneData[:lanes_open] = lane[:lanes_open].to_i
92
+ laneData[:delay_minutes] = lane[:delay_minutes].to_i
93
+
94
+ else
95
+ laneData = nil
96
+ end
97
+
98
+ return laneData
99
+ end
100
+
101
+ def isAvailable(lane)
102
+ isAvailable = false
103
+ if lane[:operational_status] != 'N/A'
104
+ isAvailable = true
105
+ end
106
+ return isAvailable
107
+ end
108
+
109
+ def getPortData(port)
110
+ # Get Details values
111
+ laneData = {
112
+ commercial: {},
113
+ passenger: {},
114
+ pedestrian: {}
115
+ }
116
+
117
+ #Get Commercial Lanes
118
+ commercialStandardLanes = getLaneData(port[:commercial_vehicle_lanes][:standard_lanes])
119
+ if isAvailable(commercialStandardLanes) then laneData[:commercial].merge!(standard_lanes: commercialStandardLanes) end
120
+ commercialFastLanes = getLaneData(port[:commercial_vehicle_lanes][:FAST_lanes])
121
+ if isAvailable(commercialFastLanes) then laneData[:commercial].merge!(FAST_lanes: commercialFastLanes) end
122
+ #Delete commercial key if is empty
123
+ if laneData[:commercial].empty? then laneData.delete(:commercial) end
124
+
125
+ #Get Passenger Lanes
126
+ passengerNexusSentriLanes = getLaneData(port[:passenger_vehicle_lanes][:NEXUS_SENTRI_lanes])
127
+ if isAvailable(passengerNexusSentriLanes) then laneData[:passenger].merge!(NEXUS_SENTRI_lanes: passengerNexusSentriLanes) end
128
+ passengerReadyLanes = getLaneData(port[:passenger_vehicle_lanes][:ready_lanes])
129
+ if isAvailable(passengerReadyLanes) then laneData[:passenger].merge!(ready_lanes: passengerReadyLanes) end
130
+ passengerStandardLanes = getLaneData(port[:passenger_vehicle_lanes][:standard_lanes])
131
+ if isAvailable(passengerStandardLanes) then laneData[:passenger].merge!(standard_lanes: passengerStandardLanes) end
132
+ #Delete commercial key if is empty
133
+ if laneData[:passenger].empty? then laneData.delete(:passenger) end
134
+
135
+ #Get Pedestrian Lanes
136
+ pedestrianReadyLanes = getLaneData(port[:pedestrian_lanes][:ready_lanes])
137
+ if isAvailable(pedestrianReadyLanes) then laneData[:pedestrian].merge!( ready_lanes: pedestrianReadyLanes ) end
138
+ pedestrianStandardLanes = getLaneData(port[:pedestrian_lanes][:standard_lanes])
139
+ if isAvailable(pedestrianStandardLanes) then laneData[:pedestrian].merge!( standard_lanes: pedestrianStandardLanes ) end
140
+ #Delete commercial key if is empty
141
+ if laneData[:pedestrian].empty? then laneData.delete(:pedestrian) end
142
+
143
+ constructionNotice = port[:construction_notice]
144
+ if constructionNotice != nil && constructionNotice.empty? == false
145
+ laneData[:construction_notice] = constructionNotice
146
+ end
147
+
148
+ return laneData
149
+ end
150
+ end
@@ -0,0 +1,56 @@
1
+ class Hash
2
+ class << self
3
+ def from_xml(xml_io)
4
+ begin
5
+ result = Nokogiri::XML(xml_io)
6
+ return { result.root.name.to_sym => xml_node_to_hash(result.root)}
7
+ rescue Exception => e
8
+ # raise your custom exception here
9
+ end
10
+ end
11
+
12
+ def xml_node_to_hash(node)
13
+ # If we are at the root of the document, start the hash
14
+ if node.element?
15
+ result_hash = {}
16
+ if node.attributes != {}
17
+ attributes = {}
18
+ node.attributes.keys.each do |key|
19
+ attributes[node.attributes[key].name.to_sym] = node.attributes[key].value
20
+ end
21
+ end
22
+ if node.children.size > 0
23
+ node.children.each do |child|
24
+ result = xml_node_to_hash(child)
25
+
26
+ if child.name == "text"
27
+ unless child.next_sibling || child.previous_sibling
28
+ return result unless attributes
29
+ result_hash[child.name.to_sym] = result
30
+ end
31
+ elsif result_hash[child.name.to_sym]
32
+
33
+ if result_hash[child.name.to_sym].is_a?(Object::Array)
34
+ result_hash[child.name.to_sym] << result
35
+ else
36
+ result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << result
37
+ end
38
+ else
39
+ result_hash[child.name.to_sym] = result
40
+ end
41
+ end
42
+ if attributes
43
+ #add code to remove non-data attributes e.g. xml schema, namespace here
44
+ #if there is a collision then node content supersets attributes
45
+ result_hash = attributes.merge(result_hash)
46
+ end
47
+ return result_hash
48
+ else
49
+ return attributes
50
+ end
51
+ else
52
+ return node.content.to_s
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,23 @@
1
+ # Welcome to Qcore(Query Core)
2
+ require 'nokogiri'
3
+ require 'open-uri'
4
+ require "borderbot/dcore"
5
+
6
+ class Qcore
7
+ attr_accessor :bwt_url
8
+
9
+ def initialize
10
+ @bwt_url = 'https://apps.cbp.gov/bwt/bwt.xml'
11
+ end
12
+
13
+ def get_bwt_xml_data
14
+ bwtXML = Nokogiri::XML(open("https://apps.cbp.gov/bwt/bwt.xml"))
15
+ return bwtXML
16
+ end
17
+
18
+ def extract_ports(bwtXML)
19
+ ports = Dcore.new.zortificate_ports(bwtXML)
20
+ return ports
21
+ end
22
+
23
+ end
@@ -0,0 +1,3 @@
1
+ module Borderbot
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: borderbot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Sergio Burgueño
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-23 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.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: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
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: Get latest borders wait time from U.S. Customs and Border Patrol website
70
+ parsed as a ruby easy to use hash
71
+ email:
72
+ - burguer@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - CODE_OF_CONDUCT.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - borderbot.gemspec
88
+ - coveralls.yml
89
+ - lib/borderbot.rb
90
+ - lib/borderbot/agent.rb
91
+ - lib/borderbot/dcore.rb
92
+ - lib/borderbot/hash.rb
93
+ - lib/borderbot/qcore.rb
94
+ - lib/borderbot/version.rb
95
+ homepage: https://github.com/burguer80/borderbot
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.5.1
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Borders wait times for ruby programmers
119
+ test_files: []