lelylan-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile +1 -3
- data/Guardfile +1 -1
- data/README.md +155 -84
- data/Rakefile +2 -15
- data/images/bg_hr.png +0 -0
- data/images/blacktocat.png +0 -0
- data/images/icon_download.png +0 -0
- data/images/sprite_download.png +0 -0
- data/index.html +74 -0
- data/javascripts/main.js +1 -0
- data/lelylan_rb.gemspec +12 -13
- data/lib/lelylan/client.rb +20 -23
- data/lib/lelylan/client/device.rb +121 -0
- data/lib/lelylan/client/function.rb +73 -0
- data/lib/lelylan/client/history.rb +28 -0
- data/lib/lelylan/client/location.rb +62 -0
- data/lib/lelylan/client/physical.rb +34 -0
- data/lib/lelylan/client/profile.rb +17 -0
- data/lib/lelylan/client/property.rb +75 -0
- data/lib/lelylan/client/status.rb +74 -0
- data/lib/lelylan/client/subscription.rb +62 -0
- data/lib/lelylan/client/type.rb +73 -0
- data/lib/lelylan/configuration.rb +4 -4
- data/lib/lelylan/connection.rb +9 -2
- data/lib/lelylan/request.rb +2 -16
- data/lib/lelylan/version.rb +1 -1
- data/spec/fixtures/profile.json +8 -0
- data/spec/fixtures/subscription.json +10 -0
- data/spec/fixtures/subscriptions.json +10 -0
- data/spec/lelylan/client/device_spec.rb +234 -0
- data/spec/lelylan/client/function_spec.rb +158 -0
- data/spec/lelylan/client/history_spec.rb +48 -0
- data/spec/lelylan/client/location_spec.rb +122 -0
- data/spec/lelylan/client/physical_spec.rb +27 -0
- data/spec/lelylan/client/profile_spec.rb +27 -0
- data/spec/lelylan/client/property_spec.rb +159 -0
- data/spec/lelylan/client/status_spec.rb +158 -0
- data/spec/lelylan/client/subscription_spec.rb +144 -0
- data/spec/lelylan/client/type_spec.rb +158 -0
- data/spec/lelylan/oauth2_spec.rb +13 -19
- data/stylesheets/pygment_trac.css +70 -0
- data/stylesheets/stylesheet.css +431 -0
- metadata +75 -114
- data/lib/lelylan/client/categories.rb +0 -112
- data/lib/lelylan/client/consumptions.rb +0 -93
- data/lib/lelylan/client/devices.rb +0 -211
- data/lib/lelylan/client/functions.rb +0 -118
- data/lib/lelylan/client/histories.rb +0 -42
- data/lib/lelylan/client/locations.rb +0 -92
- data/lib/lelylan/client/properties.rb +0 -115
- data/lib/lelylan/client/statuses.rb +0 -110
- data/lib/lelylan/client/types.rb +0 -109
- data/spec/lelylan/client/categories_spec.rb +0 -178
- data/spec/lelylan/client/consumptions_spec.rb +0 -150
- data/spec/lelylan/client/devices_spec.rb +0 -342
- data/spec/lelylan/client/functions_spec.rb +0 -184
- data/spec/lelylan/client/histories_spec.rb +0 -64
- data/spec/lelylan/client/locations_spec.rb +0 -155
- data/spec/lelylan/client/properties_spec.rb +0 -184
- data/spec/lelylan/client/statuses_spec.rb +0 -184
- data/spec/lelylan/client/types_spec.rb +0 -184
@@ -1,184 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
describe Lelylan::Client::Statuses do
|
4
|
-
|
5
|
-
let(:client) do
|
6
|
-
a_client
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
describe '.status' do
|
11
|
-
|
12
|
-
let(:path) do
|
13
|
-
'/statuses/4dcb9e23d033a9088900000a'
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:uri) do
|
17
|
-
"http://api.lelylan.com/#{path}"
|
18
|
-
end
|
19
|
-
|
20
|
-
before do
|
21
|
-
stub_get(path).to_return(body: fixture('status.json'))
|
22
|
-
end
|
23
|
-
|
24
|
-
let!(:status) do
|
25
|
-
client.status(uri)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'returns the status' do
|
29
|
-
status.uri.should_not be_nil
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'sends the request' do
|
33
|
-
a_get(path).should have_been_made
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
describe '.statuses' do
|
39
|
-
|
40
|
-
let(:path) do
|
41
|
-
'/statuses'
|
42
|
-
end
|
43
|
-
|
44
|
-
before do
|
45
|
-
stub_get('/statuses').to_return(body: fixture('statuses.json'))
|
46
|
-
end
|
47
|
-
|
48
|
-
let!(:statuses) do
|
49
|
-
client.statuses
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns a list of statuses' do
|
53
|
-
statuses.should have(1).item
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'sends the request' do
|
57
|
-
a_get(path).should have_been_made
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'with params' do
|
61
|
-
|
62
|
-
before do
|
63
|
-
stub_get(path).with(query: {per: '25'}).to_return(body: fixture('status.json'))
|
64
|
-
end
|
65
|
-
|
66
|
-
before do
|
67
|
-
client.statuses(per: 25)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'sends the params' do
|
71
|
-
a_get(path).with(query: {per: '25'}).should have_been_made
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
describe '.public_statuses' do
|
78
|
-
|
79
|
-
let(:path) do
|
80
|
-
'/statuses/public'
|
81
|
-
end
|
82
|
-
|
83
|
-
before do
|
84
|
-
client.user = nil
|
85
|
-
client.password = nil
|
86
|
-
end
|
87
|
-
|
88
|
-
before do
|
89
|
-
stub_get(path).to_return(body: fixture('statuses.json'))
|
90
|
-
end
|
91
|
-
|
92
|
-
let!(:statuses) do
|
93
|
-
client.public_statuses
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'returns a list of statuses' do
|
97
|
-
statuses.should have(1).item
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'sends the request' do
|
101
|
-
a_get('http://api.lelylan.com/statuses/public').should have_been_made
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
describe '.create_status' do
|
107
|
-
|
108
|
-
let(:path) do
|
109
|
-
'/statuses'
|
110
|
-
end
|
111
|
-
|
112
|
-
before do
|
113
|
-
stub_post(path).with(body: {name: 'Setting intensity'}).to_return(body: fixture('status.json'))
|
114
|
-
end
|
115
|
-
|
116
|
-
let!(:status) do
|
117
|
-
client.create_status(name: 'Setting intensity')
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'returns the status' do
|
121
|
-
status.uri.should_not be_nil
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'sends the request' do
|
125
|
-
a_post(path).with(body: {name: 'Setting intensity'}).should have_been_made
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
describe '.update_status' do
|
131
|
-
|
132
|
-
let(:path) do
|
133
|
-
'/statuses/4dcb9e23d033a9088900000a'
|
134
|
-
end
|
135
|
-
|
136
|
-
let(:uri) do
|
137
|
-
"http://api.lelylan.com/#{path}"
|
138
|
-
end
|
139
|
-
|
140
|
-
before do
|
141
|
-
stub_put(path).with(body: {name: 'Setting intensity'}).to_return(body: fixture('status.json'))
|
142
|
-
end
|
143
|
-
|
144
|
-
let!(:status) do
|
145
|
-
client.update_status(uri, name: 'Setting intensity')
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'returns the status' do
|
149
|
-
status.uri.should_not be_nil
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'sends the request' do
|
153
|
-
a_put(path).with(body: {name: 'Setting intensity'}).should have_been_made
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
describe '.delete_status' do
|
159
|
-
|
160
|
-
let(:path) do
|
161
|
-
'/statuses/4dcb9e23d033a9088900000a'
|
162
|
-
end
|
163
|
-
|
164
|
-
let(:uri) do
|
165
|
-
"http://api.lelylan.com/#{path}"
|
166
|
-
end
|
167
|
-
|
168
|
-
before do
|
169
|
-
stub_delete(path).to_return(body: fixture('status.json'))
|
170
|
-
end
|
171
|
-
|
172
|
-
let!(:status) do
|
173
|
-
client.delete_status(uri)
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'returns the status' do
|
177
|
-
status.uri.should_not be_nil
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'sends the request' do
|
181
|
-
a_delete(path).should have_been_made
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
@@ -1,184 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
describe Lelylan::Client::Types do
|
4
|
-
|
5
|
-
let(:client) do
|
6
|
-
a_client
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
describe '.type' do
|
11
|
-
|
12
|
-
let(:path) do
|
13
|
-
'/types/4dcb9e23d033a9088900000a'
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:uri) do
|
17
|
-
"http://api.lelylan.com/#{path}"
|
18
|
-
end
|
19
|
-
|
20
|
-
before do
|
21
|
-
stub_get(path).to_return(body: fixture('type.json'))
|
22
|
-
end
|
23
|
-
|
24
|
-
let!(:type) do
|
25
|
-
client.type(uri)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'returns the type' do
|
29
|
-
type.uri.should_not be_nil
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'sends the request' do
|
33
|
-
a_get(path).should have_been_made
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
describe '.types' do
|
39
|
-
|
40
|
-
let(:path) do
|
41
|
-
'/types'
|
42
|
-
end
|
43
|
-
|
44
|
-
before do
|
45
|
-
stub_get(path).to_return(body: fixture('types.json'))
|
46
|
-
end
|
47
|
-
|
48
|
-
let!(:types) do
|
49
|
-
client.types
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns a list of types' do
|
53
|
-
types.should have(1).item
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'sends the request' do
|
57
|
-
a_get(path).should have_been_made
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'with params' do
|
61
|
-
|
62
|
-
before do
|
63
|
-
stub_get(path).with(query: {per: '25'}).to_return(body: fixture('type.json'))
|
64
|
-
end
|
65
|
-
|
66
|
-
before do
|
67
|
-
client.types(per: 25)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'sends the params' do
|
71
|
-
a_get(path).with(query: {per: '25'}).should have_been_made
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
describe '.public_types' do
|
78
|
-
|
79
|
-
let(:path) do
|
80
|
-
'/types/public'
|
81
|
-
end
|
82
|
-
|
83
|
-
before do
|
84
|
-
client.user = nil
|
85
|
-
client.password = nil
|
86
|
-
end
|
87
|
-
|
88
|
-
before do
|
89
|
-
stub_get(path).to_return(body: fixture('types.json'))
|
90
|
-
end
|
91
|
-
|
92
|
-
let!(:types) do
|
93
|
-
client.public_types
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'returns a list of types' do
|
97
|
-
types.should have(1).item
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'sends the request' do
|
101
|
-
a_get('http://api.lelylan.com/types/public').should have_been_made
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
describe '.create_type' do
|
107
|
-
|
108
|
-
let(:path) do
|
109
|
-
'/types'
|
110
|
-
end
|
111
|
-
|
112
|
-
before do
|
113
|
-
stub_post(path).with(body: {name: 'Dimmer'}).to_return(body: fixture('type.json'))
|
114
|
-
end
|
115
|
-
|
116
|
-
let!(:type) do
|
117
|
-
client.create_type(name: 'Dimmer')
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'returns the type' do
|
121
|
-
type.uri.should_not be_nil
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'sends the request' do
|
125
|
-
a_post(path).with(body: {name: 'Dimmer'}).should have_been_made
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
describe '.update_type' do
|
131
|
-
|
132
|
-
let(:path) do
|
133
|
-
'/types/4dcb9e23d033a9088900000a'
|
134
|
-
end
|
135
|
-
|
136
|
-
let(:uri) do
|
137
|
-
"http://api.lelylan.com/#{path}"
|
138
|
-
end
|
139
|
-
|
140
|
-
before do
|
141
|
-
stub_put(path).with(body: {name: 'Dimmer'}).to_return(body: fixture('type.json'))
|
142
|
-
end
|
143
|
-
|
144
|
-
let!(:type) do
|
145
|
-
client.update_type(uri, name: 'Dimmer')
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'returns the type' do
|
149
|
-
type.uri.should_not be_nil
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'sends the request' do
|
153
|
-
a_put(path).with(body: {name: 'Dimmer'}).should have_been_made
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
describe '.delete_type' do
|
159
|
-
|
160
|
-
let(:path) do
|
161
|
-
'/types/4dcb9e23d033a9088900000a'
|
162
|
-
end
|
163
|
-
|
164
|
-
let(:uri) do
|
165
|
-
"http://api.lelylan.com/#{path}"
|
166
|
-
end
|
167
|
-
|
168
|
-
before do
|
169
|
-
stub_delete(path).to_return(body: fixture('type.json'))
|
170
|
-
end
|
171
|
-
|
172
|
-
let!(:type) do
|
173
|
-
client.delete_type(uri)
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'returns the type' do
|
177
|
-
type.uri.should_not be_nil
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'sends the request' do
|
181
|
-
a_delete(path).should have_been_made
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|