lita-onewheel-moonphase 2.0.0 → 2.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 +4 -4
 - data/.gitignore +1 -0
 - data/lib/lita/handlers/onewheel_moonphase.rb +33 -24
 - data/lita-onewheel-moonphase.gemspec +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8a7d041dde8e1efb8eaee9efab33bce5ba0363a0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6cd106bdc9811c0d445ec9ba7f93d75ebbf5d9b6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 853e0d580ba2590265bff0debab71090abf985fe2a7970dea5d555486254db54630d26eb10fa6afcf42cfe556c8c08ba0365eaa00bf4df23062413cc8041d3da
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 25287ddb8822fdf9c7d5041bdc5473c275ddb3db8d0cd45ca1ef432a297c4cce9139ab782e469c440d16efdf11e88250a1bbb967edc2ece601bcd88ee1b2ae37
         
     | 
    
        data/.gitignore
    CHANGED
    
    
| 
         @@ -9,18 +9,27 @@ module Lita 
     | 
|
| 
       9 
9 
     | 
    
         
             
                        help: {'moon [location]' => 'Get Moon phase data'}
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  # 🌑🌛
         
     | 
| 
       12 
     | 
    
         
            -
                  # emoonjis = %w(🌚🌘🌗🌔🌕🌖🌓🌒)
         
     | 
| 
       13 
12 
     | 
    
         | 
| 
       14 
13 
     | 
    
         
             
                  def moon(response)
         
     | 
| 
       15 
14 
     | 
    
         
             
                    location = get_location(response)
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
15 
     | 
    
         
             
                    moon = get_data(location)
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
17 
     | 
    
         
             
                    # today = Time.now
         
     | 
| 
       20 
18 
     | 
    
         
             
                    rise_time = Time.parse moon['moondata']['rise']
         
     | 
| 
       21 
19 
     | 
    
         
             
                    set_time = Time.parse moon['moondata']['set']
         
     | 
| 
       22 
20 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                     
     | 
| 
      
 21 
     | 
    
         
            +
                    emoonjis = {
         
     | 
| 
      
 22 
     | 
    
         
            +
                        'New Moon'        => '🌚',
         
     | 
| 
      
 23 
     | 
    
         
            +
                        'Waning Crescent' => '🌘',
         
     | 
| 
      
 24 
     | 
    
         
            +
                        'Last Quarter'    => '🌗',
         
     | 
| 
      
 25 
     | 
    
         
            +
                        'Waxing Gibbous'  => '🌔',
         
     | 
| 
      
 26 
     | 
    
         
            +
                        'Full Moon'       => '🌕',
         
     | 
| 
      
 27 
     | 
    
         
            +
                        'Waning Gibbous'  => '🌖',
         
     | 
| 
      
 28 
     | 
    
         
            +
                        'First Quarter'   => '🌓',
         
     | 
| 
      
 29 
     | 
    
         
            +
                        'Waxing Crescent' => '🌒'
         
     | 
| 
      
 30 
     | 
    
         
            +
                    }
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    reply = "#{emoonjis[moon['moondata']['curphase']]} Moon phase #{moon['moondata']['fracillum']}, #{moon['moondata']['curphase']}.  "
         
     | 
| 
       24 
33 
     | 
    
         
             
                    reply += "Rise: #{rise_time.strftime("%H:%M")}  Set: #{set_time.strftime('%H:%M')}"
         
     | 
| 
       25 
34 
     | 
    
         
             
                    Lita.logger.debug "Replying with #{reply}"
         
     | 
| 
       26 
35 
     | 
    
         
             
                    response.reply reply
         
     | 
| 
         @@ -44,28 +53,28 @@ module Lita 
     | 
|
| 
       44 
53 
     | 
    
         
             
                  end
         
     | 
| 
       45 
54 
     | 
    
         | 
| 
       46 
55 
     | 
    
         
             
                  # Next step, determine waxing or waning.
         
     | 
| 
       47 
     | 
    
         
            -
                  def get_moonmoji(percent_full, phase)
         
     | 
| 
       48 
     | 
    
         
            -
                    moonmoji = ''
         
     | 
| 
       49 
     | 
    
         
            -
                    waning = false
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                    if phase.match /waning/i
         
     | 
| 
       52 
     | 
    
         
            -
                      waning = true
         
     | 
| 
       53 
     | 
    
         
            -
                    end
         
     | 
| 
      
 56 
     | 
    
         
            +
                  # def get_moonmoji(percent_full, phase)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    # moonmoji = ''
         
     | 
| 
      
 58 
     | 
    
         
            +
                    # waning = false
         
     | 
| 
       54 
59 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                     
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                     
     | 
| 
       67 
     | 
    
         
            -
                    moonmoji
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
                    # if phase.match /waning/i
         
     | 
| 
      
 61 
     | 
    
         
            +
                    #   waning = true
         
     | 
| 
      
 62 
     | 
    
         
            +
                    # end
         
     | 
| 
      
 63 
     | 
    
         
            +
                    #
         
     | 
| 
      
 64 
     | 
    
         
            +
                    # case percent_full.sub('%', '').to_i
         
     | 
| 
      
 65 
     | 
    
         
            +
                    #   when 0..1
         
     | 
| 
      
 66 
     | 
    
         
            +
                    #     moonmoji = '🌚'
         
     | 
| 
      
 67 
     | 
    
         
            +
                    #   when 2..32
         
     | 
| 
      
 68 
     | 
    
         
            +
                    #     moonmoji = waning ? '🌘' : '🌒'
         
     | 
| 
      
 69 
     | 
    
         
            +
                    #   when 33..62
         
     | 
| 
      
 70 
     | 
    
         
            +
                    #     moonmoji = phase.match(/last/i) ? '🌗' : '🌓'
         
     | 
| 
      
 71 
     | 
    
         
            +
                    #   when 63..90
         
     | 
| 
      
 72 
     | 
    
         
            +
                    #     moonmoji = waning ? '🌖' : '🌔'
         
     | 
| 
      
 73 
     | 
    
         
            +
                    #   when 91..100
         
     | 
| 
      
 74 
     | 
    
         
            +
                    #     moonmoji = '🌕'
         
     | 
| 
      
 75 
     | 
    
         
            +
                    # end
         
     | 
| 
      
 76 
     | 
    
         
            +
                    # moonmoji
         
     | 
| 
      
 77 
     | 
    
         
            +
                  # end
         
     | 
| 
       69 
78 
     | 
    
         | 
| 
       70 
79 
     | 
    
         
             
                  Lita.register_handler(self)
         
     | 
| 
       71 
80 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       2 
2 
     | 
    
         
             
              spec.name          = 'lita-onewheel-moonphase'
         
     | 
| 
       3 
     | 
    
         
            -
              spec.version       = '2.0. 
     | 
| 
      
 3 
     | 
    
         
            +
              spec.version       = '2.0.1'
         
     | 
| 
       4 
4 
     | 
    
         
             
              spec.authors       = ['Andrew Kreps']
         
     | 
| 
       5 
5 
     | 
    
         
             
              spec.email         = ['andrew.kreps@gmail.com']
         
     | 
| 
       6 
6 
     | 
    
         
             
              spec.description   = %q{Lita interface to a lambda representing Moon phase data.}
         
     |