wapi 1.0.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.
@@ -0,0 +1,11 @@
1
+ describe Wapi::ConditionParser::Date do
2
+ before :all do
3
+ url = File.dirname(__FILE__) + "/Waves.html"
4
+ @api = Wapi::Report.new("", url)
5
+ @date = Wapi::ConditionParser::Date.extract(@api.html)
6
+ end
7
+
8
+ it 'should parse last updated date' do
9
+ expect(@date).to eql 'Segunda-feira, 15 de Setembro de 2014 07:43'
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ describe Wapi::ConditionParser::Name do
2
+ context 'when html is valid' do
3
+ before :all do
4
+ url = File.dirname(__FILE__) + "/Waves.html"
5
+ @api = Wapi::Report.new("", url)
6
+ end
7
+
8
+ it 'should extract the name of the beach' do
9
+ name = Wapi::ConditionParser::Name.extract(@api.html)
10
+ expect(name).to eql 'Praia do Vizinho - Fortaleza (CE)'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ describe Wapi::ConditionParser::Photos do
2
+ context 'when html is valid' do
3
+ before :all do
4
+ url = File.dirname(__FILE__) + "/Waves.html"
5
+ @api = Wapi::Report.new("", url)
6
+ end
7
+
8
+ it 'should extract 2 photos for beach' do
9
+ photos = Wapi::ConditionParser::Photos.extract(@api.html)
10
+
11
+ expect(photos.length).to be 2
12
+ expect(photos[0]).to eql 'http://waves.terra.com.br/wavescheck/580621_1_693x520.jpg'
13
+ expect(photos[1]).to eql 'http://waves.terra.com.br/wavescheck/580621_2_693x520.jpg'
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ describe Wapi::ConditionParser::Waves do
2
+ context 'when html is valid' do
3
+ before :all do
4
+ url = File.dirname(__FILE__) + "/Waves.html"
5
+ @api = Wapi::Report.new("", url)
6
+ @waves = Wapi::ConditionParser::Waves.extract(@api.html)
7
+ end
8
+
9
+ it 'should parse wave size' do
10
+ expect(@waves[:size]).to eql '0.5 m'
11
+ end
12
+
13
+ it 'should parse wave quality' do
14
+ expect(@waves[:quality]).to eq 'Mexida (Ruim)'
15
+ end
16
+
17
+ it 'should parse wave direction' do
18
+ expect(@waves[:direction]).to eq 'Leste'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ describe Wapi::ConditionParser::Wind do
2
+ context 'when html is valid' do
3
+ before :all do
4
+ url = File.dirname(__FILE__) + "/Waves.html"
5
+ @api = Wapi::Report.new("", url)
6
+ @wind = Wapi::ConditionParser::Wind.extract(@api.html)
7
+ end
8
+
9
+ it 'should parse wind strength' do
10
+ expect(@wind[:strength]).to eql 'Moderado'
11
+ end
12
+
13
+ it 'should parse wind direction' do
14
+ expect(@wind[:direction]).to eql 'Leste'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,100 @@
1
+ require "codeclimate-test-reporter"
2
+ require 'simplecov'
3
+ require './lib/wapi'
4
+
5
+ SimpleCov.start do
6
+ formatter SimpleCov::Formatter::MultiFormatter[
7
+ SimpleCov::Formatter::HTMLFormatter,
8
+ CodeClimate::TestReporter::Formatter
9
+ ]
10
+ end
11
+
12
+ # This file was generated by the `rspec --init` command. Conventionally, all
13
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
14
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
15
+ # file to always be loaded, without a need to explicitly require it in any files.
16
+ #
17
+ # Given that it is always loaded, you are encouraged to keep this file as
18
+ # light-weight as possible. Requiring heavyweight dependencies from this file
19
+ # will add to the boot time of your test suite on EVERY test run, even for an
20
+ # individual file that may not need all of that loaded. Instead, consider making
21
+ # a separate helper file that requires the additional dependencies and performs
22
+ # the additional setup, and require it from the spec files that actually need it.
23
+ #
24
+ # The `.rspec` file also contains a few flags that are not defaults but that
25
+ # users commonly want.
26
+ #
27
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
28
+ RSpec.configure do |config|
29
+ # rspec-expectations config goes here. You can use an alternate
30
+ # assertion/expectation library such as wrong or the stdlib/minitest
31
+ # assertions if you prefer.
32
+ config.expect_with :rspec do |expectations|
33
+ # This option will default to `true` in RSpec 4. It makes the `description`
34
+ # and `failure_message` of custom matchers include text for helper methods
35
+ # defined using `chain`, e.g.:
36
+ # be_bigger_than(2).and_smaller_than(4).description
37
+ # # => "be bigger than 2 and smaller than 4"
38
+ # ...rather than:
39
+ # # => "be bigger than 2"
40
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
41
+ end
42
+
43
+ # rspec-mocks config goes here. You can use an alternate test double
44
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
45
+ config.mock_with :rspec do |mocks|
46
+ # Prevents you from mocking or stubbing a method that does not exist on
47
+ # a real object. This is generally recommended, and will default to
48
+ # `true` in RSpec 4.
49
+ mocks.verify_partial_doubles = true
50
+ end
51
+
52
+ # The settings below are suggested to provide a good initial experience
53
+ # with RSpec, but feel free to customize to your heart's content.
54
+ =begin
55
+ # These two settings work together to allow you to limit a spec run
56
+ # to individual examples or groups you care about by tagging them with
57
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
58
+ # get run.
59
+ config.filter_run :focus
60
+ config.run_all_when_everything_filtered = true
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
63
+ # For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = 'doc'
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Felipe Benevides
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
69
+ description: Extracting Waves information easily.
70
+ email:
71
+ - felipe.benevidesv@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Rakefile
77
+ - lib/wapi.rb
78
+ - lib/wapi/parser.rb
79
+ - lib/wapi/parsers/date.rb
80
+ - lib/wapi/parsers/info.rb
81
+ - lib/wapi/parsers/name.rb
82
+ - lib/wapi/parsers/photos.rb
83
+ - lib/wapi/parsers/waves.rb
84
+ - lib/wapi/parsers/wind.rb
85
+ - lib/wapi/version.rb
86
+ - spec/lib/parser_spec.rb
87
+ - spec/lib/parsers/Waves.html
88
+ - spec/lib/parsers/date_spec.rb
89
+ - spec/lib/parsers/name_spec.rb
90
+ - spec/lib/parsers/photos_spec.rb
91
+ - spec/lib/parsers/waves_spec.rb
92
+ - spec/lib/parsers/wind_spec.rb
93
+ - spec/spec_helper.rb
94
+ homepage: http://fbenevides.github.io
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.1.1
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.2.2
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Waves API
118
+ test_files:
119
+ - spec/spec_helper.rb
120
+ - spec/lib/parser_spec.rb
121
+ - spec/lib/parsers/Waves.html
122
+ - spec/lib/parsers/date_spec.rb
123
+ - spec/lib/parsers/photos_spec.rb
124
+ - spec/lib/parsers/wind_spec.rb
125
+ - spec/lib/parsers/waves_spec.rb
126
+ - spec/lib/parsers/name_spec.rb