lita-onewheel-moonphase 2.0.1 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a7d041dde8e1efb8eaee9efab33bce5ba0363a0
4
- data.tar.gz: 6cd106bdc9811c0d445ec9ba7f93d75ebbf5d9b6
3
+ metadata.gz: cb306ec44675d3797d2386f3b44ec937aef0ff4b
4
+ data.tar.gz: 0775144f9aac4a325e0c0252cf90712759ba74d5
5
5
  SHA512:
6
- metadata.gz: 853e0d580ba2590265bff0debab71090abf985fe2a7970dea5d555486254db54630d26eb10fa6afcf42cfe556c8c08ba0365eaa00bf4df23062413cc8041d3da
7
- data.tar.gz: 25287ddb8822fdf9c7d5041bdc5473c275ddb3db8d0cd45ca1ef432a297c4cce9139ab782e469c440d16efdf11e88250a1bbb967edc2ece601bcd88ee1b2ae37
6
+ metadata.gz: d5e2a4d79e40e11fa17497bfe46649b75e720e4cdf7f6bf442ac267cea83f5f49e52a9210d854185812acfdb82dbd634566668d44f3b379c79ee8c2a66e70826
7
+ data.tar.gz: 96911a7967070e1b6fe2b9d30aaa9b5c3921c21c45fdb6c9ab855b5d738715b5ecad6c920bb9db5188797646c9bdda5a06f65169e1b369320e05c5fbea294069
@@ -8,8 +8,35 @@ module Lita
8
8
  command: true,
9
9
  help: {'moon [location]' => 'Get Moon phase data'}
10
10
 
11
+ route /^mars$/i,
12
+ :mars,
13
+ command: true,
14
+ help: {'mars' => 'Get Mars weather data'}
15
+
11
16
  # 🌑🌛
12
17
 
18
+ def mars(response)
19
+ api_resp = RestClient.get 'https://api.maas2.jiinxt.com/'
20
+ data = JSON.parse(api_resp)
21
+ {
22
+ "status": 200,
23
+ "id": 198,
24
+ "sol": 2108,
25
+ "season": "Month 7",
26
+ "min_temp": -65,
27
+ "max_temp": -24,
28
+ "atmo_opacity": "Sunny",
29
+ "sunrise": "05:19",
30
+ "sunset": "17:27",
31
+ "min_gts_temp": -58,
32
+ "max_gts_temp": -15,
33
+ "unitOfMeasure": "Celsius",
34
+ "TZ_Data": "America/Port_of_Spain"
35
+ }
36
+
37
+ resp = "Sol #{data['sol']}, #{data['season']}, A #{data['atmo_opacity']} day with a min temp of #{data['min_temp']} and a high of #{data['max_temp']} #{data['unitOfMeasure']}. Sunrise is at #{data['sunrise']} and sunset occurs at #{data['sunset']}."
38
+ response.reply resp
39
+ end
13
40
  def moon(response)
14
41
  location = get_location(response)
15
42
  moon = get_data(location)
@@ -19,14 +46,14 @@ module Lita
19
46
  set_time = Time.parse moon['moondata']['set']
20
47
 
21
48
  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' => '🌒'
49
+ 'New Moon' => '🌚',
50
+ 'Waxing Crescent' => '🌒',
51
+ 'First Quarter' => '🌓',
52
+ 'Waxing Gibbous' => '🌔',
53
+ 'Full Moon' => '🌕',
54
+ 'Waning Gibbous' => '🌖',
55
+ 'Last Quarter' => '🌗',
56
+ 'Waning Crescent' => '🌘'
30
57
  }
31
58
 
32
59
  reply = "#{emoonjis[moon['moondata']['curphase']]} Moon phase #{moon['moondata']['fracillum']}, #{moon['moondata']['curphase']}. "
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-moonphase'
3
- spec.version = '2.0.1'
3
+ spec.version = '2.1.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
- spec.description = %q{Lita interface to a lambda representing Moon phase data.}
6
+ spec.description = %q{Lita interface to a lambda representing Moon phase data. With a dash of Mars.}
7
7
  spec.summary = spec.description
8
8
  spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-moonphase'
9
9
  spec.license = 'MIT'
@@ -0,0 +1,15 @@
1
+ {
2
+ "status": 200,
3
+ "id": 198,
4
+ "sol": 2108,
5
+ "season": "Month 7",
6
+ "min_temp": -65,
7
+ "max_temp": -24,
8
+ "atmo_opacity": "Sunny",
9
+ "sunrise": "05:19",
10
+ "sunset": "17:27",
11
+ "min_gts_temp": -58,
12
+ "max_gts_temp": -15,
13
+ "unitOfMeasure": "Celsius",
14
+ "TZ_Data": "America/Port_of_Spain"
15
+ }
@@ -44,4 +44,10 @@ describe Lita::Handlers::OnewheelMoonphase, lita_handler: true do
44
44
  send_command 'moon'
45
45
  expect(replies.last).to eq('🌔 Moon phase 75%, Waxing Gibbous. Rise: 11:45 Set: 22:16')
46
46
  end
47
+
48
+ it 'marses' do
49
+ load_mock('mars')
50
+ send_command 'mars'
51
+ expect(replies.last).to eq("Sol 2108, Month 7, A Sunny day with a min temp of -65 and a high of -24 Celsius. Sunrise is at 05:19 and sunset occurs at 17:27.")
52
+ end
47
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-moonphase
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-27 00:00:00.000000000 Z
11
+ date: 2018-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -122,7 +122,8 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.8'
125
- description: Lita interface to a lambda representing Moon phase data.
125
+ description: Lita interface to a lambda representing Moon phase data. With a dash
126
+ of Mars.
126
127
  email:
127
128
  - andrew.kreps@gmail.com
128
129
  executables: []
@@ -138,6 +139,7 @@ files:
138
139
  - lib/lita-onewheel-moonphase.rb
139
140
  - lib/lita/handlers/onewheel_moonphase.rb
140
141
  - lita-onewheel-moonphase.gemspec
142
+ - spec/fixtures/mars.json
141
143
  - spec/fixtures/moon_first_quarter.json
142
144
  - spec/fixtures/moon_last_quarter.json
143
145
  - spec/fixtures/moon_waning_crescent.json
@@ -170,8 +172,10 @@ rubyforge_project:
170
172
  rubygems_version: 2.5.2
171
173
  signing_key:
172
174
  specification_version: 4
173
- summary: Lita interface to a lambda representing Moon phase data.
175
+ summary: Lita interface to a lambda representing Moon phase data. With a dash of
176
+ Mars.
174
177
  test_files:
178
+ - spec/fixtures/mars.json
175
179
  - spec/fixtures/moon_first_quarter.json
176
180
  - spec/fixtures/moon_last_quarter.json
177
181
  - spec/fixtures/moon_waning_crescent.json