lelylan-rb 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ require 'helper'
2
+
3
+ describe 'Lelylan Error' do
4
+
5
+ let(:lelylan) do
6
+ a_client
7
+ end
8
+
9
+ describe 'Unauthorized Access' do
10
+
11
+ before do
12
+ stub_get('/devices/1').to_return(status: 401, body: fixture('errors/401.json'))
13
+ end
14
+
15
+ it 'raises a Lelylan::Unauthorized' do
16
+ expect{ lelylan.device('1') }.to raise_error(Lelylan::Unauthorized, 'Token not valid')
17
+ end
18
+ end
19
+
20
+
21
+ describe 'Not Found' do
22
+
23
+ before do
24
+ stub_get('/devices/1').to_return(status: 404, body: fixture('errors/404.json'))
25
+ end
26
+
27
+ it 'raises a Lelylan::NotFound' do
28
+ expect{ lelylan.device('1') }.to raise_error(Lelylan::NotFound, 'Resource not found')
29
+ end
30
+ end
31
+
32
+
33
+ describe 'Unprocessable Entity' do
34
+
35
+ before do
36
+ stub_get('/devices/1').to_return(status: 422, body: fixture('errors/422.json'))
37
+ end
38
+
39
+ it 'raises a Lelylan::UnprocessableEntity' do
40
+ expect{ lelylan.device('1') }.to raise_error(Lelylan::UnprocessableEntity, 'Name can\'t be blank.')
41
+ end
42
+ end
43
+
44
+
45
+ describe 'Internal Server Error' do
46
+
47
+ before do
48
+ stub_get('/devices/1').to_return(status: 500, body: 'Internal Error Server')
49
+ end
50
+
51
+ it 'raises a Lelylan::InternalServerError' do
52
+ expect{ lelylan.device('1') }.to raise_error(Lelylan::InternalServerError, 'Internal Error Server')
53
+ end
54
+ end
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lelylan-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
16
- requirement: &2151907820 !ruby/object:Gem::Requirement
16
+ requirement: &2164920560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151907820
24
+ version_requirements: *2164920560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth2
27
- requirement: &2151907200 !ruby/object:Gem::Requirement
27
+ requirement: &2164919960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.8'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151907200
35
+ version_requirements: *2164919960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
38
- requirement: &2151906580 !ruby/object:Gem::Requirement
38
+ requirement: &2164919140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.8'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151906580
46
+ version_requirements: *2164919140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday_middleware
49
- requirement: &2151906060 !ruby/object:Gem::Requirement
49
+ requirement: &2164918420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.8'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2151906060
57
+ version_requirements: *2164918420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hashie
60
- requirement: &2151905500 !ruby/object:Gem::Requirement
60
+ requirement: &2164917860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.2'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2151905500
68
+ version_requirements: *2164917860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multi_json
71
- requirement: &2151904800 !ruby/object:Gem::Requirement
71
+ requirement: &2164917360 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.3'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2151904800
79
+ version_requirements: *2164917360
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: json
82
- requirement: &2151904360 !ruby/object:Gem::Requirement
82
+ requirement: &2164916820 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2151904360
90
+ version_requirements: *2164916820
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &2151903840 !ruby/object:Gem::Requirement
93
+ requirement: &2164916180 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2151903840
101
+ version_requirements: *2164916180
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &2151903160 !ruby/object:Gem::Requirement
104
+ requirement: &2164915400 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *2151903160
112
+ version_requirements: *2164915400
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: webmock
115
- requirement: &2151902000 !ruby/object:Gem::Requirement
115
+ requirement: &2164914940 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *2151902000
123
+ version_requirements: *2164914940
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: guard-rspec
126
- requirement: &2151900860 !ruby/object:Gem::Requirement
126
+ requirement: &2164914440 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2151900860
134
+ version_requirements: *2164914440
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: fuubar
137
- requirement: &2151900320 !ruby/object:Gem::Requirement
137
+ requirement: &2164913860 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2151900320
145
+ version_requirements: *2164913860
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: growl
148
- requirement: &2151899680 !ruby/object:Gem::Requirement
148
+ requirement: &2164913220 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2151899680
156
+ version_requirements: *2164913220
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rb-fsevent
159
- requirement: &2151896480 !ruby/object:Gem::Requirement
159
+ requirement: &2164912480 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2151896480
167
+ version_requirements: *2164912480
168
168
  description: Ruby wrapper for Lelylan API
169
169
  email:
170
170
  - touch@lelylan.com
