mobistore 0.0.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.
- checksums.yaml +7 -0
- data/lib/mobistore.rb +77 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 800098ef8ca9da7599cb41f85d337e9309c11cc8
|
|
4
|
+
data.tar.gz: db58211788e7d43b8a13db6eaa6ab63c0457185e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a69400ed19d8384358a2d1f46e97372fff1df092c524c0c519fe2081c72f755fc9ee9a21967d4202d0125c5b2acbe6a47882e1439158e5fd9ec467458459258a
|
|
7
|
+
data.tar.gz: a6ae8be734193b8d0a10c3344549c2a3c7287a22185439c917d0955191231478f5f173f569e0001a06d40b8a212ee60aac5248ca3d4323664d107088eb375509
|
data/lib/mobistore.rb
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require Dir.pwd + '/lib/ProductAPI.rb'
|
|
2
|
+
require Dir.pwd + '/lib/TranscationAPI.rb'
|
|
3
|
+
require Dir.pwd + '/lib/BuyerAPI.rb'
|
|
4
|
+
require Dir.pwd + '/lib/SellerAPI.rb'
|
|
5
|
+
|
|
6
|
+
class MobiStore
|
|
7
|
+
|
|
8
|
+
def self.get_logo
|
|
9
|
+
"\n\t\t\t________________\n"+
|
|
10
|
+
"\t\t\t[The Mobi Store]"+
|
|
11
|
+
"\n\n\n"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.show_seller_options
|
|
15
|
+
system 'clear'
|
|
16
|
+
loop do
|
|
17
|
+
print "#{get_logo}\tEnter your option:\n\t'list' | 'search' | 'add' | 'update' | 'delete' | 'quit' : "
|
|
18
|
+
choice = gets.chomp.downcase
|
|
19
|
+
|
|
20
|
+
if choice == "list"
|
|
21
|
+
SellerAPI.list_products
|
|
22
|
+
elsif choice == "search"
|
|
23
|
+
SellerAPI.search_product
|
|
24
|
+
elsif choice == "add"
|
|
25
|
+
SellerAPI.add_product
|
|
26
|
+
elsif choice == 'update'
|
|
27
|
+
SellerAPI.update_product
|
|
28
|
+
elsif choice == 'delete'
|
|
29
|
+
SellerAPI.delete_product
|
|
30
|
+
elsif choice == "quit"
|
|
31
|
+
break
|
|
32
|
+
else
|
|
33
|
+
puts "Woops, invalid input. Can you enter again?"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def self.show_buyer_options
|
|
40
|
+
system 'clear'
|
|
41
|
+
loop do
|
|
42
|
+
print "#{get_logo}\tEnter your option:\n\t'list' | 'search' | 'buy' | 'quit' : "
|
|
43
|
+
choice = gets.chomp.downcase
|
|
44
|
+
|
|
45
|
+
if choice == "list"
|
|
46
|
+
BuyerAPI.list_products
|
|
47
|
+
elsif choice == "search"
|
|
48
|
+
BuyerAPI.search_product
|
|
49
|
+
elsif choice == "buy"
|
|
50
|
+
BuyerAPI.buy
|
|
51
|
+
elsif choice == "quit"
|
|
52
|
+
break
|
|
53
|
+
else
|
|
54
|
+
puts "Woops, invalid input. Can you enter again?"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def self.init
|
|
62
|
+
ProductAPI.seed
|
|
63
|
+
TranscationAPI.seed
|
|
64
|
+
system 'clear'
|
|
65
|
+
print "#{get_logo}\tWhich type of user are you? 'Buyer' | 'Seller' : "
|
|
66
|
+
choice = gets.chomp.downcase
|
|
67
|
+
if choice == "buyer"
|
|
68
|
+
show_buyer_options
|
|
69
|
+
elsif choice == "seller"
|
|
70
|
+
show_seller_options
|
|
71
|
+
else
|
|
72
|
+
puts "Invalid input, try again?"
|
|
73
|
+
return init
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mobistore
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Raj Negi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Mobile store, with built-in JSON database and seeded objects. Type 'MobiStore.init'
|
|
14
|
+
to get started
|
|
15
|
+
email: raj.negi@weboniselab.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/mobistore.rb
|
|
21
|
+
homepage: http://github.com/rajn-webonise
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubyforge_project:
|
|
41
|
+
rubygems_version: 2.5.1
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: A CLI mobile store with JSON file database
|
|
45
|
+
test_files: []
|