concerto_weather 0.2.0 → 0.3.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: acebeaff05cdbf875e90d1929ffa584a6c78ccb4
4
- data.tar.gz: 04eeccba7c5329131cf40af473f310388196b0d8
3
+ metadata.gz: 66dbd86c1fcd551ff92a1019010cc5642e8ef628
4
+ data.tar.gz: d6545a3861743532e2768736799713b469de392e
5
5
  SHA512:
6
- metadata.gz: af8b5789f8f210d1174f485b904145ec4a3004ef1b2485f5329d6a629e0098f7ddf5783c425197805d2eaa5af490b959993d0b7ab3687d90000a9d67f573e1fa
7
- data.tar.gz: 0e0c8a9c6974c8ed2ae4bd1227bc0433bce20d25a9b5d056ed4e9b67acaa8dd7613bf97ea138de2789884bf89a2712e729be0fd9d4d674c18a7e0352f7f41074
6
+ metadata.gz: 5a612c4c53a755b0dc0a058e9ea9d822f8bd026e21c5557b553f21674654a29d9329c576152360bbfc1d05e92639f83b35cb25a9c93b1895f56a419e51e18d02
7
+ data.tar.gz: 68f382ef74de15dff7913521d3cecfc7535bff2729573a53040447b0b93f4d3d72bb2956c5dc6150384fac42bedae481aef63ef905b8b181bebff480d5e78aee
data/README.md CHANGED
@@ -7,7 +7,8 @@ Concerto 2 Weather is licensed under the Apache License, Version 2.0.
7
7
 
8
8
  ## Installation
9
9
  1. Visit the plugin management page in Concerto, select RubyGems as the source and "concerto_weather" as the gem name.
10
- 2. For any issues displaying the custom weather icons, make sure to precompile assets using:
10
+ 2. Visit the settings page (admin category on the nav bar) and enter your [OpenWeatherMap API key](http://openweathermap.org/appid) under the "API Keys" tab.
11
+ 3. For any issues displaying the custom weather icons, make sure to precompile assets using:
11
12
 
12
13
  (for production)
13
14
  ``` RAILS_ENV=production rake assets:precompile```
@@ -10,9 +10,9 @@ class Weather < DynamicContent
10
10
  require 'json'
11
11
  require 'net/http'
12
12
 
13
- # Build request url
13
+ # Build request url
14
14
  params = {
15
- q: self.config['location'],
15
+ id: self.config['city_id'],
16
16
  units: self.config['units'],
17
17
  cnt: 1,
18
18
  mode: 'json',
@@ -24,9 +24,8 @@ class Weather < DynamicContent
24
24
  # Make request to OpenWeatherMapAPI
25
25
  response = Net::HTTP.get_response(URI.parse(url)).body
26
26
  data = JSON.parse(response)
27
-
27
+
28
28
  # Build HTML using API data
29
- #<img src='http://api.openweathermap.org/img/w/#{data['list'][0]['weather'][0]['icon']}' />
30
29
  rawhtml = "
31
30
  <h1> Today in #{data['city']['name']} </h1>
32
31
  <div style='float: left; width: 50%'>
@@ -45,12 +44,13 @@ class Weather < DynamicContent
45
44
  htmltext.name = "Today's weather in #{data['city']['name']}"
46
45
  htmltext.data = rawhtml
47
46
 
47
+ self.config["location_name"] = data["city"]["name"]
48
48
  return [htmltext]
49
49
  end
50
50
 
51
51
  # Weather needs a location. Also allow specification of units
52
52
  def self.form_attributes
53
53
  attributes = super()
54
- attributes.concat([:config => [:location, :units]])
54
+ attributes.concat([:config => [:city_id, :units, :location_name]])
55
55
  end
56
- end
56
+ end
@@ -7,9 +7,9 @@
7
7
  <div class='span4'>
8
8
  <%= form.fields_for :config do |config| %>
9
9
  <div class="clearfix">
10
- <%= config.label :location, "City" %>
10
+ <%= config.label :city_id, "City ID" %>
11
11
  <div class="input">
12
- <%= config.text_field :location, placeholder: "Sydney", value: @content.config['location'] %>
12
+ <%= config.text_field :city_id, placeholder: "1273294", value: @content.config['city_id'] %>
13
13
  </div>
14
14
  </div>
15
15
  <div class="clearfix">
@@ -1,7 +1,7 @@
1
1
  <dl>
2
2
  <h1>Weather</h1>
3
3
  <dt>City</dt>
4
- <dd><%= content.config['location'] %></dd>
4
+ <dd><%= content.config['location_name'] %></dd>
5
5
  <dt>Units</dt>
6
6
  <dd><%= Weather::UNITS[content.config['units']] %></dd>
7
7
  <dt>Last Successful Update</dt>
@@ -1 +1 @@
1
- <h1>Weather for <%= content.config['location'] %></h1>
1
+ <h1>Weather for <%= content.config['location_name'] %></h1>
@@ -1,3 +1,3 @@
1
1
  module ConcertoWeather
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concerto_weather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Michalski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.5
80
+ rubygems_version: 2.5.1
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Weather plugin for Concerto 2.