orb_def 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +79 -0
- data/.gitignore +14 -0
- data/.rakeTasks +7 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +207 -0
- data/MIT-LICENSE +20 -0
- data/README.md +30 -0
- data/Rakefile +23 -0
- data/app/assets/config/orb_def_manifest.js +2 -0
- data/app/assets/javascripts/orb_def/application.js +15 -0
- data/app/assets/stylesheets/orb_def/application.css +15 -0
- data/app/controllers/orb_def/api/v1/fires_controller.rb +64 -0
- data/app/controllers/orb_def/api/v1/weather_readings_controller.rb +16 -0
- data/app/controllers/orb_def/application_controller.rb +5 -0
- data/app/helpers/orb_def/application_helper.rb +4 -0
- data/app/jobs/orb_def/application_job.rb +4 -0
- data/app/mailers/orb_def/application_mailer.rb +6 -0
- data/app/models/orb_def/application_record.rb +5 -0
- data/app/models/orb_def/detection_type.rb +7 -0
- data/app/models/orb_def/fire.rb +60 -0
- data/app/models/orb_def/weather_reading.rb +41 -0
- data/app/models/orb_def/weather_station.rb +33 -0
- data/app/serializers/orb_def/api/v1/fire_serializer.rb +17 -0
- data/app/services/orb_def/fire_weather_data.rb +36 -0
- data/app/services/orb_def/nasa/firms_client.rb +38 -0
- data/app/services/orb_def/nasa/firms_import.rb +44 -0
- data/app/services/orb_def/open_weather_api/weather_by_coordinates.rb +31 -0
- data/app/views/layouts/orb_def/application.html.erb +16 -0
- data/bin/rails +25 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20200422073925_create_orb_def_weather_stations.rb +12 -0
- data/db/migrate/20200422073938_create_orb_def_weather_readings.rb +20 -0
- data/db/migrate/20200423064313_create_orb_def_detection_types.rb +9 -0
- data/db/migrate/20200428063630_create_orb_def_fires.rb +28 -0
- data/db/seeds.rb +8 -0
- data/lib/orb_def/engine.rb +16 -0
- data/lib/orb_def/version.rb +3 -0
- data/lib/orb_def.rb +16 -0
- data/lib/tasks/orb_def_tasks.rake +4 -0
- data/orb_def.gemspec +38 -0
- data/spec/controllers/orb_def/api/v1/fires_controller_spec.rb +16 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +21 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/spec/dummy/config/environments/production.rb +94 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/orb_def.rb +4 -0
- data/spec/dummy/config/initializers/pagy.rb +170 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/orb_def/spring.rb +1 -0
- data/spec/dummy/config/puma.rb +37 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/schema.rb +87 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/detection_type.rb +5 -0
- data/spec/fixtures/files/modis_c6.txt +3 -0
- data/spec/fixtures/nasa/firms/viirs.txt +3 -0
- data/spec/rails_helper.rb +72 -0
- data/spec/services/orbital_defence_engine/nasa/firms_import_spec.rb +27 -0
- data/spec/services/orbital_defence_engine/open_weather_api/weather_by_coordinates_spec.rb +16 -0
- data/spec/spec/vcr/cassettes/OrbitalDefenceEngine_Nasa_FirmsImport/_all/when_request_successful/creates_fires.yml +77 -0
- data/spec/spec/vcr/cassettes/OrbitalDefenceEngine_OpenWeatherApi_WeatherByCoordinates/_fetch_weather_by_coordinates/returns_json_data_as_a_hash.yml +41 -0
- data/spec/spec_helper.rb +96 -0
- data/spec/support/factory_bot.rb +3 -0
- data/spec/support/vcr.rb +9 -0
- data/spec/vcr/cassettes/OpenWeatherApi_WeatherByCoordinates/_fetch_weather_by_coordinates/returns_json_data_as_a_hash.yml +41 -0
- data/spec/vcr/cassettes/OrbDef_Nasa_FirmsImport/_all/when_request_successful/creates_fires.yml +4766 -0
- data/spec/vcr/cassettes/OrbDef_OpenWeatherApi_WeatherByCoordinates/_fetch_weather_by_coordinates/returns_json_data_as_a_hash.yml +41 -0
- metadata +438 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
19
|
+
# assertions if you prefer.
|
20
|
+
config.expect_with :rspec do |expectations|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
23
|
+
# defined using `chain`, e.g.:
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
26
|
+
# ...rather than:
|
27
|
+
# # => "be bigger than 2"
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
29
|
+
end
|
30
|
+
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
33
|
+
config.mock_with :rspec do |mocks|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
35
|
+
# a real object. This is generally recommended, and will default to
|
36
|
+
# `true` in RSpec 4.
|
37
|
+
mocks.verify_partial_doubles = true
|
38
|
+
end
|
39
|
+
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
46
|
+
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
49
|
+
=begin
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
55
|
+
config.filter_run_when_matching :focus
|
56
|
+
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
|
+
# you configure your source control system to ignore this file.
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
61
|
+
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
63
|
+
# recommended. For more details, see:
|
64
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
65
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
66
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
67
|
+
config.disable_monkey_patching!
|
68
|
+
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
71
|
+
# individual spec file.
|
72
|
+
if config.files_to_run.one?
|
73
|
+
# Use the documentation formatter for detailed output,
|
74
|
+
# unless a formatter has already been configured
|
75
|
+
# (e.g. via a command-line flag).
|
76
|
+
config.default_formatter = "doc"
|
77
|
+
end
|
78
|
+
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
80
|
+
# end of the spec run, to help surface which specs are running
|
81
|
+
# particularly slow.
|
82
|
+
config.profile_examples = 10
|
83
|
+
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# the seed, which is printed after each run.
|
87
|
+
# --seed 1234
|
88
|
+
config.order = :random
|
89
|
+
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
93
|
+
# as the one that triggered the failure.
|
94
|
+
Kernel.srand config.seed
|
95
|
+
=end
|
96
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
VCR.configure do |config|
|
4
|
+
config.cassette_library_dir = File.join(File.dirname(__FILE__), '../', 'vcr', 'cassettes')
|
5
|
+
config.hook_into :faraday
|
6
|
+
config.configure_rspec_metadata!
|
7
|
+
config.filter_sensitive_data("<NASA_API_KEY>") { ENV['NASA_API_KEY'] }
|
8
|
+
config.filter_sensitive_data("<OPEN_WEATHER_API_KEY>") { ENV['OPEN_WEATHER_API_KEY'] }
|
9
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.openweathermap.org/data/2.5/weather?appid=<OPEN_WEATHER_API_KEY>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.15.4
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
server:
|
18
|
+
- openresty
|
19
|
+
date:
|
20
|
+
- Tue, 21 Jan 2020 07:56:50 GMT
|
21
|
+
content-type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
content-length:
|
24
|
+
- '439'
|
25
|
+
connection:
|
26
|
+
- close
|
27
|
+
x-cache-key:
|
28
|
+
- "/data/2.5/weather?lat=1&lon=1"
|
29
|
+
access-control-allow-origin:
|
30
|
+
- "*"
|
31
|
+
access-control-allow-credentials:
|
32
|
+
- 'true'
|
33
|
+
access-control-allow-methods:
|
34
|
+
- GET, POST
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"coord":{"lon":1,"lat":1},"weather":[{"id":500,"main":"Rain","description":"light
|
38
|
+
rain","icon":"10d"}],"base":"model","main":{"temp":300.89,"feels_like":304.91,"temp_min":300.89,"temp_max":300.89,"pressure":1013,"humidity":77,"sea_level":1013,"grnd_level":1013},"wind":{"speed":2.01,"deg":160},"rain":{"3h":1.06},"clouds":{"all":99},"dt":1579593410,"sys":{"sunrise":1579586692,"sunset":1579630141},"timezone":0,"id":0,"name":"","cod":200}'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Tue, 21 Jan 2020 07:56:50 GMT
|
41
|
+
recorded_with: VCR 5.0.0
|