@@ -179,12 +179,6 @@ files:
179
179
  - LICENSE.md
180
180
  - README.md
181
181
  - Rakefile
182
- - images/bg_hr.png
183
- - images/blacktocat.png
184
- - images/icon_download.png
185
- - images/sprite_download.png
186
- - index.html
187
- - javascripts/main.js
188
182
  - lelylan_rb.gemspec
189
183
  - lib/faraday/response/raise_http_error.rb
190
184
  - lib/lelylan.rb
@@ -212,6 +206,9 @@ files:
212
206
  - spec/fixtures/consumptions.json
213
207
  - spec/fixtures/device.json
214
208
  - spec/fixtures/devices.json
209
+ - spec/fixtures/errors/401.json
210
+ - spec/fixtures/errors/404.json
211
+ - spec/fixtures/errors/422.json
215
212
  - spec/fixtures/function.json
216
213
  - spec/fixtures/functions.json
217
214
  - spec/fixtures/histories.json
@@ -242,10 +239,9 @@ files:
242
239
  - spec/lelylan/client/subscription_spec.rb
243
240
  - spec/lelylan/client/type_spec.rb
244
241
  - spec/lelylan/client_spec.rb
242
+ - spec/lelylan/error_spec.rb
245
243
  - spec/lelylan/oauth2_spec.rb
246
244
  - spec/lelylan_spec.rb
247
- - stylesheets/pygment_trac.css
248
- - stylesheets/stylesheet.css
249
245
  homepage: https://github.com/lelylan/lelylan-rb
250
246
  licenses: []
251
247
  post_install_message:
@@ -278,6 +274,9 @@ test_files:
278
274
  - spec/fixtures/consumptions.json
279
275
  - spec/fixtures/device.json
280
276
  - spec/fixtures/devices.json
277
+ - spec/fixtures/errors/401.json
278
+ - spec/fixtures/errors/404.json
279
+ - spec/fixtures/errors/422.json
281
280
  - spec/fixtures/function.json
282
281
  - spec/fixtures/functions.json
283
282
  - spec/fixtures/histories.json
@@ -308,5 +307,6 @@ test_files:
308
307
  - spec/lelylan/client/subscription_spec.rb
309
308
  - spec/lelylan/client/type_spec.rb
310
309
  - spec/lelylan/client_spec.rb
310
+ - spec/lelylan/error_spec.rb
311
311
  - spec/lelylan/oauth2_spec.rb
312
312
  - spec/lelylan_spec.rb
