random_users 1.0.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 +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +75 -0
- data/Rakefile +1 -0
- data/lib/random_users/version.rb +3 -0
- data/lib/random_users.rb +24 -0
- data/random_users.gemspec +23 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37b1fdcd838384c7e873fc64fce81a0d860a0e02
|
4
|
+
data.tar.gz: 1658ad118c5346639cd40394d4b70c61835230f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45d2d07260d3d891cb050d0f28db8fa163748e6b9907427877dfc2c5a8b07897ccfa88a1208f51afbc2278f91155b638e6b3c08db3d8840c5359f73fd75b37ef
|
7
|
+
data.tar.gz: 1ac28b05eeda22fcd671bb663aadbf9e840d185c59c140c752f0527585f32f8ceed732901f6e1ac3b573029157b8963b64abebec0a067159aedb68ad33ad127b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 bmalets
|
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,75 @@
|
|
1
|
+
# RandomUsers
|
2
|
+
|
3
|
+
It's a gem for using http://randomuser.me/ service in ruby/rails apps.
|
4
|
+
|
5
|
+
Using this gem you can easily generate random users for your app.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'random_users'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install random_users
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
RandomUsers.generate( number ) # => { array of hashes with user data }
|
24
|
+
|
25
|
+
RandomUsers.generate # => { hash with user data }
|
26
|
+
|
27
|
+
RandomUsers.generate( 5 ) # => { array with 5 hashes with user data }
|
28
|
+
|
29
|
+
## Example of generated user data:
|
30
|
+
|
31
|
+
{
|
32
|
+
|
33
|
+
"results":[
|
34
|
+
{
|
35
|
+
"user":{
|
36
|
+
"gender":"male",
|
37
|
+
"name":{
|
38
|
+
"title":"mr",
|
39
|
+
"first":"harvey",
|
40
|
+
"last":"steward"
|
41
|
+
},
|
42
|
+
"location":{
|
43
|
+
"street":"4956 fifth st",
|
44
|
+
"city":"indianapolis",
|
45
|
+
"state":"west virginia",
|
46
|
+
"zip":"23684"
|
47
|
+
},
|
48
|
+
"email":"harvey.steward34@example.com",
|
49
|
+
"username":"whitegoose996",
|
50
|
+
"password":"flanker",
|
51
|
+
"salt":"YxYxDkym",
|
52
|
+
"md5":"3ae2f676f0af99fc4e369ffca60ef834",
|
53
|
+
"sha1":"e077746c2e2f8dd7a6d3d3f6e1220ed2674e58f5",
|
54
|
+
"sha256":"f7f80c8588147f5504549bc8330cd52c9fcded3202d29f2ad8cd4324035d4c15",
|
55
|
+
"registered":"1196094856",
|
56
|
+
"dob":"305341965",
|
57
|
+
"phone":"(569)-482-6175",
|
58
|
+
"cell":"(135)-829-9127",
|
59
|
+
"SSN":"504-27-7675",
|
60
|
+
"picture":"http://api.randomuser.me/portraits/men/40.jpg"
|
61
|
+
},
|
62
|
+
"seed":"b55af278546e93e",
|
63
|
+
"version":"0.4"
|
64
|
+
}
|
65
|
+
]
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
1. Fork it ( http://github.com/<my-github-username>/random_users/fork )
|
72
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/random_users.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "random_users/version"
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
require 'json'
|
6
|
+
require 'pp'
|
7
|
+
|
8
|
+
module RandomUsers
|
9
|
+
def self.generate number=1
|
10
|
+
users, service = [], RandomUserService.new
|
11
|
+
number.times{ users << service.get_user }
|
12
|
+
number == 1 ? users[0] : users
|
13
|
+
end
|
14
|
+
|
15
|
+
class RandomUserService
|
16
|
+
def initialize
|
17
|
+
@url = URI.parse( 'http://api.randomuser.me/' )
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_user
|
21
|
+
JSON.parse( Net::HTTP.get( @url ) )
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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 'random_users/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "random_users"
|
8
|
+
spec.version = RandomUsers::VERSION
|
9
|
+
spec.authors = ["bmalets"]
|
10
|
+
spec.email = ["b.malets@gmail.com"]
|
11
|
+
spec.summary = %q{ Generator of random user data }
|
12
|
+
spec.description = %q{ You can generate many random users for your ruby app. (this gem use http://randomuser.me/ service) }
|
13
|
+
spec.homepage = "http://randomuser.me"
|
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.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: random_users
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bmalets
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-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.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
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: " You can generate many random users for your ruby app. (this gem use
|
42
|
+
http://randomuser.me/ service) "
|
43
|
+
email:
|
44
|
+
- b.malets@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/random_users.rb
|
55
|
+
- lib/random_users/version.rb
|
56
|
+
- random_users.gemspec
|
57
|
+
homepage: http://randomuser.me
|
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.2.2
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Generator of random user data
|
81
|
+
test_files: []
|