uscis_status 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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGEwMmFlNjY1YTRhOTg4ZjhkODNhOWY5OGE3NGQ2MzM0NjIwNjBlNw==
5
+ data.tar.gz: !binary |-
6
+ NWI1NDM0MTk4MjhlOWZiZjg3NTRiMDQyNmQ0ZTMwMjY2ZGVmOTBhZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YjIyMzMwYmJkNDgxYjYyODViYWQxZDZmZjhhYzRiNTU1YTBiYzhmOTNkZmY1
10
+ YzE2OTdkYzFjMzYwYzhhYzU3Y2M1NmUzM2M1ODU5NzQ0OGFlM2Y3NWYzN2M3
11
+ ZmMzNmU3MjlkOTIxOWQ0MzE3NzUwY2NhZmY0Yjk5MjQyYzg3YzM=
12
+ data.tar.gz: !binary |-
13
+ NzVkYTExY2UwNDFiZWNkNjg5YjUyMTM1MDYzZmUwMTg3NWUzN2ZmMmU0MDE5
14
+ YzUxYTM2ZmM0YzUwMWQyYTc2ODZkNGU3ZjhlMGJjN2MyNzkxYWEwM2YzOGEz
15
+ N2ExMzNkMDY5MWUzMWE1OWYzNTNiMTNhOWQyZDg5ZGQ1NGY0ZTY=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in uscis_status.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Guillermo Guerini
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,55 @@
1
+ # USCIS Status Checker
2
+
3
+ Easy way to check multiple application statuses from USCIS website.
4
+
5
+ ## Important
6
+
7
+ This is not the official way to check the status of a USCIS application and it's not endorsed by USCIS either.
8
+ It's just a scraper of the USCIS website and it may break at any time if the website is updated. If it should happen, feel free to report me or to [fix](#contributing) the problem.
9
+
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'uscis_status'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install uscis_status
24
+
25
+ ## Usage
26
+
27
+ require 'uscis_status'
28
+
29
+ # Array with multiple application numbers
30
+ app_numbers = %w(MSC0123456789 MSC9876543210 MSC0213547698)
31
+ # Or single application number
32
+ app_numbers = "MSC0123456789"
33
+
34
+ statuses = USCISStatus.check(app_numbers)
35
+ statuses.each do |s|
36
+ puts "The status of your application number #{s[:number]} is: #{s[:status]}."
37
+ end
38
+
39
+ #The method 'check' returns an array with the following hash:
40
+ {
41
+ :number => "MSC0123456789",
42
+ :type => "Form I485, Application To Register Permanent Residence Or To Adjust Status",
43
+ :status => "Acceptance",
44
+ :description => "On March 20, 2013, your fingerprint fee was accepted and we have mailed...",
45
+ :general_description => "During the acceptance step USCIS reviews newly received applications and..."
46
+ }
47
+
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,57 @@
1
+ require "uscis_status/version"
2
+ require 'mechanize'
3
+ require 'nokogiri'
4
+
5
+ module USCISStatus
6
+ CURRENT_CASE = "Your Current Case Status for"
7
+
8
+ def self.check(application_numbers)
9
+
10
+ # Check if the parameter is an Array, otherwise create one
11
+ applications = application_numbers.kind_of?(Array) ? application_numbers : application_numbers.split
12
+
13
+ a = Mechanize.new
14
+ statuses = []
15
+
16
+ applications.each do |number|
17
+ next if number.nil? or number.empty?
18
+
19
+ page = a.post("https://egov.uscis.gov/cris/Dashboard/CaseStatus.do", { "appReceiptNum" => number })
20
+
21
+ # Look for possible errors with this application number
22
+ error = page.search('div.errorContainer > ul')
23
+ if !error.empty?
24
+ statuses << {number: number, type: '', status: error.text.strip, description: '', general_description: ''}
25
+ next
26
+ end
27
+
28
+ # Get the application type and description (eg. Form I130...)
29
+ application_type = capitalize_words(page.search('div#caseStatus>h3').text.gsub(CURRENT_CASE, ""))
30
+
31
+ # Get current application block
32
+ current_application = page.search('div.caseStatusInfo')
33
+
34
+ # Get the Status
35
+ status = current_application.search('h4').text.strip
36
+
37
+ # Get the Description
38
+ description = current_application.search('.caseStatus').text.strip
39
+
40
+ # Get the General Description for the Application
41
+ general_description = current_application.search('#bucketDesc').text.strip
42
+
43
+ statuses << {number: number, type: application_type, status: status, description: description, general_description: general_description}
44
+
45
+ end
46
+
47
+ return statuses
48
+
49
+ end
50
+
51
+ private
52
+
53
+ def self.capitalize_words(sentence)
54
+ sentence.strip.split(' ').map{ |word| word.capitalize }.join(' ')
55
+ end
56
+
57
+ end
@@ -0,0 +1,3 @@
1
+ module USCISStatus
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'uscis_status/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "uscis_status"
8
+ spec.version = USCISStatus::VERSION
9
+ spec.authors = ["Guillermo Guerini"]
10
+ spec.email = ["guillermo@gguerini.com"]
11
+ spec.description = "USCIS Status Checker"
12
+ spec.summary = "Easy way to check multiple application statuses from USCIS website."
13
+ spec.homepage = "https://github.com/gguerini/uscis_status"
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
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uscis_status
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Guillermo Guerini
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-06 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
+ description: USCIS Status Checker
42
+ email:
43
+ - guillermo@gguerini.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/uscis_status.rb
54
+ - lib/uscis_status/version.rb
55
+ - uscis_status.gemspec
56
+ homepage: https://github.com/gguerini/uscis_status
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.3
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Easy way to check multiple application statuses from USCIS website.
80
+ test_files: []