SykGenData 0.1.8 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 06afe934215184ec8f0de3de350d0b76e27341773122b0e29e11074c8148e287
4
- data.tar.gz: ca6e8dfb5332a7fcffbdc771caa6b5acd990130dd51a40a047d42db38954a510
2
+ SHA1:
3
+ metadata.gz: 72820e76b0901934c019609a3691c3528210b50a
4
+ data.tar.gz: 4245d767e5b2a02463f8222c4c9aef84fea2357c
5
5
  SHA512:
6
- metadata.gz: 59bb444767da7a02c8f6757c54d4fe6b173853ab147c69124090df3b454ea482ac99ae46cafcf3ce5b24b285b70189a8c8c8de6e8ad483a274d6b0b495cdefdb
7
- data.tar.gz: f1e1651ebe0c1481651ce99a9b69ee662e0888f7aaf1e687c57fab72a0e15bf59d3e1a9fd0a5586dc789ec17043739af02a8630672835b76efdf8b1d839fef90
6
+ metadata.gz: 8dabe4f8c34f44d6415254101456dfe4b0a8289f5c2b2ca8ae3246be90391593c65664e461e2083ddd2512d3a2bf729a7586d88faa38ffbc0aac698344638b34
7
+ data.tar.gz: 8def84d2112a5c83d286108aac2da65bd89f16444da6a8292d74893f9433d10240cccb20c73dee13289dc2a1072cfdfa5a3464dde27862ddfb0ac18b623b5744
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- SykGenData (0.1.8)
4
+ SykGenData (0.1.9)
5
5
  faker (~> 1.8)
6
6
  httparty (~> 0.16)
7
7
  json (~> 2.1)
data/README.md CHANGED
@@ -4,7 +4,7 @@ This project was to make a ruby gem which came with a library of useful data gen
4
4
 
5
5
  These generators could be added to later as I find the need for different types of data. Making these generators into a gem means that I can easily include and use my generators in new projects without much hassle of copying files, making require statements etc.
6
6
 
7
- The generators themselves come in a SOM model with a super module handing out appropriate generator services.
7
+ The generators themselves come in a Service Object Model with a super module handing out appropriate generator services.
8
8
 
9
9
  ## Installation
10
10
 
@@ -28,73 +28,56 @@ Use the generators by first adding
28
28
  ```ruby
29
29
  require 'SykGenData'
30
30
  ```
31
- to your ruby file and then adding
31
+ to your ruby file and then calling SykGenData to return a generator class
32
32
  ```ruby
33
- include SykGenData
34
- or
35
- extend SykGenData
36
- ```
37
- to your Generator Super class if you have one or to any class you'd like to generate data in otherwise.
38
-
39
- Eg.
40
- ```ruby
41
- require 'SykGenData'
42
- ...
43
- class Dummy
44
- include SykGenData
45
- end
46
- ...
47
- dummy = Dummy.new
48
- dummy.form.get_username
49
- ```
50
- or
51
- ```ruby
52
- require 'SykGenData'
53
- ...
54
- class Dummy
55
- extend SykGenData
56
- end
57
- ...
58
- Dummy.form.get_username
33
+ @form = SykGenData::form
34
+ @cc = SykGenData::cc
35
+ @postcode = SykGenData::postcode
59
36
  ```
60
37
 
61
38
  ## Methods
39
+
40
+ ### Generating form data
62
41
  ```ruby
63
- form
42
+ @form = SykGenData::form
64
43
  ```
65
44
  to call the GenFormData class used to generate data for filling in online registration forms.
66
45
  ```ruby
67
- form.get_country # returns a country
68
- form.get_fake_location # returns a fictional location
69
- form.get_first_name # returns a first name
70
- form.get_last_name # returns a last name
71
- form.get_username # returns a username
72
- form.get_email # returns a random email
73
- form.get_password # returns a string with upper and lower case as well as special characters and numbers
74
- form.get_dob # returns a date of birth as an array of 3 values
75
- form.get_phone_number # returns a phone number starting 07
76
- form.get_about_me # returns a quote for an about me section
46
+ @form.get_country # returns a country
47
+ @form.get_fake_location # returns a fictional location
48
+ @form.get_first_name # returns a first name
49
+ @form.get_last_name # returns a last name
50
+ @form.get_username # returns a username
51
+ @form.get_email # returns a random email
52
+ @form.get_password # returns a string with upper and lower case as well as special characters and numbers
53
+ @form.get_dob # returns a date of birth as an array of 3 values
54
+ @form.get_phone_number # returns a phone number starting 07
55
+ @form.get_about_me # returns a quote for an about me section
77
56
  ```
78
57
  --------
58
+
59
+ ### Generating credit card data
79
60
  ```ruby
80
- cc
61
+ @cc = SykGenData::cc
81
62
  ```
