<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Herna Michel on Medium]]></title>
        <description><![CDATA[Stories by Herna Michel on Medium]]></description>
        <link>https://medium.com/@LaBelleHerna?source=rss-9b882f32fb60------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*vtpjNdRc3DL67lKsc8FOpw.jpeg</url>
            <title>Stories by Herna Michel on Medium</title>
            <link>https://medium.com/@LaBelleHerna?source=rss-9b882f32fb60------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 16:27:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@LaBelleHerna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sinatra Portfolio Project]]></title>
            <link>https://medium.com/@LaBelleHerna/sinatra-portfolio-project-322e5682215d?source=rss-9b882f32fb60------2</link>
            <guid isPermaLink="false">https://medium.com/p/322e5682215d</guid>
            <category><![CDATA[mvc]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Herna Michel]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 16:02:26 GMT</pubDate>
            <atom:updated>2019-07-23T16:05:28.891Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sinatra Portfolio Project:<strong>LBH’s Recipe</strong></h3><p>For my Sinatra portfolio project, the task was to create a CRUD, MVC Sinatra application, uses ActiveRecord with Sinatra, uses multiple models, uses at least one has_many relationship on a User model and one belongs_to relationship on another model, has user accounts, where users can edit and delete only their own resources, and validates user input.</p><p>Sinatra is a Domain Specific Language implemented in Ruby that’s used for writing web applications, created by Blake Mizerany.</p><p>I created a simple web application called <strong>LBH’s Recipe</strong> that allows users to create a new account or sign in to manage recipe i.e it allows to user to Create, Read, modify and Update, and also delete their own recipe. This app was built for a Flatiron School project</p><p><strong>Step 1</strong>- I used the Corneal Template Ruby gem to lay out my basic application structure, and then type in the terminal <strong>bundle install </strong>that allows to install all Gem and Dependencies before starting your work.</p><p><strong>Step 2</strong>- Database Migrations</p><p>I created database migrations for each of my models that inherits from ActiveRecord.</p><p>To create migration, you have to type in you terminal:</p><pre>$ rake db:create_migration NAME=create_users</pre><pre>$ rake db:create_migration NAME=create_recipes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*Rv-f3nK6NV8NMTk2oPocAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*2-yIIRjB8YOiZ7fhaQq8Sg.png" /></figure><p>This will create a migration file in your migrations directory (./db/migrate by default), ready for editing. Therefore, to migrate your database we need to run <strong>rake db:migrate </strong>in your terminal without doing that you can not do anything, because our migration will stay pending. Inspect schema.rb to ensure your table was created as intended.</p><p><strong>Step 3: Model — View — Controller (MVC)</strong></p><p>There are 2 models in my simple app: User, and Recipe. The User model has many recipes, and the recipe model belongs to user. Those models allow us to interact with tables from our app. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*NwKH9uYeAQ7yrX9zwjRCBw.png" /><figcaption>recipe.rb</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*garL1SCB25ESmlZeh-d07g.png" /></figure><p><strong>4- Views</strong></p><p>Developed for a CRUD app, inside of views you can find erb files in order to support creating new users and recipes, viewing, editing, and deleting recipes from your app.</p><p><strong>5- Controllers</strong></p><p>The controller creates routes that take requests sent from the browser (“GET this data”, “POST that data”), it corresponds with the CRUD actions and views described above. In other words, a controller updates both models and views. by accepting input and performs the corresponding update. I added a controller for each model as users, and recipes that inherit from ApplicationController.</p><blockquote><strong><em>application_controller.rb</em></strong></blockquote><ul><li>route to my welcome page &amp; a few helper methods</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*7sMcFULN4sOeLeLtQKUy8A.png" /><figcaption>application_controller.rb</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=322e5682215d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Portfolio Project: CLI Data Gem]]></title>
            <link>https://medium.com/@LaBelleHerna/my-first-portfolio-project-cli-data-gem-a1db6838642?source=rss-9b882f32fb60------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1db6838642</guid>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[controller]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[scrape]]></category>
            <dc:creator><![CDATA[Herna Michel]]></dc:creator>
            <pubDate>Tue, 14 May 2019 14:00:48 GMT</pubDate>
            <atom:updated>2019-05-16T14:00:41.942Z</atom:updated>
            <content:encoded><![CDATA[<p>My name is Herna and I am a Flatiron student of Full Stack Web Development program. I am going to explain how to build a CLI GEM.</p><p>First-project is my first portfolio project. Before creating my cli gem, I read all notes and videos found on learn.co to make sure understanding everything to better realize my final project. My project uses the Nokogiri gem which is an open source software library to parse HTML. It has the following requirements:</p><ul><li>Provides a CLI (Command Line Interface)</li><li>Command Line Interface must provide access to data from a web page.</li><li>The data provided must go at least one level deep that shows the user a list of available data as well as be able to drill down into a specific item.</li><li>Use good OO design patterns. You should create a collection of objects — not hashes to store your data.</li><li>Your project should not be too similiar to the Ruby final projects as Tic-Tac-Toe with AI and Student Scraper.</li></ul><p><strong>Let’s show how to built my CLI Data Gem project in the following steps:</strong></p><p><strong>Step 1 Install your gem in your terminal</strong></p><blockquote>bundle gem first_project</blockquote><p>This gem provides a Command Line Interface(CLI) to data scraped from a public website for user to choose which information he wanted to get a list.</p><p><strong>Step 2 Add executable file</strong></p><p>let’s call the executable file first_project,it must place in a bin directory. This file requires a require_relative &#39;.lib/first_project&#39;that allows to load all of the files that are in the lib directory. It must begin to the following line:</p><p><em>#!/usr/bin/env ruby</em></p><p>Let’s create the executable file to load all of the files that are in the lib directory.</p><p>Here’s an example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*S2rZigVZnjnIqrTqw7FbJA.png" /></figure><p><strong>Step 3: Get permission</strong></p><pre>. ls -lah <em>#it allows to list all the files in the current directory.</em><br>. chmod +x first_project <em>#Make the file executable</em></pre><p><strong>step 4: File requirements</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*rqM7R0pb5UapBoBk8m9v9g.png" /></figure><p><strong>Step 5: Explain what it is doing.</strong></p><p>I added in the lib/directory two new files: CLI and SCRAPER.</p><ul><li>CLI class is a class controller that allows to interact which users and inside of it there are:</li></ul><blockquote><strong>#call method: </strong>it is responsible to<strong> </strong>bundle all methods as: #articles, #body and #byebye methods.</blockquote><blockquote><strong>#article and body</strong> <strong>method</strong> allow to interact with user input.</blockquote><blockquote><strong>#byebye method</strong> allows to exit when user choose an incorrect number</blockquote><ul><li>Scraper class allows to grab out data from websites</li></ul><pre>class FirstProject::Scraper</pre><pre>   attr_accessor :name, :availability, :price</pre><pre>  def self.today<br>    <em>#Scraping website and returning environmments base on this data</em><br>    self.scrape_envs<br>  end</pre><pre>def self.scrape_envs<br>    envs = []<br>    envs &lt;&lt; self.scrape_mall<br>    envs &lt;&lt; self.scrape_site<br>    envs &lt;&lt; self.scrape_details<br>    envs</pre><pre>  end</pre><pre>  def self.scrape_mall<br>    doc = Nokogiri::HTML(open(&quot;https://www.africanmall.com/jurllyshe-camouflage-slim-cami-dress.html?pid=3662&amp;1837=11772&quot;))</pre><pre>    short_dress = self.new<br>    short_dress.name = doc.css(&quot;h1.h1box&quot;).text<br>    short_dress.price = doc.css(&quot;#product-price-3662.regular-price span.price&quot;).text<br>    short_dress.availability = true<br>    short_dress<br>  end</pre><pre>  def self.scrape_site<br>    doc = Nokogiri::HTML(open(&quot;https://www.ebay.com/itm/Microspareparts-Mobile-iPhone-7-LCD-Assembly-White-MOBX-IPO7GP-LCD-W-H-NEW/362625346140?hash=item546e27aa5c:g:FtsAAOSwU8Rcum2P&quot;))</pre><pre>    gadget_7 = self.new<br>    gadget_7 .name = doc.css(&quot;h1.it-ttl&quot;).text<br>    gadget_7 .price = doc.css(&quot;span.notranslate&quot;).text<br>    gadget_7 .availability = true<br>    gadget_7<br>  end</pre><pre>def self.scrape_details<br>    doc = Nokogiri::HTML(open(&#39;<a href="https://www.tripadvisor.com/Hotel_Review-g147307-d7592296-Reviews-Marriott_Port_au_Prince_Hotel-Port_au_Prince_Ouest_Department_Haiti.html&#39;">https://www.tripadvisor.com/Hotel_Review-g147307-d7592296-Reviews-Marriott_Port_au_Prince_Hotel-Port_au_Prince_Ouest_Department_Haiti.html&#39;</a>))</pre><pre>hotel = self.new<br>      hotel.name = doc.css(&quot;h1.ui_header&quot;).text<br>      hotel.price = doc.css(&quot;span.xthrough&quot;).text<br>      hotel.availability = true<br>      hotel<br>    end</pre><pre>end</pre><p>OUPUT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCbBEo2ZXLrSOEHpNjF0sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*FJpsN85c800mcLtYCj6Ouw.png" /></figure><p><strong>My short Video</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FpPnpbqWN1Ls%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpPnpbqWN1Ls&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpPnpbqWN1Ls%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c805a252c11aaeac4b5ff75fc4c81fe/href">https://medium.com/media/0c805a252c11aaeac4b5ff75fc4c81fe/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1db6838642" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>