anmsm_ruby 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .ruby-gemset
6
+ .ruby-version
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ .coveralls.yml
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in anmsm-ruby.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'coveralls', require: false
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 thibaultdalban
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Anmsm::Ruby [![Build Status](https://travis-ci.org/alpinelab/anmsm_ruby.png)](https://travis-ci.org/alpinelab/anmsm_ruby)
2
+
3
+ The anmsm-ruby Gem gives you access to ANMSM API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'anmsm-ruby'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install anmsm-ruby
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'anmsm_ruby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "anmsm_ruby"
8
+ spec.version = AnmsmRuby::VERSION
9
+ spec.authors = ["Thibault Dalban", "Michael Baudino", "Lucas Biguet-Mermet"]
10
+ spec.email = ["thibault@alpine-lab.com", "michael@alpine-lab.com", "lucas@alpine-lab.com"]
11
+ spec.description = "The anmsm-ruby Gem gives you access to ANMSM API."
12
+ spec.summary = "Acces the ANMSM API."
13
+ spec.homepage = "https://github.com/alpinelab/anmsm-ruby"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "ruby_odata", "~> 0.1.4"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ end
@@ -0,0 +1,3 @@
1
+ module AnmsmRuby
2
+ VERSION = "0.0.3"
3
+ end
data/lib/anmsm_ruby.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'anmsm_ruby/version'
2
+ require 'ruby_odata'
3
+
4
+ module AnmsmRuby
5
+ class Base
6
+ attr_accessor :resort_svc
7
+ def initialize
8
+ # Resort feed
9
+ @resort_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/817bee9d-faf4-4680-9d05-e41c2c90ae5a", {:namespace => "Anmsm::Resort"}
10
+ # Weather feed
11
+ @weather_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/fc13de9f-fa6c-45bf-9f25-1f023a3e6db5", {:namespace => "Anmsm::Weather"}
12
+ # Snow feed
13
+ @snow_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/ce4e4296-6132-4e11-b8db-ea21b92e736c", {:namespace => "Anmsm::Snow"}
14
+ end
15
+
16
+ #returns general info for all resorts
17
+ def all_resorts
18
+ @resort_svc.Objects.order_by("NOMSTATION")
19
+ @resort_svc.execute
20
+ end
21
+
22
+ #returns general info for the given resorts
23
+ def info_for_resort(resort_name)
24
+ @resort_svc.Objects.filter("NOMSTATION eq '#{resort_name}'")
25
+ @resort_svc.execute
26
+ end
27
+
28
+ #returns snow info for the given resort
29
+ def snow_info_for_resort(resort_anmsm_id)
30
+ @snow_svc.Objects.filter("STATION eq '#{resort_anmsm_id}'").order_by("Updated")
31
+ @snow_svc.execute
32
+ end
33
+
34
+ #returns weather info for the given resort
35
+ def weather_for_resort(resort)
36
+ resort_id = resort.SyndicObjectID
37
+ @weather_svc.Objects.filter("STATION eq '#{resort_id}'").order_by("day(Updated)")
38
+ .order_by("month(Updated)")
39
+ .order_by("year(Updated)")
40
+ @weather_svc.execute
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe AnmsmRuby::Base do
4
+
5
+ describe "#initialize" do
6
+ before :all do
7
+ @instance = AnmsmRuby::Base.new
8
+ end
9
+
10
+ it 'should assign @resort_svc' do
11
+ @instance.instance_variable_get(:@resort_svc).should be_an_instance_of OData::Service
12
+ end
13
+
14
+ it 'should assign @weather_svc' do
15
+ @instance.instance_variable_get(:@weather_svc).should be_an_instance_of OData::Service
16
+ end
17
+
18
+ it 'should assign @snow_svc' do
19
+ @instance.instance_variable_get(:@snow_svc).should be_an_instance_of OData::Service
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ require './lib/anmsm_ruby'
4
+
5
+ RSpec.configure do |config|
6
+ # Use color in STDOUT
7
+ config.color_enabled = true
8
+
9
+ # Use color not only in STDOUT but also in pagers and files
10
+ config.tty = true
11
+
12
+ # Use the specified formatter
13
+ config.formatter = :documentation # :progress, :html, :textmate
14
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anmsm_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Thibault Dalban
9
+ - Michael Baudino
10
+ - Lucas Biguet-Mermet
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2013-08-30 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ruby_odata
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.4
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 0.1.4
32
+ - !ruby/object:Gem::Dependency
33
+ name: bundler
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '1.3'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ description: The anmsm-ruby Gem gives you access to ANMSM API.
81
+ email:
82
+ - thibault@alpine-lab.com
83
+ - michael@alpine-lab.com
84
+ - lucas@alpine-lab.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - .gitignore
90
+ - .travis.yml
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - anmsm_ruby.gemspec
96
+ - lib/anmsm_ruby.rb
97
+ - lib/anmsm_ruby/version.rb
98
+ - spec/anmsm_spec.rb
99
+ - spec/spec_helper.rb
100
+ homepage: https://github.com/alpinelab/anmsm-ruby
101
+ licenses:
102
+ - MIT
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 1.8.25
122
+ signing_key:
123
+ specification_version: 3
124
+ summary: Acces the ANMSM API.
125
+ test_files:
126
+ - spec/anmsm_spec.rb
127
+ - spec/spec_helper.rb