guerrillamail 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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/guerrillamail.gemspec +26 -0
- data/lib/guerrillamail.rb +34 -0
- data/lib/guerrillamail/api.rb +25 -0
- data/lib/guerrillamail/version.rb +3 -0
- metadata +112 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4a983420e69fc663ee7ea0ffc488b80fa548874d
|
|
4
|
+
data.tar.gz: ff412e400f419c84eb53225c956d61642e523f07
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: df22bdf8d78fa3249c5e729c707667ab412dcff38fabdee701e554b9f02d2bfd2c31f0bcca4f857c84d7dc8e907b6f0115d4162a6dea1e44a7c5028eaf2dfad7
|
|
7
|
+
data.tar.gz: 5b78abf4a48cf80b6e32537fcd230cab9660b8583670c5ab9458510aeb45e0abe910666757caebdbd6dd934380353b7d2c6276a2455db7cf0a917c04545eb203
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Guerrillamail
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/guerrillamail`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'guerrillamail'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install guerrillamail
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
First you have to either get a new random email or set your email username that
|
|
26
|
+
you would like.
|
|
27
|
+
|
|
28
|
+
### Example:
|
|
29
|
+
|
|
30
|
+
To get a random email:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
g = GuerrillaMail.new
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or to get an email with the email username test
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
g = GuerrillaMail.new('test')
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
To check the email:
|
|
43
|
+
```
|
|
44
|
+
g.check_email
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
And to see the email address:
|
|
48
|
+
```
|
|
49
|
+
g['email_addr']
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
55
|
+
|
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
57
|
+
|
|
58
|
+
## Contributing
|
|
59
|
+
|
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/guerrillamail.
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "guerrillamail"
|
|
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,26 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'guerrillamail/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "guerrillamail"
|
|
8
|
+
spec.version = Guerrillamail::VERSION
|
|
9
|
+
spec.authors = ["Andrei Gliga"]
|
|
10
|
+
spec.email = ["gems@prod.net"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{GuerrillMail API client}
|
|
13
|
+
spec.description = %q{GuerrillMail API client}
|
|
14
|
+
spec.homepage = "http://github.com/otzy007/guerrillamail"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
+
spec.bindir = "exe"
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_dependency 'rest-client'
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
26
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'guerrillamail/api'
|
|
3
|
+
|
|
4
|
+
class GuerrillaMail
|
|
5
|
+
extend Forwardable
|
|
6
|
+
|
|
7
|
+
attr_accessor :cookies, :body
|
|
8
|
+
|
|
9
|
+
def initialize(email_user = nil)
|
|
10
|
+
if email_user
|
|
11
|
+
with_email_user(email_user)
|
|
12
|
+
else
|
|
13
|
+
random_email
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def with_email_user(email_user)
|
|
18
|
+
request = Guerrillamail::API.new('set_email_user', email_user: email_user)
|
|
19
|
+
@cookies = request.cookies
|
|
20
|
+
@body = request.body
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def random_email
|
|
24
|
+
request = Guerrillamail::API.new('get_email_address')
|
|
25
|
+
@cookies = request.cookies
|
|
26
|
+
@body = request.body
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def check_email(seq = 0)
|
|
30
|
+
JSON.parse(Guerrillamail::API.new('check_email', {seq: seq}, @cookies).result.body)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
delegate :[] => :body
|
|
34
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'rest-client'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
|
|
5
|
+
module Guerrillamail
|
|
6
|
+
class API
|
|
7
|
+
extend Forwardable
|
|
8
|
+
attr_accessor :result
|
|
9
|
+
|
|
10
|
+
def initialize(function, parameters = {}, cookies = {})
|
|
11
|
+
parameters[:f] = function
|
|
12
|
+
parameters[:ip] = '127.0.0.1'
|
|
13
|
+
parameters[:agent] = 'guerrillamail_gem'
|
|
14
|
+
|
|
15
|
+
@uri = "http://api.guerrillamail.com/ajax.php?#{URI.encode_www_form(parameters)}"
|
|
16
|
+
@result = RestClient.get(@uri, cookies: cookies)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def body
|
|
20
|
+
JSON.parse(@result.body)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
delegate :cookies => :result
|
|
24
|
+
end
|
|
25
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: guerrillamail
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrei Gliga
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rest-client
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.12'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.12'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
description: GuerrillMail API client
|
|
70
|
+
email:
|
|
71
|
+
- gems@prod.net
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- ".rspec"
|
|
78
|
+
- ".travis.yml"
|
|
79
|
+
- Gemfile
|
|
80
|
+
- README.md
|
|
81
|
+
- Rakefile
|
|
82
|
+
- bin/console
|
|
83
|
+
- bin/setup
|
|
84
|
+
- guerrillamail.gemspec
|
|
85
|
+
- lib/guerrillamail.rb
|
|
86
|
+
- lib/guerrillamail/api.rb
|
|
87
|
+
- lib/guerrillamail/version.rb
|
|
88
|
+
homepage: http://github.com/otzy007/guerrillamail
|
|
89
|
+
licenses: []
|
|
90
|
+
metadata: {}
|
|
91
|
+
post_install_message:
|
|
92
|
+
rdoc_options: []
|
|
93
|
+
require_paths:
|
|
94
|
+
- lib
|
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
requirements: []
|
|
106
|
+
rubyforge_project:
|
|
107
|
+
rubygems_version: 2.5.1
|
|
108
|
+
signing_key:
|
|
109
|
+
specification_version: 4
|
|
110
|
+
summary: GuerrillMail API client
|
|
111
|
+
test_files: []
|
|
112
|
+
has_rdoc:
|