einstein 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --color
2
+ -fs
3
+ -Ilib
4
+ -Ispec
5
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in einstein.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Einstein
2
+
3
+ Push notification service for restaurant [Einstein](http://www.butlercatering.se/einstein.html).
4
+
5
+ Follow me on [Twitter](http://twitter.com/linusoleander) or [Github](https://github.com/oleander/) for more info and updates.
6
+
7
+ ## How to use
8
+
9
+ ### Today's meal
10
+
11
+ ```` ruby
12
+ Einstein.menu_for(:today)
13
+ ````
14
+
15
+ ### Meal for any day
16
+
17
+ ```` ruby
18
+ Einstein.menu_for(:monday)
19
+ ````
20
+
21
+ ### Push to phone
22
+
23
+ *Einstein* has build in support for [Prowl](https://www.prowlapp.com/).
24
+ Pass you [api key](https://www.prowlapp.com/api_settings.php) to the `menu_for` method to push the menu to you iPhone.
25
+
26
+ ```` ruby
27
+ Einstein.menu_for(:monday).push_to("6576aa9fa3fc3e18aca8da9914a166b3")
28
+ ````
29
+
30
+ ## What is being returned?
31
+
32
+ `#menu_for` returns an array of strings containing each dish for the given day.
33
+
34
+ ## What is being push to the phone?
35
+
36
+ ![Example push](http://i.imgur.com/lf8Js.png)
37
+
38
+
39
+ ## Real world example
40
+
41
+ Here is a real world example using [whenever](https://github.com/javan/whenever).
42
+ This example will push *today's menu* directly to your iPhone at 11:45 AM.
43
+
44
+ 1 . Install whenever. `gem install whenever`.
45
+ 2 . Navigate to your application, run `wheneverize .`.
46
+ 3 . Add these lines to your `config/schedule.rb` file.
47
+
48
+ ```` ruby
49
+ require "rubygems"
50
+ require "einstein"
51
+
52
+ every 1.day, :at => "11:45 am" do
53
+ runner 'Einstein.menu_for(:today).push_to("6576aa9fa3fc3e18aca8da9914a166b3")'
54
+ end
55
+ ````
56
+
57
+ 4 . Create the cron task using `whenever`.
58
+ 5 . Done!
59
+
60
+ ## How to install
61
+
62
+ [sudo] gem install einstein
63
+
64
+ ## Requirements
65
+
66
+ *Einstein* is tested in *OS X 10.6.7* using Ruby *1.9.2*.
67
+
68
+ ## License
69
+
70
+ *Einstein* is released under the *MIT license*.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/einstein.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "einstein/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "einstein"
7
+ s.version = Einstein::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Linus Oleander"]
10
+ s.email = ["linus@oleander.nu"]
11
+ s.homepage = "https://github.com/oleander/Einstein"
12
+ s.summary = %q{Push notification service for restaurant Einstein}
13
+ s.description = %q{Push notification service for restaurant Einstein.}
14
+
15
+ s.rubyforge_project = "einstein"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency("rest-client")
23
+ s.add_dependency("nokogiri")
24
+ s.add_dependency("prowl")
25
+ s.add_dependency("titleize")
26
+
27
+ s.add_development_dependency("rspec")
28
+ s.add_development_dependency("webmock")
29
+ s.add_development_dependency("vcr")
30
+
31
+ s.required_ruby_version = ">= 1.9.0"
32
+ end
data/lib/einstein.rb ADDED
@@ -0,0 +1,49 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ require "rest-client"
4
+ require "nokogiri"
5
+ require "prowl"
6
+ require "einstein/container"
7
+ require "titleize"
8
+ require "date"
9
+
10
+ class Einstein
11
+ include EinsteinContainer
12
+
13
+ def self.method_missing(meth, *args, &blk)
14
+ Einstein.new.send(meth, *args, &blk)
15
+ end
16
+
17
+ def menu_for(whenever)
18
+ data = content.css("td.bg_lunchmeny p").to_a[1..-2].map do |p|
19
+ list = p.content.split("\r\n")
20
+ {list[0].gsub(/"|:|\s+/, "") => list[1..-1].map { |item| item.gsub(/• /, "").strip }}
21
+ end.inject({}) { |a, b| a.merge(b) }
22
+
23
+ whenever = days.keys[Date.today.wday] if whenever == :today
24
+ data = data[days[whenever]] || []
25
+
26
+ Container.new(data, whenever)
27
+ end
28
+
29
+ private
30
+ def content
31
+ @_content ||= Nokogiri::HTML(download)
32
+ end
33
+
34
+ def download
35
+ @_download ||= RestClient.get("http://www.butlercatering.se/einstein.html", timeout: 10)
36
+ end
37
+
38
+ def days
39
+ @_days ||= {
40
+ sunday: "Sön",
41
+ monday: "Mån",
42
+ tuesday: "Tis",
43
+ wednesday: "Ons",
44
+ thursday: "Tors",
45
+ friday: "Fre",
46
+ saturday: "Lör"
47
+ }
48
+ end
49
+ end
@@ -0,0 +1,17 @@
1
+ module EinsteinContainer
2
+ class Container < Array
3
+ def initialize(*values, whenever)
4
+ @whenever = whenever
5
+ super(*values)
6
+ end
7
+
8
+ def push_to(api_key)
9
+ Prowl.add({
10
+ apikey: api_key,
11
+ application: "Einstein ",
12
+ event: " #{@whenever.to_s.titleize}'s menu",
13
+ description: self.join(", ")
14
+ }) unless self.empty?
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Einstein
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,73 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require "spec_helper"
3
+
4
+ describe Einstein do
5
+ use_vcr_cassette "index"
6
+
7
+ before(:all) do
8
+ @days = [:monday, :tuesday, :wednesday, :thursday, :friday]
9
+ @api_key = "6576aa9fa3fc3e18aca8da9914a166b3"
10
+ @monday = [
11
+ "Ristad rostbiff med champinjoner, lök och örtsky",
12
+ "Kabanoss med Gött mos, rostad lök och barbecuekräm",
13
+ "Räksallad med tillbehör"
14
+ ]
15
+
16
+ @today = [
17
+ "Stekt panerad torskfilé med räkor, ägg och dillsås",
18
+ "Parmesanbakad fläskytterfilé med ljummen tomatsalsa",
19
+ "Rostbiff med potatissallad"
20
+ ]
21
+ end
22
+
23
+ describe "#meny_for" do
24
+ it "should be able to return menu for monday" do
25
+ Einstein.menu_for(:monday).should include(*@monday)
26
+ @days.each do |day|
27
+ Einstein.menu_for(day).count.should eq(3)
28
+ end
29
+
30
+ a_request(:get, "http://www.butlercatering.se/einstein.html").should have_been_made.times(6)
31
+ end
32
+
33
+ it "should return an empty list for " do
34
+ [:saturday, :sunday].each do |closed|
35
+ Einstein.menu_for(closed).should be_empty
36
+ end
37
+ end
38
+
39
+ it "should not contain bad data" do
40
+ @days.each do |day|
41
+ Einstein.menu_for(day).each do |dish|
42
+ dish.strip.should eq(dish)
43
+ dish.should_not be_empty
44
+ dish.should_not match(/<|>/)
45
+ end
46
+ end
47
+ a_request(:get, "http://www.butlercatering.se/einstein.html").should have_been_made.times(5)
48
+ end
49
+
50
+ it "should be possible to pass 'today'" do
51
+ Einstein.menu_for(:today).should include(*@today)
52
+ a_request(:get, "http://www.butlercatering.se/einstein.html").should have_been_made.once
53
+ end
54
+ end
55
+
56
+ describe "#push_to" do
57
+ it "should be able to push" do
58
+ Prowl.should_receive(:add).with({
59
+ apikey: @api_key,
60
+ application: "Einstein ",
61
+ event: " Monday's menu",
62
+ description: @monday.join(", ")
63
+ })
64
+
65
+ Einstein.menu_for(:monday).push_to(@api_key)
66
+ end
67
+
68
+ it "should not push if #menu_for is empty" do
69
+ Prowl.should_not_receive(:add)
70
+ Einstein.menu_for(:sunday).push_to(@api_key)
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,118 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://www.butlercatering.se:80/einstein.html
6
+ body:
7
+ headers:
8
+ accept:
9
+ - "*/*; q=0.5, application/xml"
10
+ accept-encoding:
11
+ - gzip, deflate
12
+ timeout:
13
+ - "10"
14
+ response: !ruby/struct:VCR::Response
15
+ status: !ruby/struct:VCR::ResponseStatus
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ content-length:
20
+ - "12096"
21
+ content-type:
22
+ - text/html
23
+ last-modified:
24
+ - Mon, 09 May 2011 06:01:01 GMT
25
+ accept-ranges:
26
+ - bytes
27
+ etag:
28
+ - "\"c2121d79eecc1:d7b\""
29
+ server:
30
+ - Microsoft-IIS/6.0
31
+ x-powered-by:
32
+ - ASP.NET
33
+ date:
34
+ - Tue, 10 May 2011 20:03:18 GMT
35
+ body: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n\
36
+ <HTML><!-- InstanceBegin template=\"/Templates/template.dwt\" codeOutsideHTMLIsLocked=\"false\" -->\r\n\
37
+ \r\n\
38
+ <HEAD>\r\n\
39
+ <META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=ISO-8859-1\">\r\n\
40
+ <!-- InstanceBeginEditable name=\"doctitle\" -->\r\n\
41
+ <TITLE>--- Butler Catering - G&ouml;teborg ---</TITLE>\r\n\
42
+ <!-- InstanceEndEditable --> \r\n\
43
+ <META NAME=\"taggar-skapade\" CONTENT=\"2004-01-21 12:04:23\">\r\n\
44
+ <META NAME=\"keywords\" CONTENT=\"catering g\xF6teborg,festarrang\xF6r g\xF6teborg,temakv\xE4llar g\xF6teborg,br\xF6llop g\xF6teborg,firmafester g\xF6teborg,catering,br\xF6llop,mat,resturang\">\r\n\
45
+ <META NAME=\"description\" CONTENT=\"Butler Catering - Se v\xE5ra catering menyer. Vi arrangerar bl.a. temakv\xE4llar, br\xF6llop och firmafester. Butler catering, din festarrang\xF6r i G\xF6teborg.\">\r\n\
46
+ <META NAME=\"expires\" CONTENT=\"never\">\r\n\
47
+ <META NAME=\"language\" CONTENT=\"SE\">\r\n\
48
+ <META NAME=\"revisit-after\" CONTENT=\"14 days\">\r\n\
49
+ <META NAME=\"distribution\" CONTENT=\"global\">\r\n\
50
+ <META NAME=\"robots\" CONTENT=\"index,follow\">\r\n\
51
+ <META NAME=\"copyright\" CONTENT=\"Copyright \xA92006- Lejhon Disajn www.lejhondisajn.se\">\r\n\
52
+ \r\n\
53
+ <SCRIPT language=JavaScript type=text/JavaScript>\r\n\
54
+ <!--\r\n\
55
+ \r\n\
56
+ function MM_reloadPage(init) { //reloads the window if Nav4 resized\r\n if (init==true) with (navigator) {if ((appName==\"Netscape\")&&(parseInt(appVersion)==4)) {\r\n document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}\r\n else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();\r\n\
57
+ }\r\n\
58
+ MM_reloadPage(true);\r\n\
59
+ //-->\r\n\
60
+ </SCRIPT>\r\n\
61
+ <META content=\"MSHTML 6.00.2600.0\" name=GENERATOR>\r\n\
62
+ <link href=\"text.css\" rel=\"stylesheet\" type=\"text/css\">\r\n\
63
+ \r\n\
64
+ <!-- InstanceBeginEditable name=\"head\" --><!-- InstanceEndEditable -->\r\n\
65
+ </HEAD>\r\n\
66
+ <BODY>\r\n\
67
+ <table width=\"1000\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" id=\"topimg\">\r\n <tr> \r\n <td height=\"83\" colspan=\"4\" class=\"loggatop\"></td>\r\n <td height=\"83\" ></td>\r\n </tr>\r\n <tr> \r\n <td width=\"14\" height=\"19\"><img src=\"img/menu_left.gif\" width=\"14\" height=\"21\"></td>\r\n <td width=\"570\" class=\"menurepeater-top\"> <p> <a href=\"index.html\" target=\"_parent\" class=\"greyunderline\" >Hem \r\n </a>|<a href=\"omoss.html\" target=\"_parent\" class=\"greyunderline\" >Om \r\n Oss</a> | <a href=\"forslag.html\" target=\"_parent\" class=\"greyunderline\"> \r\n Catering </a>| <a href=\"einstein.html\" target=\"_parent\" class=\"greyunderline\">Lunchmeny \r\n </a>| <a href=\"event.html\" target=\"_parent\" class=\"greyunderline\" >Event \r\n </a>| <a href=\"porslinsuthyrning.html\" target=\"_parent\" class=\"greyunderline\">Porslinsuthyrning \r\n </a>| <a href=\"lokaler.html\" target=\"_parent\" class=\"greyunderline\"> \r\n Lokaler </a> | <a href=\"tillbehor.html\" target=\"_parent\" class=\"greyunderline\">Tillbeh&ouml;r</a> \r\n | <a href=\"kontakt.html\" target=\"_parent\" class=\"greyunderline\"> Kontakt \r\n </a>|</p></td>\r\n <td width=\"35\"> <img src=\"img/menu_right.gif\" width=\"9\" height=\"21\"> </td>\r\n <td width=\"209\"><p align=\"right\" class=\"p9\"><a href=\"finstilt.html\" target=\"_parent\" class=\"linkvit\">Finstilt</a> \r\n - <a href=\"samarbetspartners.html\" target=\"_parent\" class=\"linkvit\">Samarbetspartners</a> \r\n - <a href=\"bilder.html\" target=\"_parent\" class=\"linkvit\">Bilder</a></p></td>\r\n <td width=\"172\"><div align=\"right\"></div></td>\r\n </tr>\r\n\
68
+ </table>\r\n\
69
+ <table width=\"1000\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr> \r\n <td width=\"829\" valign=\"top\"> \r\n <div id=\"vitcontainer\"> \r\n <div class=\"roundtopvit\"> \r\n <div class=\"r1vit\"></div>\r\n <div class=\"r2vit\"></div>\r\n <div class=\"r3vit\"></div>\r\n <div class=\"r4vit\"></div>\r\n </div>\r\n <div class=\"contentvit\"> \r\n <table width=\"808\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"10\">\r\n <tr> <!-- InstanceBeginEditable name=\"rubrik\" --> \r\n <td width=\"708\" valign=\"top\" class=\"rub-sidor\"> \r\n <p><strong>LUNCHMENY RESTAURANG EINSTEIN&nbsp;</strong></p></td>\r\n <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name=\"utskrift\" --> \r\n <td width=\"56\" valign=\"top\"><div align=\"left\"><a href=\"Einstein_utskrift.dot\" target=\"_blank\"><img src=\"img/print.gif\" alt=\"Skriv ut sidan\" width=\"28\" height=\"20\" border=\"0\"></a></div></td>\r\n <!-- InstanceEndEditable --></tr>\r\n <tr> \r\n <!-- SLUT navigationsmeny -->\r\n <!-- InstanceBeginEditable name=\"inneholl\" -->\r\n <td colspan=\"2\" valign=\"top\"> <table width=\"755\" height=\"599\" border=\"0\" cellspacing=\"3\">\r\n <tr valign=\"top\"> \r\n <td colspan=\"2\"><h1 align=\"center\" class=\"h1_einstein\">RESTAURANG \r\n EINSTEIN</h1>\r\n <h5 align=\"center\" class=\"h1_einstein\">Meny V 19</h5></td>\r\n </tr>\r\n <tr valign=\"top\"> \r\n <td width=\"396\" class=\"bg_666\"><h5 align=\"center\" class=\"h5_einstein\">VECKANS \r\n MENY</h5></td>\r\n <td width=\"346\" class=\"bg_666\"><h5 align=\"center\" class=\"h5_einstein\">VECKANS \r\n &quot;EXTRA&quot; R&Auml;TTER</h5></td>\r\n </tr>\r\n <tr valign=\"top\">\r\n <td width=\"396\" height=\"477\" class=\"bg_lunchmeny\"> \r\n <p><strong>Dagens r&auml;tt 70 kr</strong></p>\r\n <p>M&aring;n: <br>\r\n &bull; Ristad rostbiff med champinjoner, l&ouml;k och &ouml;rtsky<br>\r\n &bull; Kabanoss med G&ouml;tt mos, rostad l&ouml;k och barbecuekr&auml;m<br>\r\n &bull; R&auml;ksallad med tillbeh&ouml;r</p>\r\n <p>Tis: <br>\r\n &bull; Stekt panerad torskfil&eacute; med r&auml;kor, &auml;gg och dills&aring;s<br>\r\n &bull; Parmesanbakad fl&auml;skytterfil&eacute; med ljummen tomatsalsa <br>\r\n &bull; Rostbiff med potatissallad</p>\r\n <p>Ons:<br>\r\n &bull; Dagens f&aring;ngst<br>\r\n &bull; Stekt kycklingfil&eacute; med chorons&aring;s och kulpotatis<br>\r\n &bull; Tonfisksallad</p>\r\n <p>Tors:<br>\r\n &bull; V&aring;rmakrill med spenat och vitl&ouml;ks&aring;s samt f&auml;rsk potatis<br>\r\n &bull; Rogan josh (Indisk lammgryta) med basmatiris och raita<br>\r\n &bull; Greksallad</p>\r\n <p>Fre<br>\r\n &bull; &Ouml;lmarinerad halstrad biff med r&aring;stekt potatis &amp; rattatoiulle<br>\r\n &bull; Wokade nudlar med r&auml;kor, koriander, vitl&ouml;k och ingef&auml;ra<br>\r\n &bull; Dagens sallad </p>\r\n <p><a href=\"Einstein_utskrift.dot\" target=\"_blank\" class=\"linkvit\">Skriv \r\n ut meny</a></p>\r\n </td>\r\n <td class=\"bg_extrameny\"> <p align=\"center\"><strong>Veckans \r\n pasta 65 kr</strong><br>\r\n Dagens pasta fr&aring;ga k&ouml;ket (m&aring;n-fre)</p>\r\n <p align=\"center\"> <strong>Veckans vegetariska 65 kr<br>\r\n </strong>Dagens vegetariska fr&aring;ga k&ouml;ket (m&aring;n-fre)</p>\r\n <p align=\"center\"> <strong>Veckans paj 65 kr<br>\r\n </strong>Dagenspaj / vegetariskpaj</p>\r\n <p align=\"center\"> <strong>Veckans aff&auml;rslunch 198kr</strong><br>\r\n Efter &ouml;nskem&aring;l\r\n <br>\r\n <br>\r\n </p>\r\n <p align=\"center\"><a href=\"Einstein_utskrift.dot\" target=\"_blank\" class=\"linkvit\">skriv \r\n ut meny</a></p></td>\r\n </tr>\r\n <tr valign=\"top\"> \r\n <td colspan=\"2\" class=\"bg_666\"><p class=\"txt_fff\">Har ni en \r\n favoritplats i lokalen, &auml;r ett st&ouml;rre s&auml;llskap \r\n eller vill ni boka aff&auml;rslunch g&aring;r det bra \r\n att kontakta oss dagen innan. Senast kl 15.00 p&aring; \r\n tel 031-772 41 70 eller faxa oss p&aring; 031-772 44 70</p></td>\r\n </tr>\r\n </table>\r\n </td>\r\n <!-- InstanceEndEditable --></tr>\r\n </table>\r\n </div>\r\n <div class=\"roundbottomvit\"> \r\n <div class=\"r4vit\"></div>\r\n <div class=\"r3vit\"></div>\r\n <div class=\"r2vit\"></div>\r\n <div class=\"r1vit\"></div>\r\n </div>\r\n </div></td>\r\n <td width=\"171\" valign=\"top\"><div align=\"right\">\r\n <p><img src=\"img/annons.gif\" width=\"170\" height=\"9\"></p>\r\n <p> <a href=\"http://www.cityporslin.se\" target=\"_blank\"><img src=\"img/logo.gif\" width=\"108\" height=\"108\" border=\"0\"></a></p>\r\n <p> <a href=\"http://www.kallsup.se\" target=\"_blank\"><img src=\"img/kallsup.gif\" width=\"151\" height=\"67\" border=\"0\"></a> \r\n </p>\r\n </div></td>\r\n </tr>\r\n\
70
+ </table>\r\n\
71
+ <table width=\"1000\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"825\"><table width=\"832\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr> \r\n <td colspan=\"7\">&nbsp;</td>\r\n </tr>\r\n <tr> \r\n <td width=\"11\"><img src=\"img/edge_tl.gif\" width=\"11\" height=\"24\"></td>\r\n <td class=\"bg_fff\"colspan=\"5\"><div align=\"center\"> \r\n <p>Butler Catering | Chalmers Teknikpark | Sven Hultinsg. 9 | 412 \r\n 88 G&ouml;teborg| tel: 031-772 41 70</p>\r\n </div></td>\r\n <td width=\"11\"><img src=\"img/edge_tr.gif\" width=\"11\" height=\"24\"></td>\r\n </tr>\r\n <tr> \r\n <td><img src=\"img/edge_bl.gif\" width=\"11\" height=\"24\"></td>\r\n <td class=\"bg_fff\"width=\"207\">&nbsp;</td>\r\n <td width=\"16\"><img src=\"img/adresrad_left.gif\" width=\"16\" height=\"24\"></td>\r\n <td width=\"361\"><p align=\"center\">Copyright &copy; Butler Catering 2006 \r\n - Alla r&auml;ttigheter f&ouml;rbeh&aring;llna. </p></td>\r\n <td width=\"16\"><img src=\"img/adresrad_right.gif\" width=\"16\" height=\"24\"></td>\r\n <td class=\"bg_fff\" width=\"210\"> <div align=\"right\"> \r\n <script language=\"JavaScript\"><!--\r\n\
72
+ var TheFontFace = \"Verdana\";\r\n\
73
+ var TheFontColor = \"#666666\";\r\n\
74
+ var TheFontSize = \"1\";\r\n\
75
+ var TheFontStyle = \"italic\"; \r\n\
76
+ \r\n\
77
+ // Sett separator mellan datum elementen;\r\n\
78
+ var TheSeparator = \"-\";\r\n\
79
+ \r\n\
80
+ var ShowDay =\"yes\";\r\n\
81
+ \r\n\
82
+ var Days = new Array(\"S&ouml;ndag\",\"M&aring;ndag\",\"Tisdag\",\"Onsdag\",\"Torsdag\",\"Fredag\",\"L&ouml;rdag\");\r\n\
83
+ var TheDate = new Date();\r\n\
84
+ \r\n\
85
+ var TheWeekDay = TheDate.getDay();\r\n\
86
+ var Day =\"\";\r\n\
87
+ if (ShowDay == \"yes\"){\r\n Day = Days[TheWeekDay];\r\n Day += \" \";}\r\n\
88
+ \r\n\
89
+ var TheMonth = TheDate.getMonth() + 1;\r\n\
90
+ if (TheMonth < 10) TheMonth = \"0\" + TheMonth;\r\n\
91
+ \r\n\
92
+ var TheMonthDay = TheDate.getDate();\r\n\
93
+ if (TheMonthDay < 10) TheMonthDay = \"0\" + TheMonthDay;\r\n\
94
+ \r\n\
95
+ var TheYear = TheDate.getYear();\r\n\
96
+ if (TheYear < 1000) TheYear += 1900;\r\n\
97
+ \r\n\
98
+ var FontTagLeft = \"\";\r\n\
99
+ var FontTagRight = \"\";\r\n\
100
+ \r\n\
101
+ if (TheFontStyle == \"bold\"){\r\n FontTagLeft = \"<b>\";\r\n FontTagRight =\"</b>\";}\r\n \r\n\
102
+ if (TheFontStyle == \"italic\"){\r\n FontTagLeft = \"<i>\";\r\n FontTagRight =\"</i>\";}\r\n \r\n\
103
+ if (TheFontStyle == \"bolditalic\"){\r\n FontTagLeft = \"<b><i>\"; \r\n FontTagRight = \"</i></b>\";} \r\n\
104
+ \r\n\
105
+ var D = \"\";\r\n\
106
+ D += \"<font color='\"+TheFontColor+\"' face='\"+TheFontFace+\"' size='\"+TheFontSize+\"'>\";\r\n\
107
+ D += FontTagLeft+Day+TheMonth+TheSeparator+TheMonthDay+TheSeparator+TheYear+FontTagRight;\r\n\
108
+ D += \"</font>\";\r\n\
109
+ \r\n\
110
+ document.write(D);\r\n\
111
+ \r\n\
112
+ //-->\r\n\
113
+ </script>\r\n </div></td>\r\n <td><img src=\"img/edge_br.gif\" width=\"11\" height=\"24\"></td>\r\n </tr>\r\n </table></td>\r\n <td width=\"171\">&nbsp;</td>\r\n </tr>\r\n\
114
+ </table>\r\n\
115
+ </body>\r\n\
116
+ \r\n\
117
+ <!-- InstanceEnd --></html>"
118
+ http_version: "1.1"
@@ -0,0 +1,18 @@
1
+ require "rspec"
2
+ require "webmock/rspec"
3
+ require "einstein"
4
+ require "vcr"
5
+
6
+ RSpec.configure do |config|
7
+ config.mock_with :rspec
8
+ config.extend VCR::RSpec::Macros
9
+ end
10
+
11
+ VCR.config do |c|
12
+ c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
13
+ c.stub_with :webmock
14
+ c.default_cassette_options = {
15
+ record: :none
16
+ }
17
+ c.allow_http_connections_when_no_cassette = false
18
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: einstein
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Linus Oleander
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-10 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rest-client
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: prowl
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: titleize
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :runtime
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rspec
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ type: :development
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: webmock
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: vcr
84
+ prerelease: false
85
+ requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id007
93
+ description: Push notification service for restaurant Einstein.
94
+ email:
95
+ - linus@oleander.nu
96
+ executables: []
97
+
98
+ extensions: []
99
+
100
+ extra_rdoc_files: []
101
+
102
+ files:
103
+ - .gitignore
104
+ - .rspec
105
+ - Gemfile
106
+ - README.md
107
+ - Rakefile
108
+ - einstein.gemspec
109
+ - lib/einstein.rb
110
+ - lib/einstein/container.rb
111
+ - lib/einstein/version.rb
112
+ - spec/einstein_spec.rb
113
+ - spec/fixtures/vcr_cassettes/index.yml
114
+ - spec/spec_helper.rb
115
+ has_rdoc: true
116
+ homepage: https://github.com/oleander/Einstein
117
+ licenses: []
118
+
119
+ post_install_message:
120
+ rdoc_options: []
121
+
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 1.9.0
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
136
+ requirements: []
137
+
138
+ rubyforge_project: einstein
139
+ rubygems_version: 1.6.2
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: Push notification service for restaurant Einstein
143
+ test_files:
144
+ - spec/einstein_spec.rb
145
+ - spec/fixtures/vcr_cassettes/index.yml
146
+ - spec/spec_helper.rb