Advertisement
Guest User

Untitled

a guest
Jan 31st, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.45 KB | None | 0 0
  1. spinlister
  2. ------
  3. Well, they have toomany thins to handel they are currently working on next level which allow geolocation of bike(current when it is in use)
  4. and i found a letest concept by them to rent in loop with their smart lock protection ....
  5.  
  6.  
  7.  
  8. Let's Talk about Technology stack, i am not sute what they are using but if i have to build i will select something like this....
  9. -----------------------------------------------------------------------------------------------------------------------------
  10.  
  11. PLSql or MongoDB
  12. JQuery
  13. Nginx 1.7.12
  14. Ruby on Rails
  15. Ruby
  16. react.js or anguler.js
  17. Google Analytics
  18. Handlebars
  19. Moment.js
  20. Underscore.js
  21.  
  22.  
  23. Welll, They have server with ip: 104.25.16.12
  24. city: San Francisco
  25. Country: US
  26. Host/Organization/ISP: cloudflare
  27. last update on 30/01/2017 at around 23 o'clock
  28.  
  29. open ports: 80, 443, 2082, 2083, 2086-87, 8080, 8443, 8880
  30.  
  31.  
  32.  
  33.  
  34. Let's talk about task(The database)
  35. ------------------------------------
  36.  
  37. For building this application i will use "devise" and "cancancan" for simple user authorization and access
  38. Second, for location "geolocation" is best fit
  39. ...............................................
  40.  
  41. This prototype need some models like USER, RIDE, RESERVATION, PHOTO and COMMENTS...
  42.  
  43. Lets start with model and their relations.....
  44. (i am going to define their relation as rails style...)
  45. (inn this task, i am trying to write some validation and some function to show you my rails knowledge)
  46.  
  47. 1.User
  48. ------
  49. class User < ActiveRecord::Base
  50. devise :database_authenticatable, :registerable,
  51. :recoverable, :rememberable, :trackable, :validatable,
  52. :omniauthable #by default function from devise
  53. validates :fullname, length: {maximum: 50}, presence: true
  54.  
  55. has_many :rides
  56. has_many :reservations
  57. has_many :comments
  58.  
  59. # we can add some omni-auth futures in it like login with facebook and google and funcution will like
  60. def self.from_omniauth(auth)
  61. user = User.where(email: auth.info.email).first
  62. if user
  63. return user
  64. else
  65. where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
  66. user.fullname = auth.info.name
  67. user.provider = auth.provider
  68. user.uid = auth.uid
  69. user.email = auth.info.email
  70. user.image = auth.info.image
  71. user.password = Devise.friendly_token[0, 20]
  72. end
  73. end
  74. end
  75. end
  76.  
  77. 2.ride
  78. ------
  79. class Ride < ActiveRecord::Base
  80. belongs_to :user
  81. has_many :photos
  82. has_many :reservations
  83. has_many :comments
  84. geocoded_by :address
  85. # If address is updated, geocode will generate a new set of latitude and longitude
  86. after_validation :geocode, if: :address_changed?
  87.  
  88. validates :home_type, :room_type, :accomodate, :bedroom, :bathroom, :listing_name, :summary, :address, presence: true
  89. validates :listing_name, length: {maximum: 50}
  90. validates :summary, length: {maximum: 500}
  91. end
  92.  
  93. 3.Reservation
  94. ------------
  95. class Reservation < ActiveRecord::Base
  96. belongs_to :user
  97. belongs_to :ride
  98. end
  99.  
  100. 4.Photo
  101. --------
  102. class Photo < ActiveRecord::Base #here we can use many gem like paperclip or carrerway probebaly mt spelling are worng
  103. belongs_to :rides
  104.  
  105. has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }
  106. validates_attachment_content_type :image
  107. end
  108.  
  109. 5.comment(Feedback)
  110. ---------
  111. class Comment < ActiveRecord::Base
  112. belongs_to :rides
  113. belongs_to :users
  114.  
  115. ## now all relationship are shown here
  116.  
  117.  
  118. Now Some points
  119. ---------------
  120. -- using cancanan we add some fields to specify them as HOST, ADMIN and CLIENTS
  121. and provide them a service like it ...
  122.  
  123. -- I will use UX as like First page is a searching page to find a room and reserve ir and after it
  124. they wil pay using paypal, braintree or stripe like service provider ##i didn't made table of it but it will relate to reservation and use both from many to many associations
  125.  
  126. -- i didn't introduce delay_job module for confirmation instruction mail from devise..
  127. --- till their is to many tables need for notification, discounts and other functionality,however, their is a table for coupons as well
  128.  
  129. But most part of this application is searching ...
  130. in ruby many gem we have we can use "ransack", "acts_as_bookable", :elestic search" and many more but i recommend to make it by ourself for a better result, because this kind of app are alwase reliable on their search...
  131.  
  132. --chat for host and clients
  133.  
  134.  
  135. -- well according to my search in spinlister they are going to provide their own service of bikes, in which they provide bike with geolocation and a smart lock
  136.  
  137.  
  138. Geolocation and smartlock--
  139. -------------------------
  140. if we have to inpliments this kind of things we have to make some api for geolocation tracking and password system for smart lock.
  141. smart lock need a separet api with high data encryption
  142.  
  143. well we can build a lock bye own and with geolocation it will cost us around 25-35 USD, if all components can essly avilableil
  144.  
  145. well if you going to china for this think and specific bord for smartlock and geolocation wich will cost you less
  146. basically we need ardino for it simple implimentation and sometimes we need python or embedded C to programme it
  147. basically smartlock is just a IOT module
  148. --- if yu are looking for servse like this you have to wait for a long time because their are many micro services we need to impliments
  149.  
  150.  
  151. ---- if you are looking for more on smartlocks i can made another document for it (smartlock and bluetooth)
  152.  
  153.  
  154. In this Task i didn't specifed field of data base because they are almost same as airbnb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement