a_marmita 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rvmrc +1 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +58 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/a_marmita.gemspec +23 -0
- data/lib/a_marmita/version.rb +3 -0
- data/lib/a_marmita.rb +40 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjMwMTZkMmMzYjQ5YThjMzdjMjk4NjE5MTU2NDhjNDZmNDUzYzgzNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzA3NmYyNDg1MzE4N2U1ZjE3MzI1MzQyNzE1Zjg1OWM1OTMzOWU0Nw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZThlM2E2MDcxYzE4MGU3OWQ5M2FlZjY4MjkzYmZlYTUwMzg4NmJjNWNhMWQ4
|
10
|
+
MDNjOTAwNDNiNTllMmNjZjdkNjAxM2ZhM2Y5N2FmMmYyNzkwZmQ4MjFlYmVh
|
11
|
+
NGE2MTc4NmU0YWU2M2E4MzNjZDU4Zjg0ODY0ZjNjNDZmM2VjMzI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDc1ZGYxZGZhNGJkZTkwYzNmODFkM2I0MDUzYjUxNTBiYzQwNjIzYjlkMWUy
|
14
|
+
NzYyYzk5ODk0MWM3MDY3NTRlZTZhNTY1YmFlZGE5YmZiYTEyYTNiZjUwY2Rh
|
15
|
+
MGM5NzM1YmZmODEwN2EzNjdmNjg2MDE4MmJkYTI0MTZkNzg5Yjc=
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.3@a_marmita --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
a_marmita (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.0)
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
domain_name (0.5.18)
|
12
|
+
unf (>= 0.0.5, < 1.0.0)
|
13
|
+
http-cookie (1.0.2)
|
14
|
+
domain_name (~> 0.5)
|
15
|
+
mechanize (2.7.3)
|
16
|
+
domain_name (~> 0.5, >= 0.5.1)
|
17
|
+
http-cookie (~> 1.0)
|
18
|
+
mime-types (~> 2.0)
|
19
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
20
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
21
|
+
nokogiri (~> 1.4)
|
22
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
23
|
+
webrobots (>= 0.0.9, < 0.2)
|
24
|
+
method_source (0.8.2)
|
25
|
+
mime-types (2.2)
|
26
|
+
mini_portile (0.5.3)
|
27
|
+
net-http-digest_auth (1.4)
|
28
|
+
net-http-persistent (2.9.4)
|
29
|
+
nokogiri (1.6.1)
|
30
|
+
mini_portile (~> 0.5.0)
|
31
|
+
ntlm-http (0.1.1)
|
32
|
+
pry (0.9.12.6)
|
33
|
+
coderay (~> 1.0)
|
34
|
+
method_source (~> 0.8)
|
35
|
+
slop (~> 3.4)
|
36
|
+
rspec (2.14.1)
|
37
|
+
rspec-core (~> 2.14.0)
|
38
|
+
rspec-expectations (~> 2.14.0)
|
39
|
+
rspec-mocks (~> 2.14.0)
|
40
|
+
rspec-core (2.14.8)
|
41
|
+
rspec-expectations (2.14.5)
|
42
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
43
|
+
rspec-mocks (2.14.6)
|
44
|
+
slop (3.5.0)
|
45
|
+
unf (0.1.3)
|
46
|
+
unf_ext
|
47
|
+
unf_ext (0.0.6)
|
48
|
+
webrobots (0.1.1)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
a_marmita!
|
55
|
+
bundler (~> 1.3)
|
56
|
+
mechanize
|
57
|
+
pry
|
58
|
+
rspec (~> 2.11)
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Joã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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/a_marmita.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 'a_marmita/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "a_marmita"
|
8
|
+
spec.version = AMarmita::VERSION
|
9
|
+
spec.authors = ["João Gonçalves"]
|
10
|
+
spec.email = ["goncalves.joao@gmail.com"]
|
11
|
+
spec.description = %q{Ruby gem to handle most of the "A Marmita" server calls}
|
12
|
+
spec.summary = %q{This gem allows you to get the 'meals', login, logout and make 'orders' in your behalf, at the "A Marmita" website.}
|
13
|
+
spec.homepage = "https://github.com/goncalvesjoao/a_marmita"
|
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 "mechanize"
|
23
|
+
end
|
data/lib/a_marmita.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "a_marmita/version"
|
2
|
+
|
3
|
+
module AMarmita
|
4
|
+
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def get_meals
|
8
|
+
|
9
|
+
login('joao.goncalves@linkedcare.com', 'yEJHVd')
|
10
|
+
|
11
|
+
scrap_meals
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
protected #################### PROTECTED ##################
|
17
|
+
|
18
|
+
def scrap_meals
|
19
|
+
page = agent.get "http://www.amarmita.com/ementa.php"
|
20
|
+
|
21
|
+
page.parser.css('#conteudo table tr')
|
22
|
+
binding.pry
|
23
|
+
end
|
24
|
+
|
25
|
+
def login(email, pass)
|
26
|
+
page = agent.get "http://www.amarmita.com/login.php?user=#{email}&psw=#{pass}"
|
27
|
+
|
28
|
+
page.body == "1"
|
29
|
+
end
|
30
|
+
|
31
|
+
def agent
|
32
|
+
return @agent if defined?(@agent)
|
33
|
+
|
34
|
+
@agent = Mechanize.new.tap do |agent|
|
35
|
+
agent.log = Logger.new "mech.log"
|
36
|
+
agent.user_agent_alias = 'Mac Safari'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: a_marmita
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- João Gonçalves
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-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.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: mechanize
|
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: Ruby gem to handle most of the "A Marmita" server calls
|
42
|
+
email:
|
43
|
+
- goncalves.joao@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .rvmrc
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- a_marmita.gemspec
|
55
|
+
- lib/a_marmita.rb
|
56
|
+
- lib/a_marmita/version.rb
|
57
|
+
homepage: https://github.com/goncalvesjoao/a_marmita
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.1.10
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: This gem allows you to get the 'meals', login, logout and make 'orders' in
|
81
|
+
your behalf, at the "A Marmita" website.
|
82
|
+
test_files: []
|