82
63
  to call the GenCCData class used to generate data for filling in online payment forms
83
64
  ```ruby
84
- cc.get_visa_cc_number # returns a random fake VISA credit card number
85
- cc.get_visa_sec_code # returns a random fake VISA security code
86
- cc.get_amex_cc_number # returns a random fake American Express credit card number
87
- cc.get_amex_sec_code # returns a random fake American Express security code
88
- cc.get_mastercard_cc_number # returns a random fake Mastercard credit card number
89
- cc.get_mastercard_sec_code # returns a random fake Mastercard security code
65
+ @cc.get_visa_cc_number # returns a random fake VISA credit card number
66
+ @cc.get_visa_sec_code # returns a random fake VISA security code
67
+ @cc.get_amex_cc_number # returns a random fake American Express credit card number
68
+ @cc.get_amex_sec_code # returns a random fake American Express security code
69
+ @cc.get_mastercard_cc_number # returns a random fake Mastercard credit card number
70
+ @cc.get_mastercard_sec_code # returns a random fake Mastercard security code
90
71
  ```
91
72
  --------
73
+
74
+ ### Generating UK postcode data
92
75
  ```ruby
93
- postcode
76
+ @postcode = SykGenData::postcode
94
77
  ```
95
78
  to call GenPostcodeData class used to generate UK postcodes for use with an API.
96
79
  ```ruby
97
- postcode.get_postcode # returns a random UK postcode
80
+ @postcode.get_postcode # returns a random UK postcode
98
81
  ```
99
82
  ## Testing
100
83
 
@@ -113,6 +96,14 @@ To install this gem onto your local machine, run `bundle exec rake install`.
113
96
 
114
97
  Bug reports and pull requests are welcome on GitHub at https://github.com/Sykander/SykGenData. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
115
98
 
99
+ ## Publishing
100
+
101
+ This gem is published when pull requests are approved into master.
102
+
116
103
  ## License
117
104
 
