1
0
mirror of https://github.com/askn/faker.git synced 2023-08-10 21:13:01 +03:00

add commerce

This commit is contained in:
Aşkın Gedik 2016-01-06 16:37:20 +02:00
parent 0872d98f55
commit bbd1a10a42
4 changed files with 39 additions and 0 deletions

View File

@ -44,6 +44,14 @@ Faker::Address.longitude
``` ```
### Faker::Commerce
```crystal
Faker::Commerce.color
Faker::Commerce.department
Faker::Commerce.product_name
```
### Faker::Company ### Faker::Company
```crystal ```crystal

View File

@ -20,6 +20,12 @@ puts Faker::Address.country
puts Faker::Address.latitude puts Faker::Address.latitude
puts Faker::Address.longitude puts Faker::Address.longitude
puts "\n### Faker::Commerce\n\n"
puts Faker::Commerce.color
puts Faker::Commerce.department
puts Faker::Commerce.product_name
puts "\n### Faker::Company\n\n" puts "\n### Faker::Company\n\n"
puts Faker::Company.name puts Faker::Company.name

16
src/faker/commerce.cr Normal file
View File

@ -0,0 +1,16 @@
module Faker
class Commerce
def self.color
Faker.fetch(Data["commerce"]["color"])
end
def self.department
Faker.fetch(Data["commerce"]["department"])
end
def self.product_name
product_name = Data["commerce"]["product_name"] as Hash
Faker.fetch(product_name["adjective"]) + " " + Faker.fetch(product_name["material"]) + " " + Faker.fetch(product_name["product"])
end
end
end

View File

@ -46,5 +46,14 @@ module Faker
"phone_number": { "phone_number": {
"formats": ["###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-#### x###", "(###)###-#### x###", "1-###-###-#### x###", "###.###.#### x###", "###-###-#### x####", "(###)###-#### x####", "1-###-###-#### x####", "###.###.#### x####", "###-###-#### x#####", "(###)###-#### x#####", "1-###-###-#### x#####", "###.###.#### x#####"], "formats": ["###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-#### x###", "(###)###-#### x###", "1-###-###-#### x###", "###.###.#### x###", "###-###-#### x####", "(###)###-#### x####", "1-###-###-#### x####", "###.###.#### x####", "###-###-#### x#####", "(###)###-#### x#####", "1-###-###-#### x#####", "###.###.#### x#####"],
}, },
"commerce": {
"color": ["red", "green", "blue", "yellow", "purple", "mint green", "teal", "white", "black", "orange", "pink", "grey", "maroon", "violet", "turquoise", "tan", "sky blue", "salmon", "plum", "orchid", "olive", "magenta", "lime", "ivory", "indigo", "gold", "fuchsia", "cyan", "azure", "lavender", "silver"],
"department": ["Books", "Movies, Music & Games", "Electronics & Computers", "Home, Garden & Tools", "Grocery, Health & Beauty", "Toys, Kids & Baby", "CLothing, Shoes & Jewelery", "Sports & Outdoors", "Automotive & Industrial"],
"product_name": {
"adjective": ["Small", "Ergonomic", "Rustic", "Intelligent", "Gorgeous", "Incredible", "Fantastic", "Practical", "Sleek", "Awesome"],
"material": ["Steel", "Wooden", "Concrete", "Plastic", "Cotton", "Granite", "Rubber"],
"product": ["Chair", "Car", "Computer", "Gloves", "Pants", "Shirt", "Table", "Shoes", "Hat"],
},
},
} }
end end