Binary file
Binary file
Binary file
Binary file
data/index.html DELETED
@@ -1,74 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset='utf-8' />
6
- <meta http-equiv="X-UA-Compatible" content="chrome=1" />
7
- <meta name="description" content="Lelylan-rb : Ruby wrapper for Lelylan API" />
8
-
9
- <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
10
-
11
- <title>Lelylan-rb</title>
12
- </head>
13
-
14
- <body>
15
-
16
- <!-- HEADER -->
17
- <div id="header_wrap" class="outer">
18
- <header class="inner">
19
- <a id="forkme_banner" href="https://github.com/lelylan/lelylan-rb">View on GitHub</a>
20
-
21
- <h1 id="project_title">Lelylan-rb</h1>
22
- <h2 id="project_tagline">Ruby wrapper for Lelylan API</h2>
23
-
24
- <section id="downloads">
25
- <a class="zip_download_link" href="https://github.com/lelylan/lelylan-rb/zipball/master">Download this project as a .zip file</a>
26
- <a class="tar_download_link" href="https://github.com/lelylan/lelylan-rb/tarball/master">Download this project as a tar.gz file</a>
27
- </section>
28
- </header>
29
- </div>
30
-
31
- <!-- MAIN CONTENT -->
32
- <div id="main_content_wrap" class="outer">
33
- <section id="main_content" class="inner">
34
- <h3>Welcome to GitHub Pages.</h3>
35
-
36
- <p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:</p>
37
-
38
- <pre><code>$ cd your_repo_root/repo_name
39
- $ git fetch origin
40
- $ git checkout gh-pages
41
- </code></pre>
42
-
43
- <p>If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.</p>
44
-
45
- <h3>Designer Templates</h3>
46
-
47
- <p>We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.</p>
48
-
49
- <h3>Rather Drive Stick?</h3>
50
-
51
- <p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
52
-
53
- <h3>Authors and Contributors</h3>
54
-
55
- <p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code>&lt;a&gt;</code> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
56
-
57
- <h3>Support or Contact</h3>
58
-
59
- <p>Having trouble with Pages? Check out the documentation at <a href="http://help.github.com/pages">http://help.github.com/pages</a> or contact <a href="mailto:support@github.com">support@github.com</a> and we’ll help you sort it out.</p>
60
- </section>
61
- </div>
62
-
63
- <!-- FOOTER -->
64
- <div id="footer_wrap" class="outer">
65
- <footer class="inner">
66
- <p class="copyright">Lelylan-rb maintained by <a href="https://github.com/lelylan">lelylan</a></p>
67
- <p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
68
- </footer>
69
- </div>
70
-
71
-
72
-
73
- </body>
74
- </html>
@@ -1 +0,0 @@
1
- console.log('This would be the main JS file.');
@@ -1,70 +0,0 @@
1
- .highlight .hll { background-color: #ffffcc }
2
- .highlight { background: #f0f3f3; }
3
- .highlight .c { color: #0099FF; font-style: italic } /* Comment */
4
- .highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */
5
- .highlight .k { color: #006699; font-weight: bold } /* Keyword */
6
- .highlight .o { color: #555555 } /* Operator */
7
- .highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
8
- .highlight .cp { color: #009999 } /* Comment.Preproc */
9
- .highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */
10
- .highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
11
- .highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
12
- .highlight .ge { font-style: italic } /* Generic.Emph */
13
- .highlight .gr { color: #FF0000 } /* Generic.Error */
14
- .highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */
15
- .highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
16
- .highlight .go { color: #AAAAAA } /* Generic.Output */
17
- .highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */
18
- .highlight .gs { font-weight: bold } /* Generic.Strong */
19
- .highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */
20
- .highlight .gt { color: #99CC66 } /* Generic.Traceback */
21
- .highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */
22
- .highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
23
- .highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
24
- .highlight .kp { color: #006699 } /* Keyword.Pseudo */
25
- .highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
26
- .highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */
27
- .highlight .m { color: #FF6600 } /* Literal.Number */
28
- .highlight .s { color: #CC3300 } /* Literal.String */
29
- .highlight .na { color: #330099 } /* Name.Attribute */
30
- .highlight .nb { color: #336666 } /* Name.Builtin */
31
- .highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */
32
- .highlight .no { color: #336600 } /* Name.Constant */
33
- .highlight .nd { color: #9999FF } /* Name.Decorator */
34
- .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
35
- .highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */
36
- .highlight .nf { color: #CC00FF } /* Name.Function */
37
- .highlight .nl { color: #9999FF } /* Name.Label */
38
- .highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
39
- .highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */
40
- .highlight .nv { color: #003333 } /* Name.Variable */
41
- .highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
42
- .highlight .w { color: #bbbbbb } /* Text.Whitespace */
43
- .highlight .mf { color: #FF6600 } /* Literal.Number.Float */
44
- .highlight .mh { color: #FF6600 } /* Literal.Number.Hex */
45
- .highlight .mi { color: #FF6600 } /* Literal.Number.Integer */
46
- .highlight .mo { color: #FF6600 } /* Literal.Number.Oct */
47
- .highlight .sb { color: #CC3300 } /* Literal.String.Backtick */
48
- .highlight .sc { color: #CC3300 } /* Literal.String.Char */
49
- .highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
50
- .highlight .s2 { color: #CC3300 } /* Literal.String.Double */
51
- .highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
52
- .highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */
53
- .highlight .si { color: #AA0000 } /* Literal.String.Interpol */
54
- .highlight .sx { color: #CC3300 } /* Literal.String.Other */
55
- .highlight .sr { color: #33AAAA } /* Literal.String.Regex */
56
- .highlight .s1 { color: #CC3300 } /* Literal.String.Single */
57
- .highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */
58
- .highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */
59
- .highlight .vc { color: #003333 } /* Name.Variable.Class */
60
- .highlight .vg { color: #003333 } /* Name.Variable.Global */
61
- .highlight .vi { color: #003333 } /* Name.Variable.Instance */
62
- .highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */
63
-
64
- .type-csharp .highlight .k { color: #0000FF }
65
- .type-csharp .highlight .kt { color: #0000FF }
66
- .type-csharp .highlight .nf { color: #000000; font-weight: normal }
67
- .type-csharp .highlight .nc { color: #2B91AF }
68
- .type-csharp .highlight .nn { color: #000000 }
69
- .type-csharp .highlight .s { color: #A31515 }
70
- .type-csharp .highlight .sc { color: #A31515 }