iva_gem 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eafcf0b4292c360b10a3e5fafbf161616cf5d3b8
4
+ data.tar.gz: 0f6f03c1d8e3a12c4fe20aabc16664b33c672e08
5
+ SHA512:
6
+ metadata.gz: 2c407f33d417c09113bce6191c4061eaccce30ff779deb841b09aa284a2f8c762ad5d653ca5bdaf1dffa39169b5908a1f11891eb919a998e6b6baa2d8b66bb94
7
+ data.tar.gz: 9ee39e2a0b3b4e247b77d0194cbe4627cb162c3eb3363b00e3b277a1ed58259f29f867e0089b23feb5a6ac5304cb745d4bef2218e7e64a4cfe3b89a4ec22dc35
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
16
+ *_ignoreme.*
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - ruby-head
5
+ - 1.9.3
6
+
7
+ branches:
8
+ only:
9
+ - master
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in iva_gem.gemspec
4
+ gemspec
5
+
6
+ gem 'nokogiri'
7
+ gem 'sinatra'
8
+ gem 'json'
9
+
10
+ group :test do
11
+ gem 'rake'
12
+ gem 'minitest'
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Edwin Mejia
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,33 @@
1
+ [![Build Status](https://travis-ci.org/eddwin/iva_gem.svg?branch=master)](https://travis-ci.org/eddwin/iva_gem)
2
+
3
+ # IvaGem
4
+
5
+ TODO: Write a gem description
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'iva_gem'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install iva_gem
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/[my-github-username]/iva_gem/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ task :default => [:specs]
5
+
6
+ desc "Run specs"
7
+ task :specs do
8
+ sh 'ruby -I lib spec/test.rb'
9
+ end
data/iva_gem.gemspec ADDED
@@ -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 'iva_gem/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "iva_gem"
8
+ spec.version = IvaGem::VERSION
9
+ spec.authors = ["Edwin Mejia"]
10
+ spec.email = ["eddwin@live.com"]
11
+ spec.summary = 'Looks for final date of El Salvadors IVA tax submission'
12
+ spec.description = 'Retrieves the final date for submitting tax sheet'
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,26 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ module IvaSearch
5
+ class Tax
6
+ URL_HACIENDA = 'http://www.mh.gob.sv/portal/page/portal/PMH/Novedades/Calendario'
7
+ CALENDAR = "//div[@class = 'ct-calendar-content']/h3"
8
+
9
+ def self.getDates()
10
+ doc = getHtml()
11
+ calendar = get_calendar(doc)
12
+
13
+ end
14
+
15
+ def self.getHtml()
16
+ Nokogiri::HTML(open(URL_HACIENDA))
17
+ end
18
+
19
+ def self.get_calendar(page)
20
+ calendar = page.xpath(CALENDAR)
21
+ item = calendar.map { |t| t.text}
22
+ end
23
+
24
+
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module IvaGem
2
+ VERSION = "0.1.0"
3
+ end
data/lib/iva_gem.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "iva_gem/version"
2
+
3
+ module IvaGem
4
+ # Your code goes here...
5
+ end
data/spec/test.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'minitest/autorun'
2
+ require './lib/iva_gem/iva_gem.rb'
3
+
4
+ #Test
5
+ calendar = IvaSearch::Tax.getDates()
6
+
7
+ describe IvaSearch do
8
+
9
+ describe 'get data' do
10
+ it 'has the right number of dates' do
11
+ calendar.size.must_equal 2
12
+ end
13
+
14
+ it 'should not return empty dates' do
15
+ calendar.wont_be_nil
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iva_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Edwin Mejia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-28 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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
+ description: Retrieves the final date for submitting tax sheet
42
+ email:
43
+ - eddwin@live.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - iva_gem.gemspec
55
+ - lib/iva_gem.rb
56
+ - lib/iva_gem/iva_gem.rb
57
+ - lib/iva_gem/version.rb
58
+ - spec/test.rb
59
+ homepage: ''
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.7
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Looks for final date of El Salvadors IVA tax submission
83
+ test_files:
84
+ - spec/test.rb