random_data_despegar 2.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5b128b2722b71bfe16dee6dc11e8e45207cc7c2
4
+ data.tar.gz: 24e2f8dec3799d9b5badb9e83c9058e0d099a41c
5
+ SHA512:
6
+ metadata.gz: 6dcc2111941e5455e54be28793aa080371e6fbc30812af2aa74abbe69a674a5aee41def9412dc5ecc7566daefc5e397e710ae0e7b47774cacb0b01c7c10f57a8
7
+ data.tar.gz: 251e76f93f4fb6b5d1d410bbd01ccaf1b2d8023fcd4e05a60bd6a2f296b870a4ddd502a015257320fd7e072721acf09a215d86d84b387fb29c1ddabfb57de6b3
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'mocha'
5
+ gem 'rake'
6
+ gem 'rdoc'
7
+ gem 'expects'
8
+ gem 'regexp-examples'
9
+ gem 'rspec'
10
+ end
@@ -0,0 +1,42 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.2.5)
5
+ expects (0.0.3)
6
+ json (1.8.2)
7
+ json (1.8.2-java)
8
+ metaclass (0.0.4)
9
+ mocha (1.1.0)
10
+ metaclass (~> 0.0.1)
11
+ rake (10.4.2)
12
+ rdoc (4.2.0)
13
+ json (~> 1.4)
14
+ regexp-examples (1.1.0)
15
+ rspec (3.4.0)
16
+ rspec-core (~> 3.4.0)
17
+ rspec-expectations (~> 3.4.0)
18
+ rspec-mocks (~> 3.4.0)
19
+ rspec-core (3.4.1)
20
+ rspec-support (~> 3.4.0)
21
+ rspec-expectations (3.4.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.4.0)
24
+ rspec-mocks (3.4.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.4.0)
27
+ rspec-support (3.4.1)
28
+
29
+ PLATFORMS
30
+ java
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ expects
35
+ mocha
36
+ rake
37
+ rdoc
38
+ regexp-examples
39
+ rspec
40
+
41
+ BUNDLED WITH
42
+ 1.11.2
@@ -0,0 +1,77 @@
1
+ == 1.6.0 2012-11-22
2
+
3
+ * Enhancements:
4
+ * Added company_name, companyname methods (Jason Rogers)
5
+ * Removed deprecated method state. Use state_code instead. (Tom Harris)
6
+
7
+ == 1.5.2 2010-11-16
8
+
9
+ * Enhancements:
10
+ * added first_name, last_name, full_name methods (Cyril David)
11
+
12
+ * Fixes:
13
+ * added utf-8 magic comment for ruby 1.9 compatibility (Tom Harris)
14
+
15
+ == 1.5.0 2008-11-06
16
+ * 2 major enhancement:
17
+ * Totally cleaned up and reconfigured hoe using newgem 1.0's conventions
18
+ * Added Markov model text generator (courtesy of Hugh Sasse)
19
+
20
+ * 1 minor enhancement:
21
+ * Added roulette method to Array (courtesy of Hugh Sasse)
22
+
23
+ * 1 minor fix:
24
+ * Fixed newline bug in the name generator (courtesy of Harold Gimenez)
25
+
26
+ == 1.3.1 2008-06-06
27
+
28
+ * 2 minor enhancements:
29
+ * Added added more last and firstnames (courtesy of Hugh Sasse)
30
+ * Added firstname_male and firstname_female (courtesy of Hugh Sasse)
31
+
32
+ == 1.3.0 2008-05-25
33
+
34
+ All these enhancements are from Hugh Sasse. Thanks Hugh!
35
+
36
+ * 4 major enhancements:
37
+ * Added Random::Grammar, which lets you create simple random sentences (see rdocs)
38
+ * Added Random.bit and Random.bits
39
+ * Added Random.grammatical_construct
40
+ * Fixed up rdocs which had gotten out of date
41
+
42
+ * 2 minor enhancements:
43
+ * Added Random.uk_post_code
44
+ * Zipcodes should strings, not integers
45
+
46
+ == 1.2.1 2007-11-29
47
+
48
+ * 1 minor fix:
49
+ * Updated gem manifest
50
+
51
+ == 1.2.0 2007-11-29
52
+
53
+ Thanks to Paul Barry and Hugh Sasse for some awesome patches!
54
+
55
+ * 1 major enhancement:
56
+ * Added method_missing to Random class, which looks for a method_name.dat and fetches a random line for you (see docs for details) (Hugh Sasse)
57
+ * added Random.date_between method to get a date between 2 given dates (Paul Barry)
58
+ * added Random.boolean method to get a random true or false (Paul Barry)
59
+ * added Random.number to get a random number less than a number or within a given range (Paul Barry)
60
+
61
+ * 1 minor enhancement:
62
+ * enhanced Random.date method to handle a Range as well as a Fixnum, which allows you to get a date guaranteed to be in the past (Paul Barry)
63
+
64
+ * 1 minor fix:
65
+ * Location sources organized into more understandable categories, for easier future expansion (Hugh Sasse)
66
+ * Fixed path of require statements in random_data.rb (Paul Barry)
67
+ * make initial never return nil, because if it returns nil then ContactInfo#email can thrown and error because it tries to call nil. (Paul Barry)
68
+
69
+ == 1.0.1 2007-09-17
70
+
71
+ * 1 minor fix:
72
+ * Not creating the Random class properly by extending it (vs. including modules)
73
+
74
+ == 1.0.0 2007-09-17
75
+
76
+ * 1 major enhancement:
77
+ * Initial release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Mike Subelsky, subelsky.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File without changes
@@ -0,0 +1,135 @@
1
+ # Random-Data-Despegar
2
+
3
+ ## Install
4
+ ```shell
5
+ gem install random_data_despegar
6
+ ```
7
+ O manualmente => http://gems.despegar.com/#random_data_despegar
8
+
9
+ ## Generadores de datos random
10
+
11
+ ### Generadores
12
+
13
+ * [**ArrayRandomizer**](#arrayrandomizer)
14
+ * [**Booleans**](#booleans)
15
+ * [**ContactInfo**](#contactinfo)
16
+ * [**Dates**](#dates)
17
+ * [**Grammar**](#grammar)
18
+ * [**Locations**](#locations)
19
+ * [**Names**](#names)
20
+ * [**Numbers**](#numbers)
21
+ * [**InvoiceData**](#invoicedata)
22
+ * [**IdGenerator**](#idgenerator)
23
+ * [**Text**](#text)
24
+
25
+
26
+ ### ArrayRandomizer:
27
+
28
+ ```ruby
29
+ Random.rand #>> [1,2,3].rand = 3
30
+ Random.roulette # Takes an array of non-negative weights and returns the index selected by a
31
+ ```
32
+ ### Booleans:
33
+ ```ruby
34
+ Random.boolean #Returns true or false randomly
35
+ ```
36
+
37
+ ### ContactInfo:
38
+ ```ruby
39
+ # Returns a randomly-generated string of digits that roughly resembles a US telephone number. Not guaranteed to be a valid area code.
40
+ Random.phone
41
+ # Returns a randomly-generated string of digits that roughly resembles an international telephone number as dialed from the US.
42
+ Random.international_phone
43
+ # Returns an e-mail address of the form "{first_initial}{last_name}@{domain}"
44
+ Random.email
45
+
46
+ ```
47
+
48
+ ### Dates:
49
+ ```ruby
50
+ # Returns a random date.
51
+ Random.date
52
+ # Returns a date within the specified Range. The Range can be Date or String objects.
53
+ Random.date_between
54
+ # Returns valid departure and return dates (Date and formated)
55
+ Random.departure_and_return_dates
56
+ # Returns a hash with birhdate for a specific passenger_type: adult, child or infant.
57
+ Random.passenger_birthdate(passenger_type)
58
+ ```
59
+
60
+ ### Grammar:
61
+ ```ruby
62
+ # Random.grammatical_construct({:story => [:man, " bites ", :dog], :man => { :bob => "Bob"}, :dog => {:a =>"Rex", :b =>"Rover"}}, :story)
63
+ Random.grammatical_construct # => "Bob bites Rover"
64
+ ```
65
+
66
+ ### Locations:
67
+ ```ruby
68
+ # 24317 Jefferson Blvd"
69
+ Random.address_line_1
70
+ Random.address_line_2
71
+ # Returns a random 5-digit string, not guaranteed to be a legitimate zip code.
72
+ Random.zipcode
73
+ # Returns brazilian cep
74
+ Random.cep
75
+ # Returns brazilian cpnj
76
+ Random.cpnj
77
+ # Returns a string providing something in the general form of a UK post code. Like the zip codes, this might
78
+ Random.uk_post_code
79
+ # Returns a state 2-character abbreviation
80
+ # Random.state_code = "IL"
81
+ Random.state_code
82
+ # Returns a full state name
83
+ #Random.state_full = "Texas"
84
+ Random.state_full
85
+ # Returns a country name, as listed by the World Bank
86
+ Random.country
87
+ # Returns a generic city name, with an attempt to have some internationl appeal
88
+ Random.city
89
+ ```
90
+
91
+ ### Names:
92
+ ```ruby
93
+ Random.firstname
94
+ Random.firstname_male
95
+ Random.firstname_female
96
+ Random.initial
97
+ Random.lastname
98
+ ```
99
+
100
+ ### Numbers:
101
+ ```ruby
102
+ Random.number
103
+ # parameter is the size of the number to be generated.
104
+ Random.number_with_size(size)
105
+ # Returns an alphanumeric number with size n
106
+ Random.alphanumeric_with_size(size) # params integer
107
+ # return a random bit, 0 or 1.
108
+ Random.bit
109
+ # return an array of n random bits.
110
+ Random.bits
111
+ # Return card numbers, based on a regex and card number length.
112
+ # regex will be a string
113
+ # length will be an integer
114
+ Random.random_card_number(card_regex)
115
+ ```
116
+
117
+ ### InvoiceData:
118
+ ```ruby
119
+ # cr ec pa pe ve mx co cl ar br
120
+ Random.invoice_data_for "BR" #=> {:pf=>{:cedula=>"20532364131"
121
+ :cep=>"13301611"
122
+ :cpf=>"88227212710"}
123
+ ```
124
+
125
+ ### IdGenerator:
126
+ ```ruby
127
+ # cr ec pa pe ve mx co cl ar br
128
+ Random.id_for "BR"
129
+ ```
130
+
131
+ ### Text:
132
+ ```ruby
133
+ Random.alphanumeric
134
+ Random.paragraphs
135
+ ```
@@ -0,0 +1,156 @@
1
+ = random_data
2
+
3
+ This gem provides a Random singleton class with a series of methods for generating random test data including names, mailing addresses, dates, phone numbers, e-mail addresses, and text. Instead of:
4
+
5
+ <tt>foo.name = "John Doe"</tt>
6
+
7
+ You get:
8
+
9
+ <tt>foo.name = "#{Random.firstname} #{Random.initial} #{Random.lastname}"</tt>
10
+
11
+ == Installation
12
+
13
+ <tt>sudo gem install random_data</tt>
14
+
15
+ or get the gem manually from http://rubyforge.org/frs/?group_id=4458
16
+
17
+ == Methods
18
+
19
+ === Contact Methods
20
+ Random.phone, Random.international_phone, Random.email
21
+
22
+ === Time/Date Methods
23
+ Random.date, Random.date_between, Random.departure_and_return_dates, Random.adt_chd_inf_birthday
24
+
25
+ === Location Methods
26
+ Random.address_line_1, Random.address_line_2, Random.zipcode, Random.uk_post_code, Random.state_code, Random.state_full, Random.country, Random.city
27
+
28
+ === Name Methods
29
+ Random.firstname, Random.firstname_male, Random.firstname_female, Random.initial, Random.lastname
30
+
31
+ === Text Methods
32
+ Random.alphanumeric, Random.paragraphs
33
+
34
+ === Grammatical Methods
35
+ Random.grammatical_construct
36
+
37
+ === Number Methods
38
+ Random.number, Random.bit, Random.bits, Random.cpf, Random.random_card_number
39
+ Random.random_number_with_size(20) # => "25895277473360037460"
40
+
41
+ === Boolean Methods
42
+ Random.boolean
43
+
44
+ === Markov Generator Methods
45
+ Random.MarkovGenerator.new
46
+ Random.MarkovGenerator.insert
47
+ Random.MarkovGenerator.generate
48
+
49
+ === Array Extension
50
+ Array.rand
51
+ Array.roulette
52
+
53
+ === Choose From File Methods
54
+ Random implements a method_missing helper that will choose a line at random from a file in your load path. See Random::method_missing for details.
55
+
56
+ Note that some methods take parameters to bound or limit the amount of data returned. See RDocs for details.
57
+
58
+ == Examples of Some Methods
59
+
60
+ >>Random.alphanumeric
61
+ => "cfbutm3vYfhZXil0"
62
+
63
+ >> Random.alphanumeric(5)
64
+ => "XYVyn"
65
+
66
+ >> Random.paragraphs
67
+ => "Ulysses, fighting evil and tyranny with all his power and with all of his might. Ulysses, fighting evil and tyranny with all his power and with all
68
+ of his might. \n\nHe's got style, a groovy style, and a car that just won't stop. \n\n"
69
+
70
+ >> Random.paragraphs(3)
71
+ => "Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum. Down the road that's where I'll always be.
72
+ He's got style, a groovy style, and a car that just won't stop. I've gotten burned over Cheryl Tiegs and blown up for Raquel Welch, but when I end up in the
73
+ hay it's only hay hey hey. Hey there where ya goin, not exactly knowin'. \n\nLorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor
74
+ incididunt ut labore et dolore magna aliqua. I might jump an open drawbridge or Tarzan from a vine, beause I'm the unknown stuntman that makes Eastwood look so
75
+ fine. He just keeps on movin' and ladies keep improvin'. Rolling down to Dallas - who is providin my palace?. Every stop I make I make a new friend; Can't
76
+ stay for long just turn around and I'm gone again. \n\nAlways fighting all the evil forces bringing peace and justice to all. \n\n"
77
+
78
+ >> Random.firstname
79
+ => "Thomas"
80
+
81
+ >> Random.initial
82
+ => "E"
83
+
84
+ >> Random.lastname
85
+ => "Robinson"
86
+
87
+ >> Random.date
88
+ => Sun, 09 Sep 2007
89
+
90
+ (Returns an actual date object, shown here in its to_s form)
91
+
92
+ >> Random.date(1000)
93
+ => Sun, 26 Nov 2006
94
+
95
+ >> Random.departure_and_return_dates
96
+ => {
97
+ :departure_date=>#<Date: 2015-06-27 ((2457201j,0s,0n),+0s,2299161j)>,
98
+ :return_date=>#<Date: 2015-07-02 ((2457206j,0s,0n),+0s,2299161j)>,
99
+ :formated_departure_date=>"2015-06-27",
100
+ :formated_return_date=>"2015-07-02"
101
+ }
102
+
103
+ >> Random.departure_and_return_dates(30..40)
104
+ => {
105
+ :departure_date=>#<Date: 2015-05-17 ((2457160j,0s,0n),+0s,2299161j)>,
106
+ :return_date=>#<Date: 2015-05-24 ((2457167j,0s,0n),+0s,2299161j)>,
107
+ :formated_departure_date=>"2015-05-17",
108
+ :formated_return_date=>"2015-05-24"
109
+ }
110
+
111
+ >> Random.passenger_birthdate("adult")
112
+ => {:age => adt_age,
113
+ :month => month,
114
+ :day => rand(1..month_adt_days)
115
+ }
116
+
117
+ >> Random.email
118
+ => "zrodriguez@example.com"
119
+
120
+ >> Random.phone
121
+ => "564-103-8353"
122
+
123
+ >> Random.international_phone
124
+ => "011-24-37-9704"
125
+
126
+ >> Random.address_line_1
127
+ => "38367 Adams Rd"
128
+
129
+ >> Random.address_line_2
130
+ => "Lot 247"
131
+
132
+ >> Random.zipcode
133
+ => 22904
134
+
135
+ (Note that the zipcodes are totally random and may not be real zipcodes)
136
+
137
+ >> Random.state_code
138
+ => "MD"
139
+
140
+ >> Random.state_full
141
+ => "New Mexico"
142
+
143
+ >> Random.country
144
+ => "Philippines"
145
+
146
+ >> Random.random_card_number("^5(?:[1-5]|[7-9])[0-9]+$", 16)
147
+ => "5367179454341632"
148
+
149
+ == Contact
150
+ Let me know if you have patches, comments, or suggestions: mailto:mike@subelsky.com
151
+
152
+ == Special Thanks
153
+ Major thanks to Hugh Sasse and {Paul Barry}[http://paulbarry.com/] for their contributions.
154
+
155
+ == Copyright
156
+ Copyright (c) 2008 {Mike Subelsky}[http://subelsky.com/], Baltimore, Maryland, released under the MIT license.