another_place 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33d7a08f178934e67564358c73465c03cf3a7a32
4
- data.tar.gz: 17cbd6120a26acab1bb195cc2ad24fe3573dc408
3
+ metadata.gz: b152327f8bc761ea5f613590ac01821aa603a20d
4
+ data.tar.gz: 199e449dbec48741e8c25e148397a204e4abb4b9
5
5
  SHA512:
6
- metadata.gz: 3e1e4f6ba258df8d48c407f1c5719da9e9b1bb9e39fefeaf4ffb816619dd49feade0965ec7dedc45e5eceefd9b574ccfce98bba8b08ee4dab505997126564b2e
7
- data.tar.gz: 8664103e6323bc0d12624e0d41be0de1b24c2e50c1c7155a94e6fd89653bacb36da4157e34761e48148cc0c9890fc1289459aa6a2a89b2c94a9bf31924c52ed6
6
+ metadata.gz: f64920fa397303b78b8310b5cf5985de1a1d4e67c853ae864551a83df569573c123fcf7cb9c8e7bc1b2f61a368d93051e33f67e71d99837e5ec17ab100770d63
7
+ data.tar.gz: 34a7b16e314b4500cf6a997d653d4dfb736e39bbd5201c1e515dd86f860b247764d6a282b2431d37432fc2fc6c7618fcd212e7c651d682dc6448bf10a57fec3a
@@ -1,14 +1,144 @@
1
1
  require 'sinatra'
2
+ require 'json'
3
+
4
+ require_relative 'clues'
2
5
 
3
6
  class AnotherPlace < Sinatra::Base
4
7
 
8
+ before do
9
+ headers({"Content-Type" => "application/json"})
10
+ end
11
+
5
12
  get '/' do
6
- "hello!"
13
+ status 200
14
+ headers({"X-Hey-You" => "GET /pies"})
15
+ body("psst. **Check the headers**")
16
+ end
17
+
18
+ get '/pies' do
19
+ headers({
20
+ "X-Clue" => "last character in every value in the hash"
21
+ })
22
+ body({
23
+ sushi: "tuna",
24
+ spice_level: "XX",
25
+ test: "IQ",
26
+ insect: "bug",
27
+ missing: "vitamin: d",
28
+ nosebleeds: "2",
29
+ nickname: "BIFF",
30
+ trailer: "zardoz"
31
+ }.to_json)
32
+ end
33
+
34
+ get("/aXQgd2Fz") do
35
+ redirect(to("/coffee"))
36
+ end
37
+
38
+ get("/coffee") do
39
+ headers({"X-Hey-you" => "Come back here and ask for your coffee black"})
40
+ if params[:black] || params[:type]
41
+ headers({"X-Clue" => "first character of every key in every hash in the array"})
42
+ body([
43
+ {"cardians" => "nina", "Gwar" => "dave"},
44
+ {"ozma" => "ryen"},
45
+ {"=w=" => "rivers"}
46
+ ].to_json)
47
+ end
48
+ end
49
+
50
+ get("/cGo=") do
51
+ redirect(to("/ladies"))
52
+ end
53
+
54
+ get("/ladies") do
55
+ headers({"X-Hey-you" => "If I had a type I'd say it's log ladies"})
56
+ if params[:type] == "log ladies"
57
+ headers({
58
+ "X-Clue" => "all the odd elements in an array, reversed"
59
+ })
60
+ body([ "l", 119, "h", "MU", "G", "AT", "d", 145, "g", "ID", "4", "HQ", "W", "YY", "a", 404 ].to_json)
61
+ end
62
+ end
63
+
64
+ get("/aW4gdGhl") do
65
+ redirect to("/meditations")
66
+ end
67
+
68
+ get("/meditations") do
69
+ headers({"X-Hey-You" => "Your eyes should be shut"})
70
+ if params[:eyes] == "shut"
71
+ headers({
72
+ "X-Clue" => "all integers to `chr` and all the strings to `ord`"
73
+ })
74
+ body([99, 109, "\t", 118, 100, 67, 66, 107, 97, 88, 74, 108, 89, "\x03", 82, 118, 99, 110, 107, 61].to_json)
75
+ end
76
+ end
77
+
78
+ get("/cm9vdCBkaXJlY3Rvcnk=") do
79
+ redirect to("/owls")
80
+ end
81
+
82
+ get("/owls") do
83
+ "PUT to the 7th owl, eyes are true"
84
+ end
85
+
86
+ put("/owls/:id") do
87
+ if params[:eyes] && params[:id].to_i == 7
88
+ headers({
89
+ "X-Clue" => "minus, plus, minus, plus etc..."
90
+ })
91
+ body(["c", 3, "k", 1, "`", "D", "A", 1, "`", "H", "T", ">"].to_json)
92
+ end
93
+ end
94
+
95
+ get("/d2l0aCB0aGU=") do
96
+ redirect to("/diners")
97
+ end
98
+
99
+ get("/diners") do
100
+ headers({"X-Clue" => "post to the double r diner"})
101
+ body([
102
+ {:id => 1, name: "zest diner"},
103
+ {:id => 2, name: "club pasim"},
104
+ {:id => 3, name: "hello diner"},
105
+ {:id => 4, name: "double rr diner"},
106
+ {:id => 5, name: "rich's restaurant"},
107
+ {:id => 6, name: "rr diner"},
108
+ ].to_json)
7
109
  end
8
110
 
111
+ post("/diners/:id") do
112
+ if params[:id].to_i == 4
113
+ body("try another double r diner")
114
+ elsif params[:id].to_i == 6
115
+ redirect to("/cm0gLXJm")
116
+ end
117
+ end
118
+
119
+ get("/cm0gLXJm") do
120
+ body("POST to /gums\nnews=good&in_style=true")
121
+ end
122
+
123
+ post("/gums") do
124
+ if params[:gums] == "news" && params[:in_style]
125
+ redirect to("/another_place")
126
+ end
127
+ end
128
+
129
+ get("/another_place") do
130
+ headers({
131
+ "X-Hey-You" => "http://ruby-doc.org/stdlib-2.1.2/libdoc/base64/rdoc/Base64.html"
132
+ })
133
+ body("cm0gLXJm")
134
+ end
135
+
136
+ get("/hints") do
137
+ HINTS.sample
138
+ end
9
139
  end
10
140
 
11
141
  # Run the app!
12
142
  #
13
- puts "Hello, you're running your web app from a gem!"
143
+ puts "Starting a server in another place."
14
144
  AnotherPlace.run!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: another_place
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - phlco
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: data from another place
14
- email: philco@ga.co
14
+ email: phillip.lamplugh@gmail.com
15
15
  executables:
16
16
  - another_place
17
17
  extensions: []
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.2.2
42
+ rubygems_version: 2.4.1
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: another place