<?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 Rajeev Kushwaha on Medium]]></title>
        <description><![CDATA[Stories by Rajeev Kushwaha on Medium]]></description>
        <link>https://medium.com/@rajeev.kushwaha1401?source=rss-61f0c9c28910------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YXtcKagdgCe57A7B.jpg</url>
            <title>Stories by Rajeev Kushwaha on Medium</title>
            <link>https://medium.com/@rajeev.kushwaha1401?source=rss-61f0c9c28910------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:53:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajeev.kushwaha1401/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[Rspec in rails(TDD test driven development)]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/rspec-in-rails-tdd-test-driven-development-9840c268065?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/9840c268065</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[rspec]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Thu, 22 Jul 2021 04:24:04 GMT</pubDate>
            <atom:updated>2021-07-22T04:24:04.044Z</atom:updated>
            <content:encoded><![CDATA[<p>Rspec is used for run our spec file</p><p>gem install rspec</p><p>basic rspec(test case)</p><p>Inside a test folder created a hello folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*8zpyoeLcAaJiW3h1NifqPw.png" /><figcaption>hello</figcaption></figure><p>Inside created a hello.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*m8IBZzN1gLZvbGa7TB1y-g.png" /><figcaption>hello.rb</figcaption></figure><p>Inside created a hello_spec.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*BOY3JLNEa1ch4CRHlsRlOA.png" /><figcaption>hello_spec.rb</figcaption></figure><p><strong>RSpec</strong> = RS are always capital in RSpec <br><strong>describe</strong> = is for decription or details of class<br><strong>Hello = </strong>is class name <strong><br>it “it should return hello world “ </strong><br># this for the message means what output is shown we already told him through the message.<br># declaring a varible and calling method say_hello with class name hello <br> no need to create instanse beacuse its initialized method <br><strong>greeting = Hello.say_hello()</strong></p><p><strong>Now except greeting</strong></p><p>except(gretting).to eq(‘Hello World’) <br><br>for running rspec file command is <br><strong>rspec file_name.rb</strong></p><p><strong>Second example:</strong></p><p>Second test case for check number is palindorme or not</p><ul><li>Test a word is a palindrome</li><li>Spells the same forwards a backwards</li><li>Eampele of some words — — Madam, Level , Deed etc</li><li>Not a palidrome — Food ,Energy</li></ul><p>Step1 — Devise how you would test this ?</p><p>Two context here -</p><p>1) The word is a palindorme</p><p>- it should read the same forwards as backwards</p><p>2) the word is not a palindrome <br>- it should not read the same forwards as backwards</p><p>created a word.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*TlkGJ0VpzDhCKyWkY5wUPA.png" /><figcaption>word.rb</figcaption></figure><p>created a word_spec.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*Sy2f_h8h9LL1KLB_kPcKnQ.png" /><figcaption>word_spec.rb</figcaption></figure><p>Run the file rspec word_spec.rb</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9840c268065" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[List of all HTTP errors]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/list-of-all-http-errors-af7a063404f2?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/af7a063404f2</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[http-error]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[error]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Wed, 21 Jul 2021 20:41:19 GMT</pubDate>
            <atom:updated>2021-07-21T20:41:19.563Z</atom:updated>
            <content:encoded><![CDATA[<p>List of all errors</p><ul><li>400 (Bad request)</li><li>401(Authorization required)</li><li>402 (Payment required)</li><li>403 (Forbidden)</li><li>404 (Not found)</li><li>405 (Method not allowed)</li><li>406 (Not acceptable)</li><li>407 (Proxy authentication required)</li><li>408 (Request Timeout)</li><li>409 (Conflict)</li><li>410 (Gone)</li><li>411 (Length required)</li><li>412 (Precondition failed)</li><li>413 (Request entity too large)</li><li>414 (Request URI too large)</li><li>415 (Unsupported media type)</li><li>416 (Request range not satisfiable)</li><li>417 (Expectation failed)</li><li>422 (Unprocessable entity)</li><li>423 (Locked)</li><li>424 (Failed dependency)</li><li>500 (Internal server error)</li><li>501 (Not Implemented)</li><li>502 (Bad gateway)</li><li>503 (Service unavailable)</li><li>504 (Gateway timeout)</li><li>505 (HTTP version not supported)</li><li>506 (Variant also negotiates)</li><li>507 (Insufficient storage)</li><li>510 (Not Extended)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af7a063404f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create REST APIS Using Grep Gem in rails]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/how-to-create-rest-apis-using-grep-gem-in-rails-3e5d278426fd?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e5d278426fd</guid>
            <category><![CDATA[gem]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby-on-rails-development]]></category>
            <category><![CDATA[rails-api]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Fri, 16 Jul 2021 22:01:49 GMT</pubDate>
            <atom:updated>2021-07-16T22:01:49.176Z</atom:updated>
            <content:encoded><![CDATA[<p>Grape is a REST-like API framework for Ruby. It’s designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.</p><p>When we are creating a rest apis using model, controller , routes and serializer then we have to follow so many things .</p><p>&gt; Format <br>&gt; Versioning <br>&gt; Authentication <br>&gt; Validations <br>&gt; Logging <br>&gt; Handling exceptions <br>&gt; So much more!</p><p>But no need to worry , we have one more solution which is overcome this things. <br>Which name is grep .Grape is ruby framework .<br><a href="https://github.com/ruby-grape/grape">https://github.com/ruby-grape/grape</a><br>check this link. To see all the features of grep</p><p><strong>GRAPE FRAMEWORK</strong></p><p>→ REST-like API framework for Ruby</p><p>→ Simple DSL to easily develop RESTful APIs</p><p>→ Built-in support for common conventions</p><p>Now let’s come to the implementaion part …….</p><p>add gem into gemfile <br>gem ‘grape’<br>and run bundle install</p><p>Now we have to create namespace <br>create a folder name api in app <br>created a subfolder in api , I am just using namespacing</p><p>Created <strong>api.rb</strong></p><p>api/grapes/v1</p><p>module Grapes<br> class API &lt; Grape::API <br> format format_strng :json <br> prefix :api <br> version ‘v1’,:path<br> end<br>end</p><p>Create new file movies.rb</p><p>module Grapes<br> module V1<br> class Movies &lt; Grapes::API</p><p><strong>Index api</strong></p><p>resources :movies do<br> desc ‘Return all User’<br> get do <br> Movie.all<br> end</p><p>resource for routes <br>desc stands for description <br>get do <br>Movie.all<br>end</p><p>get request method to shows all movie list</p><p><strong>Show api</strong></p><p>desc “Return spicific movie”<br> route_param :id, type: Integer do <br> get do<br> movies = Movie.find(params[:id])<br> { movie: movie }<br> rescue ActiveRecord::RecordNotFound <br> error!(‘Record Not Found’,404)<br> end</p><p>end</p><p>In show api need (params[:id])</p><p>and passing data in hash if record not found then rescue error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfzsBLfQEWAiraKUSlPRnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*IkmdlRuBBBdw_tttn04g-w.jpeg" /><figcaption>api using grep</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e5d278426fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phone Verification API or SMS OTP API For Sending One Time Passwords (OTPs) In Rails.]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/phone-verification-api-or-sms-otp-api-for-sending-one-time-passwords-otps-in-rails-cbd901115165?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbd901115165</guid>
            <category><![CDATA[otp-verification-in-rails]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[otp-sms-api-methods]]></category>
            <category><![CDATA[sms-verification-service]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 22:53:46 GMT</pubDate>
            <atom:updated>2021-07-08T22:59:58.758Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*IjmtzhHIgI6qD4zyhblFUQ.jpeg" /></figure><p><strong>Steps For Implementing Phone Verification<br></strong>Using <a href="https://2factor.in/">2Factor.in</a> we have tried to Simplify <a href="https://2factor.in/">OTP Verification Flow</a> by offering simple HTTP APIs.<br>This article would provide you with a High Level Integration flow for implementing SMS OTP Based Phone Verification ( 2FA ) solution.</p><h4>Implementing OTP logic with 2Factor AUTOGEN endpoint</h4><p>AUTOGEN endpoint generates OTP value at run time &amp; sends it to the end user thereby eliminating need to <strong>Generate </strong>or <strong>Store </strong>OTP value at your end.</p><p><strong>Sending OTP steps:</strong></p><ol><li>Display an input box (so end user can provide his phone number).</li><li>User click on Signup / Login button.</li><li>Your application invokes 2Factor’s AUTOGEN API Endpoint.<br>https://2factor.in/API/V1/{api_key}/SMS/+91{user&#39;s_phone_no}/AUTOGEN<br>Sample response: <br>{ &quot;Status&quot;: &quot;Success&quot;, &quot;Details&quot;: &quot;5D6EBEE6-EC04-4776-846D&quot;}</li></ol><p>Details value in above response corresponds to uniqe OTP session id.</p><p>{ &quot;Status&quot;: &quot;Success&quot;, &quot;Details&quot;: &quot;5D6EBEE6-EC04-4776-846D&quot;}</p><p><strong>Verifying OTP:<br></strong>1. Ask user to input OTP received <br>2. Invoke 2Factor’s VERIFY Endpoint to verify OTP entered by user<br>https://2factor.in/API/V1/{api_key}/SMS/VERIFY/{session_id}/{otp_entered_by_user}</p><p>Here session_id = Details value returned in SendOTP step.<br><strong>Sample Response:</strong></p><p>{ &quot;Status&quot;: &quot;Success&quot;, &quot;Details&quot;: &quot;OTP Matched&quot; }</p><p>If the response received from our API says ‘OTP Matched’, then you can mark the user as verified in your database Else ask user to Retry.</p><p><strong>Implementation of sms otp verification in rails.<br></strong>Created file project_name/app/services/factor_sms.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*mhGczFhAcV7sYTVPG2qJCQ.png" /></figure><p>call method for send otp. Where we want to send the otp, then we have to call the call method.</p><p>user_controller.rb<br>session=FactorSms.new(user.phone_number).call<br> session_id = session[“Details”]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*Ip3RGNDERQFIAp366JlBgA.png" /></figure><pre>Verify_otp method used for phone otp verification.</pre><p>if response .code == 400 then otp verified successfully otherwise <br>otp is Invalid.</p><p><a href="https://2factor.in/API/V1/%7Bapi_key%7D/SMS/+91%7Buser&#39;s_phone_no}/{custom_otp_val}">https://2factor.in/API/V1/{api_key}/SMS/+91{user&#39;s_phone_no}/{custom_otp_val</a>}</p><p>In last, we can also use custome_otp_val</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbd901115165" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(SCA) Strong Customer Authentication with Stripe — PSD2 | 3DS2 (paymentIntents process)]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/sca-strong-customer-authentication-with-stripe-psd2-3ds2-paymentintents-process-7401e988db92?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/7401e988db92</guid>
            <category><![CDATA[stripe]]></category>
            <category><![CDATA[integrated-stripe-3ds]]></category>
            <category><![CDATA[3ds2-stripe-scure]]></category>
            <category><![CDATA[stripe-integration]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 10:28:14 GMT</pubDate>
            <atom:updated>2021-07-08T10:28:14.160Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>(SCA) Strong Customer Authentication with Stripe — PSD2 | 3DS2 (paymentIntents process)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yyyIqamK4DHBzeFQ_rYLhA.jpeg" /></figure><p>According integration needs an important update as part of the second Payment Services Directive(PSD2).</p><p>3DS2 Secure is like the project manager of online payments. For extra fraud protection, 3D Secure requires customers to complete an additional verification step with the card issuer when paying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OoEnoYA-jd0w-ACaX_K9Ug.jpeg" /><figcaption>STEPS</figcaption></figure><p><strong>EXEMPTIONS<br></strong>Specific types of low-risk payments may be exempted. But at the end the cardholder’s bank ultimately decide.</p><p><strong>ADDITIONAL PAYMENT STEP <br></strong>A new step in the payment flow</p><p><strong>ADDITIONAL AUTHENTICATION <br></strong>Key-feature: 3D Secure 2. New authentication standard to provide added security to online payments</p><p><strong>INTEGRATION <br></strong>Different choices, based on your needs. One-time payment? <br>Automatic or manual confirmation?</p><p>let me explain:-<br><strong>Payments &lt; 30$<br></strong>If transaction &lt; $30 will be considered ‘low value’ and may be exempted.</p><p><strong>Fixed-amount subscriptions<br></strong>In this user can recurring payments, with same amount &amp; with same business.</p><p><strong>Merchant initiated transaction<br></strong>payments made with saved cards when the customer is not present in the checkout flow. Fall outside the scope of SCA. Similar to requesting an exemption.</p><p><strong>Trusted beneficiaries<br></strong>When completing authentication for a payments, customer may have the options to whitelist a business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BT-dtiyVuKGERdyDagDseQ.jpeg" /><figcaption>additional payment steps</figcaption></figure><p><strong>→ INITIATE A PAYMENT<br></strong>In this step user have to enters card details and submits the form.</p><p>→ <strong>NEW! AUTHENTICATION<br></strong>Stripe detects whether auth is needed. In such a case,3DS2 will be used to proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5DPP35AzHGJSDfTrnkPTg.jpeg" /><figcaption>3D Secure 2 (3DS2)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iEE5ybJjO8Gw2p2q08iwMQ.jpeg" /><figcaption>Additional payment steps</figcaption></figure><p>In additional payment steps authentication have multiple types. eg. Pin/Password, fingerprint/face.</p><p><strong>Implementation of Stripe 3DS2 System</strong></p><p>First need to create PaymentIntent objects. you can read more about the different payment flows available via the payment Intents API here :-<br>https://stripe.com/docs/payments/payment-intents</p><pre># Set your secret key. Remember to switch to your live secret key in production.<br># See your keys here: https://dashboard.stripe.com/apikeys<br>Stripe.api_key = &quot;sk_test_4eC39HqLyjWDarjtT1zdp7dc&quot;</pre><pre>intent = Stripe::PaymentIntent.create({<br>  amount: 1099,<br>  currency: &#39;usd&#39;,<br>  payment_method_types: [&#39;card&#39;],<br>})</pre><p>Confirm the paymentIntent from the server</p><pre>intent = Stripe::PaymentIntent.confirm(<br>  &#39;{{PAYMENT_INTENT_ID}}&#39;,<br>  {<br>    return_url: &#39;https://example.com/return_url&#39;,<br>  }<br>)</pre><p><strong>Check the paymentIntent status <br></strong>402 HTTP status code means request failed,meaning that the payment was unsuccessful.<br>200 HTTP status code means payment completed.</p><p><strong>Testing the 3D Secure Flow</strong><br>Use a Stripe test card with any CVC, postal code, and future expiration date to trigger 3DS authentication challenge flows while in test mode.</p><p>When you build an integration with your test API keys, the authentication process displays a mock authentication page. In that page, you can either authorize or cancel the payment. Authorizing the payment simulates successful authentication and redirects you to the specified return URL. Clicking on the Failure button simulates an unsuccessful attempt at authentication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7401e988db92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Explore the List of Database Rake Tasks]]></title>
            <link>https://medium.com/@rajeev.kushwaha1401/explore-the-list-of-database-rake-tasks-6572694a063e?source=rss-61f0c9c28910------2</link>
            <guid isPermaLink="false">https://medium.com/p/6572694a063e</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[rake]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby-on-rails-development]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Rajeev Kushwaha]]></dc:creator>
            <pubDate>Wed, 12 Aug 2020 12:31:52 GMT</pubDate>
            <atom:updated>2020-08-12T12:31:52.970Z</atom:updated>
            <content:encoded><![CDATA[<p>db:create creates the database for the current environment</p><p>db:create:all creates the database for all environments</p><p>db:drops drops the database for the current environments</p><p>db:drops:all drops the database for all environments</p><p>db:migrate runs migrations for the current environment that have not run yet</p><p>db:migrate:up runs one specific migration</p><p>db:migrate:down rolls back one specific migration</p><p>db:migrate:status shows current migration status</p><p>db:rollback rolls back the last migration</p><p>db:forward advances the current schema version to the next one</p><p>db:seed runs the db/seed.rb file</p><p>db:schema:load loads the schema into the current environment’s database</p><p>db:schema:dump dumps the current environment’s schema(and seems to create the db as well)</p><p>db:setup runs db:schema:load, db:seed</p><p>db:reset runs db:drop db:setup</p><p>db:migrate:redo runs(db:migrate:down db:migrate:up) or (db:rollback db:migrate:migrate) depending on the specified migration</p><p>db:migrate:reset runs db:drop db:create db:migrate</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6572694a063e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>