purple_air_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +1 -1
- data/README.md +143 -11
- data/Rakefile +5 -0
- data/docs/PurpleAirApi.html +488 -0
- data/docs/PurpleAirApi/V1.html +128 -0
- data/docs/PurpleAirApi/V1/ApiError.html +159 -0
- data/docs/PurpleAirApi/V1/ApiKeyError.html +159 -0
- data/docs/PurpleAirApi/V1/BaseError.html +431 -0
- data/docs/PurpleAirApi/V1/Client.html +801 -0
- data/docs/PurpleAirApi/V1/GetSensor.html +1033 -0
- data/docs/PurpleAirApi/V1/GetSensors.html +979 -0
- data/docs/PurpleAirApi/V1/MissingJsonPayloadError.html +159 -0
- data/docs/PurpleAirApi/V1/NotFoundError.html +159 -0
- data/docs/PurpleAirApi/V1/OptionsError.html +135 -0
- data/docs/PurpleAirApi/V1/RaiseHttpException.html +318 -0
- data/docs/PurpleAirApi/V1/ServerError.html +159 -0
- data/docs/_index.html +274 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +247 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +247 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +315 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/purple_air_api/V1/client.rb +11 -1
- data/lib/purple_air_api/V1/sensors/get_sensor.rb +5 -4
- data/lib/purple_air_api/V1/sensors/get_sensors.rb +11 -9
- data/lib/purple_air_api/version.rb +1 -1
- data/purple_air_api.gemspec +8 -5
- metadata +37 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f18060e909ac898bebb96aa99dd9e56b855be6c7ba88be469e405205f436a44
|
4
|
+
data.tar.gz: 1f261a0c971b2a7d6d477f00e370fcd366687cdfd96196cfa59cc21ceb1ced56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc365f82dfa80f2c3e96495c6f96dc0bcfb8f26cfbe0148406e4186e7d6e4c51bfd403d480897c4c54c6020b240e3ad9b7325a69337c441d65a5cb97b278469
|
7
|
+
data.tar.gz: d2026b85e5d3a1e28e6bd19a785ab2c8913ae615f406ae4e4f3f9e84dcab457eb995536b4b5139750ac1895c6b72c60f1e7096cb39dc2cf2c3c0708ec0c887df
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# PurpleAirApi
|
2
|
-
|
3
|
-
This is a client for interacting with the PurpleAir API. This was written using the V1 of the API. In order to use this gem, you must have been granted read and write tokens from PurpleAir.
|
2
|
+
This is a Ruby wrapper for the PurpleAir API.
|
4
3
|
|
5
4
|
## Installation
|
6
|
-
|
7
5
|
Add this line to your application's Gemfile:
|
8
6
|
|
9
7
|
```ruby
|
@@ -12,23 +10,155 @@ gem 'purple_air_api'
|
|
12
10
|
|
13
11
|
And then execute:
|
14
12
|
|
15
|
-
|
13
|
+
`bundle install`
|
16
14
|
|
17
15
|
Or install it yourself as:
|
18
16
|
|
19
|
-
|
17
|
+
`gem install purple_air_api`
|
20
18
|
|
21
19
|
## Usage
|
22
|
-
|
23
|
-
|
20
|
+
To use this gem, instantiate an instance of a PurpleAirApi client. The write token is
|
21
|
+
optional and currently no write actions are implemented in this gem.
|
24
22
|
|
25
23
|
`client = PurpleAirApi.client(read_token: your_read_token, write_token: your_write_token)`
|
26
24
|
|
27
|
-
You can then use this client to interact with the various API methods under the client
|
25
|
+
You can then use this client to interact with the various API methods under the client:
|
26
|
+
|
27
|
+
### Requesting multiple sensors
|
28
|
+
```ruby
|
29
|
+
# Optional parameters are added using a hash. For a full list of options refer to the documentation.
|
30
|
+
|
31
|
+
nw_lat_long = [37.804930, -122.448382]
|
32
|
+
se_lat_long = [37.794832, -122.393589]
|
33
|
+
fields = %w[icon name latitude longitude altitude pm2.5 pm2.5_10minute pm2.5_30minute pm2.5_60minute]
|
34
|
+
location_type = %w[outside]
|
35
|
+
show_only = [20, 40, 55, 120]
|
36
|
+
|
37
|
+
options = {
|
38
|
+
fields: fields,
|
39
|
+
location_type: location_type,
|
40
|
+
bounding_box: { nw: nw_lat_long, se: se_lat_long },
|
41
|
+
show_only: show_only
|
42
|
+
}
|
43
|
+
|
44
|
+
response = client.request_sensors(options)
|
45
|
+
|
46
|
+
response.parsed_response[:data][40] # access the individual sensor data using the parsed_response hash
|
47
|
+
```
|
48
|
+
|
49
|
+
### Requesting a single sensor index
|
50
|
+
```ruby
|
51
|
+
response = client.request_sensor(sensor_index: 1)
|
52
|
+
|
53
|
+
current_air_quality = response.json_response[:sensor][:"pm2.5_a"]
|
54
|
+
```
|
55
|
+
|
56
|
+
### A sample service object for a lat-long bounding box
|
57
|
+
```ruby
|
58
|
+
# frozen_string_literal: true
|
59
|
+
|
60
|
+
require 'purple_air_api'
|
61
|
+
require 'dotenv/load'
|
62
|
+
|
63
|
+
module AirQuality
|
64
|
+
# Class for making requests for local sensor data with a lat-long bounding box
|
65
|
+
class GetSensors
|
66
|
+
NW_LAT_LONG = [37.804930, -122.448382].freeze
|
67
|
+
SE_LAT_LONG = [37.794832, -122.393589].freeze
|
68
|
+
DEFAULT_FIELDS = %w[icon name latitude longitude altitude pm2.5 pm2.5_10minute pm2.5_30minute pm2.5_60minute].freeze
|
69
|
+
DEFAULT_LOCATION_TYPE = %w[outside].freeze
|
70
|
+
|
71
|
+
def self.call
|
72
|
+
new.request
|
73
|
+
end
|
74
|
+
|
75
|
+
def request
|
76
|
+
PurpleAirApi.client(read_token: read_token).request_sensors(fields)
|
77
|
+
end
|
78
|
+
|
79
|
+
def read_token
|
80
|
+
ENV['READ_TOKEN']
|
81
|
+
end
|
82
|
+
|
83
|
+
def fields
|
84
|
+
{
|
85
|
+
fields: DEFAULT_FIELDS,
|
86
|
+
location_type: DEFAULT_LOCATION_TYPE,
|
87
|
+
bounding_box: { nw: NW_LAT_LONG, se: SE_LAT_LONG }
|
88
|
+
}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
````
|
93
|
+
|
94
|
+
### A sample service object for a single sensor
|
95
|
+
```ruby
|
96
|
+
# frozen_string_literal: true
|
97
|
+
|
98
|
+
require 'purple_air_api'
|
99
|
+
require 'dotenv/load'
|
100
|
+
|
101
|
+
module AirQuality
|
102
|
+
# Class for making requests for an individual sensor
|
103
|
+
class GetSensor
|
104
|
+
SENSOR_INDEX = 54_849
|
28
105
|
|
29
|
-
|
106
|
+
def self.call
|
107
|
+
new.request
|
108
|
+
end
|
30
109
|
|
31
|
-
|
110
|
+
def request
|
111
|
+
PurpleAirApi.client(read_token: read_token).request_sensor(sensor_index: SENSOR_INDEX)
|
112
|
+
end
|
113
|
+
|
114
|
+
def read_token
|
115
|
+
ENV['READ_TOKEN']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
```
|
120
|
+
|
121
|
+
### In a Sinatra app
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
# frozen_string_literal: true
|
125
|
+
|
126
|
+
require 'sinatra'
|
127
|
+
require "sinatra/json"
|
128
|
+
require 'dotenv/load'
|
129
|
+
require 'purple_air_api'
|
130
|
+
|
131
|
+
module HomeHub
|
132
|
+
# App server class for running the HomeHub app
|
133
|
+
class App < Sinatra::Base
|
134
|
+
|
135
|
+
get '/sensors/:id' do
|
136
|
+
json purple_air_client.request_sensor(sensor_index: params[:id].to_i).json_response
|
137
|
+
end
|
138
|
+
|
139
|
+
get '/sensors' do
|
140
|
+
json purple_air_client.request_sensors.json_response
|
141
|
+
end
|
142
|
+
|
143
|
+
def purple_air_client
|
144
|
+
@purple_air_client ||= PurpleAirApi.client(read_token: read_token)
|
145
|
+
end
|
146
|
+
|
147
|
+
def read_token
|
148
|
+
@read_token ||= ENV['READ_TOKEN']
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
154
|
+
## Documentation
|
155
|
+
|
156
|
+
Documentation for this gem can be found [here.](https://dkiselbach.github.io/purple_air_api/)
|
157
|
+
|
158
|
+
## PurpleAir Documentation and Read and Write Tokens
|
159
|
+
|
160
|
+
This wrapper was written using the [PurpleAir API Documentation](https://api.purpleair.com/). You will require a read
|
161
|
+
and write token in order to use the PurpleAir API which can be received by [reaching out to PurpleAir](https://www2.purpleair.com/pages/contact-us).
|
32
162
|
|
33
163
|
## Development
|
34
164
|
|
@@ -36,6 +166,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
36
166
|
|
37
167
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
168
|
|
169
|
+
Make sure you are updating the Yard docs prior to pushing to master by running `rake yard`.
|
170
|
+
|
39
171
|
## Contributing
|
40
172
|
|
41
173
|
Bug reports and pull requests are welcome on GitHub at https://github.com/dkiselbach/purple_air_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/dkiselbach/purple_air_api/CODE_OF_CONDUCT.md).
|
@@ -46,6 +178,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
46
178
|
|
47
179
|
## Code of Conduct
|
48
180
|
|
49
|
-
Everyone interacting in the PurpleAirApi project's
|
181
|
+
Everyone interacting in the PurpleAirApi project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dkiselbach/purple_air_api/blob/master/CODE_OF_CONDUCT.md).
|
50
182
|
|
51
183
|
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md)
|
data/Rakefile
CHANGED
@@ -0,0 +1,488 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: PurpleAirApi
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "PurpleAirApi";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (P)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">PurpleAirApi</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: PurpleAirApi
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/purple_air_api.rb<span class="defines">,<br />
|
82
|
+
lib/purple_air_api/version.rb,<br /> lib/purple_air_api/V1/client.rb,<br /> lib/purple_air_api/V1/errors.rb,<br /> lib/purple_air_api/V1/sensors/errors.rb,<br /> lib/purple_air_api/V1/sensors/get_sensor.rb,<br /> lib/purple_air_api/V1/sensors/get_sensors.rb,<br /> lib/purple_air_api/V1/raise_http_exception.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
|
91
|
+
<p>The PurpleAirApi is a gem intended to be used to interact with the PurpleAir API easily.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
100
|
+
<p class="children">
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="PurpleAirApi/V1.html" title="PurpleAirApi::V1 (module)">V1</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</p>
|
109
|
+
|
110
|
+
|
111
|
+
<h2>
|
112
|
+
Constant Summary
|
113
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
114
|
+
</h2>
|
115
|
+
|
116
|
+
<dl class="constants">
|
117
|
+
|
118
|
+
<dt id="VERSION-constant" class="">VERSION =
|
119
|
+
<div class="docstring">
|
120
|
+
<div class="discussion">
|
121
|
+
|
122
|
+
<p>The gem version</p>
|
123
|
+
|
124
|
+
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
<div class="tags">
|
128
|
+
|
129
|
+
|
130
|
+
</div>
|
131
|
+
</dt>
|
132
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>'</span></span></pre></dd>
|
133
|
+
|
134
|
+
</dl>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<h2>
|
145
|
+
Class Method Summary
|
146
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
147
|
+
</h2>
|
148
|
+
|
149
|
+
<ul class="summary">
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#client-class_method" title="client (class method)">.<strong>client</strong>(read_token:, write_token: nil) ⇒ PurpleAirApi::V1::Client </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'>
|
169
|
+
<p>Alias for PurpleAirApi::V1::Client.new.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#method_missing-class_method" title="method_missing (class method)">.<strong>method_missing</strong>(method, *args, &block) ⇒ Object </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'>
|
193
|
+
<p>Delegate to PurpleAirApi::V1::Client.</p>
|
194
|
+
</div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#respond_to%3F-class_method" title="respond_to? (class method)">.<strong>respond_to?</strong>(method, include_all: false) ⇒ Boolean </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'>
|
217
|
+
<p>Delegate to PurpleAirApi::V1::Client.</p>
|
218
|
+
</div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#respond_to_missing%3F-class_method" title="respond_to_missing? (class method)">.<strong>respond_to_missing?</strong>(method_name, include_private: false) ⇒ Boolean </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'>
|
241
|
+
<p>Delegate to PurpleAirApi::V1::Client.</p>
|
242
|
+
</div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
</ul>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<div id="class_method_details" class="method_details_list">
|
253
|
+
<h2>Class Method Details</h2>
|
254
|
+
|
255
|
+
|
256
|
+
<div class="method_details first">
|
257
|
+
<h3 class="signature first" id="client-class_method">
|
258
|
+
|
259
|
+
.<strong>client</strong>(read_token:, write_token: nil) ⇒ <tt><span class='object_link'><a href="PurpleAirApi/V1/Client.html" title="PurpleAirApi::V1::Client (class)">PurpleAirApi::V1::Client</a></span></tt>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</h3><div class="docstring">
|
266
|
+
<div class="discussion">
|
267
|
+
|
268
|
+
<p>Alias for PurpleAirApi::V1::Client.new</p>
|
269
|
+
|
270
|
+
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
<div class="tags">
|
274
|
+
|
275
|
+
<div class="examples">
|
276
|
+
<p class="tag_title">Examples:</p>
|
277
|
+
|
278
|
+
|
279
|
+
<p class="example_title"><div class='inline'>
|
280
|
+
<p>requesting data for a few sensors</p>
|
281
|
+
</div></p>
|
282
|
+
|
283
|
+
<pre class="example code"><code><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>fields:</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>icon</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>location_type:</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>outside</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>show_only:</span> <span class='lbracket'>[</span><span class='int'>26</span><span class='comma'>,</span> <span class='int'>41</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>max_age:</span> <span class='int'>3600</span><span class='rbrace'>}</span>
|
284
|
+
<span class='const'><span class='object_link'><a href="" title="PurpleAirApi (module)">PurpleAirApi</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'>client</span><span class='lparen'>(</span><span class='label'>read_token:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1234</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>write_token:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1234</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_request_sensors'><span class='object_link'><a href="PurpleAirApi/V1/Client.html#request_sensors-instance_method" title="PurpleAirApi::V1::Client#request_sensors (method)">request_sensors</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span></code></pre>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<p class="tag_title">Returns:</p>
|
289
|
+
<ul class="return">
|
290
|
+
|
291
|
+
<li>
|
292
|
+
|
293
|
+
|
294
|
+
<span class='type'>(<tt><span class='object_link'><a href="PurpleAirApi/V1/Client.html" title="PurpleAirApi::V1::Client (class)">PurpleAirApi::V1::Client</a></span></tt>)</span>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
</li>
|
299
|
+
|
300
|
+
</ul>
|
301
|
+
|
302
|
+
</div><table class="source_code">
|
303
|
+
<tr>
|
304
|
+
<td>
|
305
|
+
<pre class="lines">
|
306
|
+
|
307
|
+
|
308
|
+
22
|
309
|
+
23
|
310
|
+
24</pre>
|
311
|
+
</td>
|
312
|
+
<td>
|
313
|
+
<pre class="code"><span class="info file"># File 'lib/purple_air_api.rb', line 22</span>
|
314
|
+
|
315
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_client'>client</span><span class='lparen'>(</span><span class='label'>read_token:</span><span class='comma'>,</span> <span class='label'>write_token:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
316
|
+
<span class='const'><span class='object_link'><a href="" title="PurpleAirApi (module)">PurpleAirApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="PurpleAirApi/V1.html" title="PurpleAirApi::V1 (module)">V1</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="PurpleAirApi/V1/Client.html" title="PurpleAirApi::V1::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="PurpleAirApi/V1/Client.html#initialize-instance_method" title="PurpleAirApi::V1::Client#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>read_token:</span> <span class='id identifier rubyid_read_token'>read_token</span><span class='comma'>,</span> <span class='label'>write_token:</span> <span class='id identifier rubyid_write_token'>write_token</span><span class='rparen'>)</span>
|
317
|
+
<span class='kw'>end</span></pre>
|
318
|
+
</td>
|
319
|
+
</tr>
|
320
|
+
</table>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div class="method_details ">
|
324
|
+
<h3 class="signature " id="method_missing-class_method">
|
325
|
+
|
326
|
+
.<strong>method_missing</strong>(method, *args, &block) ⇒ <tt>Object</tt>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
</h3><div class="docstring">
|
333
|
+
<div class="discussion">
|
334
|
+
|
335
|
+
<p>Delegate to PurpleAirApi::V1::Client</p>
|
336
|
+
|
337
|
+
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
<div class="tags">
|
341
|
+
|
342
|
+
|
343
|
+
</div><table class="source_code">
|
344
|
+
<tr>
|
345
|
+
<td>
|
346
|
+
<pre class="lines">
|
347
|
+
|
348
|
+
|
349
|
+
27
|
350
|
+
28
|
351
|
+
29
|
352
|
+
30
|
353
|
+
31</pre>
|
354
|
+
</td>
|
355
|
+
<td>
|
356
|
+
<pre class="code"><span class="info file"># File 'lib/purple_air_api.rb', line 27</span>
|
357
|
+
|
358
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
359
|
+
<span class='kw'>return</span> <span class='kw'>super</span> <span class='kw'>unless</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
|
360
|
+
|
361
|
+
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
362
|
+
<span class='kw'>end</span></pre>
|
363
|
+
</td>
|
364
|
+
</tr>
|
365
|
+
</table>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div class="method_details ">
|
369
|
+
<h3 class="signature " id="respond_to?-class_method">
|
370
|
+
|
371
|
+
.<strong>respond_to?</strong>(method, include_all: false) ⇒ <tt>Boolean</tt>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</h3><div class="docstring">
|
378
|
+
<div class="discussion">
|
379
|
+
|
380
|
+
<p>Delegate to PurpleAirApi::V1::Client</p>
|
381
|
+
|
382
|
+
|
383
|
+
</div>
|
384
|
+
</div>
|
385
|
+
<div class="tags">
|
386
|
+
|
387
|
+
<p class="tag_title">Returns:</p>
|
388
|
+
<ul class="return">
|
389
|
+
|
390
|
+
<li>
|
391
|
+
|
392
|
+
|
393
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
</li>
|
398
|
+
|
399
|
+
</ul>
|
400
|
+
|
401
|
+
</div><table class="source_code">
|
402
|
+
<tr>
|
403
|
+
<td>
|
404
|
+
<pre class="lines">
|
405
|
+
|
406
|
+
|
407
|
+
34
|
408
|
+
35
|
409
|
+
36</pre>
|
410
|
+
</td>
|
411
|
+
<td>
|
412
|
+
<pre class="code"><span class="info file"># File 'lib/purple_air_api.rb', line 34</span>
|
413
|
+
|
414
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>include_all:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
415
|
+
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_include_all'>include_all</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>super</span>
|
416
|
+
<span class='kw'>end</span></pre>
|
417
|
+
</td>
|
418
|
+
</tr>
|
419
|
+
</table>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
<div class="method_details ">
|
423
|
+
<h3 class="signature " id="respond_to_missing?-class_method">
|
424
|
+
|
425
|
+
.<strong>respond_to_missing?</strong>(method_name, include_private: false) ⇒ <tt>Boolean</tt>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</h3><div class="docstring">
|
432
|
+
<div class="discussion">
|
433
|
+
|
434
|
+
<p>Delegate to PurpleAirApi::V1::Client</p>
|
435
|
+
|
436
|
+
|
437
|
+
</div>
|
438
|
+
</div>
|
439
|
+
<div class="tags">
|
440
|
+
|
441
|
+
<p class="tag_title">Returns:</p>
|
442
|
+
<ul class="return">
|
443
|
+
|
444
|
+
<li>
|
445
|
+
|
446
|
+
|
447
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
</li>
|
452
|
+
|
453
|
+
</ul>
|
454
|
+
|
455
|
+
</div><table class="source_code">
|
456
|
+
<tr>
|
457
|
+
<td>
|
458
|
+
<pre class="lines">
|
459
|
+
|
460
|
+
|
461
|
+
39
|
462
|
+
40
|
463
|
+
41</pre>
|
464
|
+
</td>
|
465
|
+
<td>
|
466
|
+
<pre class="code"><span class="info file"># File 'lib/purple_air_api.rb', line 39</span>
|
467
|
+
|
468
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to_missing?'>respond_to_missing?</span><span class='lparen'>(</span><span class='id identifier rubyid_method_name'>method_name</span><span class='comma'>,</span> <span class='label'>include_private:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
469
|
+
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_respond_to_missing?'>respond_to_missing?</span><span class='lparen'>(</span><span class='id identifier rubyid_method_name'>method_name</span><span class='comma'>,</span> <span class='id identifier rubyid_include_private'>include_private</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>super</span>
|
470
|
+
<span class='kw'>end</span></pre>
|
471
|
+
</td>
|
472
|
+
</tr>
|
473
|
+
</table>
|
474
|
+
</div>
|
475
|
+
|
476
|
+
</div>
|
477
|
+
|
478
|
+
</div>
|
479
|
+
|
480
|
+
<div id="footer">
|
481
|
+
Generated on Fri Mar 12 10:06:10 2021 by
|
482
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
483
|
+
0.9.26 (ruby-3.0.0).
|
484
|
+
</div>
|
485
|
+
|
486
|
+
</div>
|
487
|
+
</body>
|
488
|
+
</html>
|