title: Receiving undefined method error in ruby (no rails)
body: <p>I am really new to this so I apologize for my ignorance and I have searched for resources before asking.</p>
  <p>I am using regular ruby and I am using an API.</p>
  <p>I keep receiving undefined method error when I run things and I cannot figure out why.</p>
  <p>So, this is my code.... the issue is the last two methods I think... but I don't understand what it is that is cause the method I am calling #print_lighting_time to come up as undefined. Other resources have stated that it is usually an issue with an object but I guess that isn't making sense to me...</p>
  <p>here is the code for the CLI that isn't working</p>
  <pre><code>class Cli
      def start 
         puts &quot;Shabbat Shalom!&quot;
         Api.get_data
         check_date_options
      end
  
  def check_date_options
      puts &quot;Curious when to light your candles for Shabbos? Type 'Dates' to find out!&quot;
      check_date
  end
  
      def check_date 
          input = get_input
  
              if input == &quot;Dates&quot;
                  list_dates
              else 
                  invalid_date  
              end
      end
  
      def get_input
          gets.chomp
        end 
  
      def invalid_date
          puts &quot;Invalid date! Check your date and reenter!&quot;
          binding.pry
      end
  
      def list_dates
            CandleLighting.all.each_with_index do |title, index|
              puts &quot;#{index}. #{title.date}&quot;
          end
  
          lighting_times_info_list
      end
      
    def lighting_times_info_list
          puts &quot;Select the date to view the lighting time!&quot; 
          lighting_times_info
      end
  
  def lighting_times_info
      input = get_input
          
      if input.to_i.between?(0, 60)
  
          index = input.to_i 
         date = CandleLighting.all[index]
          print_lighting_time(date)
      else 
          invalid_date
          lighting_times_info_list
      end
  
  
  def print_lighting_time(date)
      puts &quot;Shabbos is:#{date}&quot;
      puts &quot;Light candles by: #{date.title}&quot;
        
  end 
  end
  end
  </code></pre>
  <p>and here is the code for the CandleLighting class</p>
  <pre><code>class CandleLighting
  
      attr_accessor :title, :date
  
      @@all = []
  
      def initialize(title, date)
          @title = title
          @date = date
          @@all &lt;&lt; self
      end
  
      def self.all 
          @@all 
      end
  end
  </code></pre>
  <p>and the code for the API</p>
  <pre><code>class Api
  def self.get_data
      load_candlelightings
  end
  
      def self.load_candlelightings
          response = RestClient.get(&quot;https://www.hebcal.com/hebcal?v=1&amp;cfg=json&amp;maj=on&amp;min=on&amp;mod=on&amp;nx=on&amp;year=now&amp;month=x&amp;ss=on&amp;mf=on&amp;c=on&amp;geo=geoname&amp;geonameid=5128581&amp;m=50&amp;s=on&quot;)
          data = JSON.parse(response.body)
          data[&quot;items&quot;].each do |hash|
              CandleLighting.new(hash[&quot;title&quot;], hash[&quot;date&quot;]) if hash[&quot;title&quot;].include?(&quot;Candle lighting&quot;)
  
          end  
      end
  end 
  </code></pre>
  <p>and finally the error message that relates to line 52 of the CLI  the line being &quot;print_lighting_time(date)</p>
  <pre><code>Traceback (most recent call last):
          6: from bin/run:4:in `&lt;main&gt;'
          5: from /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:5:in `start'
          4: from /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:10:in `check_date_options'
          3: from /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:17:in `check_date'
          2: from /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:37:in `list_dates'
          1: from /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:42:in `lighting_times_info_list'
  /Users/allisonperry/Development/code/Mod1/candle-lighting-times/lib/cli.rb:52:in `lighting_times_info': undefined method `print_lighting_time' for #&lt;Cli:0x00007fa94f883e48&gt; (NoMethodError)
  </code></pre>
  <p>I am not sure if all this code is even necessary in order to help... but I have been trying to fix this for quite some time and its not happening.</p>
  <p>Thank you in advance!</p>