118
105
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
106
+
107
+ ## RubyGems
108
+
109
+ [SykGenData](https://rubygems.org/gems/SykGenData)
data/SykGenData.gemspec CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "SykGenData"
8
8
  spec.version = SykGenData::VERSION
9
9
  spec.authors = ["Sykander"]
10
- spec.email = ["sgul@spartaglobal.com"]
10
+ spec.email = ["sgul@spartaglobal.com", "scanda@live.co.uk"]
11
11
 
12
12
  spec.summary = "Data Generators."
13
- spec.description = "A collection of Data generators for use with online forms and APIs."
13
+ spec.description = "A collection of Data generators for use with online forms and checkouts."
14
14
  spec.homepage = "https://github.com/Sykander/SykGenData"
15
15
  spec.license = "MIT"
16
16
 
data/lib/SykGenData.rb CHANGED
@@ -4,15 +4,15 @@ require 'SykGenData/generators/gen_postcode_data'
4
4
  require 'SykGenData/generators/gen_cc_data'
5
5
 
6
6
  module SykGenData
7
- def form
7
+ def self.form
8
8
  GenFormData.new
9
9
  end
10
10
 
11
- def postcode
11
+ def self.postcode
12
12
  GenPostcodeData.new
13
13
  end
14
14
 
15
- def cc
15
+ def self.cc
16
16
  GenCCData.new
17
17
  end
18
18
  end
@@ -1,7 +1,6 @@
1
1
  require 'faker'
2
2
 
3
3
  class GenFormData
4
- include Faker
5
4
 
6
5
  def get_country
7
6
  countries = ["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Côte d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Greenland","Grenada","Guam","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Japan","Jordan","Kazakhstan","Kenya","Kiribati","North Korea","South Korea","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Northern Mariana Islands","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia", "Saint Vincent and the Grenadines","Samoa","San Marino", "Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Sudan, South","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Virgin Islands, British","Virgin Islands, U.S.","Yemen","Zambia","Zimbabwe"]
@@ -10,37 +9,21 @@ class GenFormData
10
9
  end
11
10
 
12
11
  def get_fake_location
13
- location = [RickAndMorty.location, Simpsons.location, StarTrek.location, StarWars.planet, Zelda.location, Witcher.location, Lovecraft.location, HarryPotter.location, HitchhikersGuideToTheGalaxy.location, HitchhikersGuideToTheGalaxy.planet, HitchhikersGuideToTheGalaxy.starship]
12
+ location = [Faker::RickAndMorty.location, Faker::Simpsons.location, Faker::StarTrek.location, Faker::StarWars.planet, Faker::Zelda.location, Faker::Witcher.location, Faker::Lovecraft.location, Faker::HarryPotter.location, Faker::HitchhikersGuideToTheGalaxy.location, Faker::HitchhikersGuideToTheGalaxy.planet, Faker::HitchhikersGuideToTheGalaxy.starship]
14
13
 
15
14
  location.sample
16
15
  end
17
16
 
18
17
  def get_first_name
19
- Name.first_name
18
+ Faker::Name.first_name
20
19
  end
21
20
 
22
21
  def get_last_name
23
- Name.last_name
22
+ Faker::Name.last_name
24
23
  end
25
24
 
26
25
  def get_dob min_years_old, max_years_old
27
- Date.birthday(min_years_old, max_years_old).to_s.split('-').map {|x| x.to_i}
28
- end
29
-
30
- def get_visa_cc_number
31
- cc_number = '4'
32
- while cc_number.length < 16
33
- cc_number += rand(0..9).to_s
34
- end
35
- cc_number
36
- end
37
-
38
- def get_visa_sec_code
39
- sec_code = ''
40
- while sec_code.length < 3
41
- sec_code += rand(0..9).to_s
42
- end
43
- sec_code
26
+ Faker::Date.birthday(min_years_old, max_years_old).to_s.split('-').map {|x| x.to_i}
44
27
  end
45
28
 
46
29
  def get_marital_status
@@ -74,7 +57,7 @@ class GenFormData
74
57
  end
75
58
 
76
59
  def get_username
77
- characters = [Ancient.god, Ancient.primordial, Ancient.titan, Ancient.hero, DragonBall.character, Artist.name, BackToTheFuture.character, Book.genre, DrWho.character, DrWho.villian, DrWho.specie, HarryPotter.character, LordOfTheRings.character, Lovecraft.deity, RickAndMorty.character, Seinfeld.character, Simpsons.character, StarTrek.character, StarTrek.villain, StarWars.character, TheFreshPrinceOfBelAir.character, Superhero.descriptor]
60
+ characters = [Faker::Ancient.god, Faker::Ancient.primordial, Faker::Ancient.titan, Faker::Ancient.hero, Faker::DragonBall.character, Faker::Artist.name, Faker::BackToTheFuture.character, Faker::Book.genre, Faker::DrWho.character, Faker::DrWho.villian, Faker::DrWho.specie, Faker::HarryPotter.character, Faker::LordOfTheRings.character, Faker::Lovecraft.deity, Faker::RickAndMorty.character, Faker::Seinfeld.character, Faker::Simpsons.character, Faker::StarTrek.character, Faker::StarTrek.villain, Faker::StarWars.character, Faker::TheFreshPrinceOfBelAir.character, Faker::Superhero.descriptor]
78
61
 
79
62
  username = characters.sample
80
63
  username += Random.new.rand(0..9).to_s
@@ -96,16 +79,16 @@ class GenFormData
96
79
  end
97
80
 
98
81
  def get_about_me
99
- quotes = [BackToTheFuture.quote, Friends.quote, HarryPotter.quote, GameOfThrones.quote, Lovecraft.fhtagn(3), Lovecraft.paragraph, RickAndMorty.quote, Seinfeld.quote, Simpsons.quote, StarWars.quote, StarWars.wookiee_sentence, TheFreshPrinceOfBelAir.quote, HitchhikersGuideToTheGalaxy.marvin_quote]
82
+ quotes = [Faker::BackToTheFuture.quote, Faker::Friends.quote, Faker::HarryPotter.quote, Faker::GameOfThrones.quote, Faker::Lovecraft.fhtagn(3), Faker::Lovecraft.paragraph, Faker::RickAndMorty.quote, Faker::Seinfeld.quote, Faker::Simpsons.quote, Faker::StarWars.quote, Faker::StarWars.wookiee_sentence, Faker::TheFreshPrinceOfBelAir.quote, Faker::HitchhikersGuideToTheGalaxy.marvin_quote]
100
83
  quotes.sample
101
84
  end
102
85
 
103
86
  def get_password
104
- Internet.password(8, 16, true, true)
87
+ Faker::Internet.password(8, 16, true, true)
105
88
  end
106
89
 
107
90
  def get_long_password
108
- Internet.password(64, 128, true, true)
91
+ Faker::Internet.password(64, 128, true, true)
109
92
  end
110
93
 
111
94
  def get_numeric_string
@@ -118,6 +101,6 @@ class GenFormData
118
101
  end
119
102
 
120
103
  def get_email
121
- Internet.free_email
104
+ Faker::Internet.free_email
122
105
  end
123
106
  end
@@ -1,3 +1,3 @@
1
1
  module SykGenData
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SykGenData
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sykander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,9 +136,10 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.8'
139
- description: A collection of Data generators for use with online forms and APIs.
139
+ description: A collection of Data generators for use with online forms and checkouts.
140
140
  email:
141
141
  - sgul@spartaglobal.com
142
+ - scanda@live.co.uk
142
143
  executables: []
143
144
  extensions: []
144
145
  extra_rdoc_files: []
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: '0'
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.7.7
187
+ rubygems_version: 2.5.2
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: Data Generators.