purple_air_api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -18,9 +18,10 @@ module PurpleAirApi
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Creates a HTTP friendly options hash depending on your inputs
|
21
|
-
# @!method initialize(client:,
|
21
|
+
# @!method initialize(client:, sensor_index:, read_key: nil)
|
22
22
|
# @param client [Faraday::Connection] Your HTTP client initialized in Client
|
23
|
-
# @param
|
23
|
+
# @param sensor_index [Integer] The sensor_index for the sensor you want to request data from.
|
24
|
+
# @param read_key [String] The read_key for the sensor you want to request data from if it is a private sensor.
|
24
25
|
|
25
26
|
def initialize(client:, sensor_index:, read_key: nil)
|
26
27
|
@http_client = client
|
@@ -43,9 +44,9 @@ module PurpleAirApi
|
|
43
44
|
json_response
|
44
45
|
end
|
45
46
|
|
46
|
-
# Takes the raw response from PurpleAir and parses the JSON.
|
47
|
+
# Takes the raw response from PurpleAir and parses the JSON into a Hash.
|
47
48
|
# @!method json_response
|
48
|
-
# @return [
|
49
|
+
# @return [Hash]
|
49
50
|
# @example json_response example
|
50
51
|
# response.json_response
|
51
52
|
# {
|
@@ -70,9 +70,9 @@ module PurpleAirApi
|
|
70
70
|
@parsed_response ||= parse_response
|
71
71
|
end
|
72
72
|
|
73
|
-
# Takes the raw response from PurpleAir and parses the JSON.
|
73
|
+
# Takes the raw response from PurpleAir and parses the JSON into a Hash.
|
74
74
|
# @!method json_response
|
75
|
-
# @return [
|
75
|
+
# @return [Hash]
|
76
76
|
# @example json_response example
|
77
77
|
# response.json_response
|
78
78
|
# {
|
@@ -130,20 +130,22 @@ module PurpleAirApi
|
|
130
130
|
def location_type(location_type)
|
131
131
|
return {} if location_type.nil?
|
132
132
|
|
133
|
-
unless location_type.instance_of?(Array) && location_type.first.instance_of?(String)
|
134
|
-
raise OptionsError,
|
135
|
-
"location_type must be an array of strings specifying either ['inside'], ['outside'], or both"
|
136
|
-
end
|
137
|
-
|
138
|
-
location_type.map!(&:downcase)
|
133
|
+
location_type_error unless location_type.instance_of?(Array) && location_type.first.instance_of?(String)
|
139
134
|
|
140
|
-
location_type_parameter(location_type)
|
135
|
+
location_type_parameter(location_type.map(&:downcase))
|
141
136
|
end
|
142
137
|
|
143
138
|
def location_type_parameter(location_type)
|
144
139
|
return {} if location_type.include?('outside') && location_type.include?('inside')
|
145
140
|
return { location_type: 1 } if location_type.include?('inside')
|
146
141
|
return { location_type: 0 } if location_type.include?('outside')
|
142
|
+
|
143
|
+
location_type_error
|
144
|
+
end
|
145
|
+
|
146
|
+
def location_type_error
|
147
|
+
raise OptionsError,
|
148
|
+
"location_type must be an array of strings specifying either ['inside'], ['outside'], or both"
|
147
149
|
end
|
148
150
|
|
149
151
|
def modified_since(timestamp)
|
data/purple_air_api.gemspec
CHANGED
@@ -8,16 +8,19 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Dylan Kiselbach']
|
9
9
|
spec.email = ['dylankiselbach@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = 'This is
|
12
|
-
spec.description = '
|
13
|
-
|
11
|
+
spec.summary = 'This is a Ruby wrapper for the PurpleAir API.'
|
12
|
+
spec.description = 'This gem is a API wrapper for the PurpleAir API intended to help in making requests
|
13
|
+
to PurpleAir. Please refer to the documentation for details on usage and how to get
|
14
|
+
started using this gem.'
|
14
15
|
spec.homepage = 'https://github.com/dkiselbach/purple_air_api'
|
15
16
|
spec.license = 'MIT'
|
16
17
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
17
18
|
|
18
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/dkiselbach/purple_air_api
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/dkiselbach/purple_air_api
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/dkiselbach/purple_air_api'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/dkiselbach/purple_air_api'
|
22
|
+
|
23
|
+
spec.extra_rdoc_files = ['README.md']
|
21
24
|
|
22
25
|
# Specify which files should be added to the gem when it is released.
|
23
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purple_air_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Kiselbach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -39,13 +39,15 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.5'
|
41
41
|
description: |-
|
42
|
-
|
43
|
-
|
42
|
+
This gem is a API wrapper for the PurpleAir API intended to help in making requests
|
43
|
+
to PurpleAir. Please refer to the documentation for details on usage and how to get
|
44
|
+
started using this gem.
|
44
45
|
email:
|
45
46
|
- dylankiselbach@gmail.com
|
46
47
|
executables: []
|
47
48
|
extensions: []
|
48
|
-
extra_rdoc_files:
|
49
|
+
extra_rdoc_files:
|
50
|
+
- README.md
|
49
51
|
files:
|
50
52
|
- ".gitignore"
|
51
53
|
- ".rspec"
|
@@ -58,6 +60,33 @@ files:
|
|
58
60
|
- Rakefile
|
59
61
|
- bin/console
|
60
62
|
- bin/setup
|
63
|
+
- docs/PurpleAirApi.html
|
64
|
+
- docs/PurpleAirApi/V1.html
|
65
|
+
- docs/PurpleAirApi/V1/ApiError.html
|
66
|
+
- docs/PurpleAirApi/V1/ApiKeyError.html
|
67
|
+
- docs/PurpleAirApi/V1/BaseError.html
|
68
|
+
- docs/PurpleAirApi/V1/Client.html
|
69
|
+
- docs/PurpleAirApi/V1/GetSensor.html
|
70
|
+
- docs/PurpleAirApi/V1/GetSensors.html
|
71
|
+
- docs/PurpleAirApi/V1/MissingJsonPayloadError.html
|
72
|
+
- docs/PurpleAirApi/V1/NotFoundError.html
|
73
|
+
- docs/PurpleAirApi/V1/OptionsError.html
|
74
|
+
- docs/PurpleAirApi/V1/RaiseHttpException.html
|
75
|
+
- docs/PurpleAirApi/V1/ServerError.html
|
76
|
+
- docs/_index.html
|
77
|
+
- docs/class_list.html
|
78
|
+
- docs/css/common.css
|
79
|
+
- docs/css/full_list.css
|
80
|
+
- docs/css/style.css
|
81
|
+
- docs/file.README.html
|
82
|
+
- docs/file_list.html
|
83
|
+
- docs/frames.html
|
84
|
+
- docs/index.html
|
85
|
+
- docs/js/app.js
|
86
|
+
- docs/js/full_list.js
|
87
|
+
- docs/js/jquery.js
|
88
|
+
- docs/method_list.html
|
89
|
+
- docs/top-level-namespace.html
|
61
90
|
- lib/purple_air_api.rb
|
62
91
|
- lib/purple_air_api/V1/client.rb
|
63
92
|
- lib/purple_air_api/V1/errors.rb
|
@@ -72,8 +101,8 @@ licenses:
|
|
72
101
|
- MIT
|
73
102
|
metadata:
|
74
103
|
homepage_uri: https://github.com/dkiselbach/purple_air_api
|
75
|
-
source_code_uri: https://github.com/dkiselbach/purple_air_api
|
76
|
-
changelog_uri: https://github.com/dkiselbach/purple_air_api
|
104
|
+
source_code_uri: https://github.com/dkiselbach/purple_air_api
|
105
|
+
changelog_uri: https://github.com/dkiselbach/purple_air_api
|
77
106
|
post_install_message:
|
78
107
|
rdoc_options: []
|
79
108
|
require_paths:
|
@@ -92,5 +121,5 @@ requirements: []
|
|
92
121
|
rubygems_version: 3.2.3
|
93
122
|
signing_key:
|
94
123
|
specification_version: 4
|
95
|
-
summary: This is
|
124
|
+
summary: This is a Ruby wrapper for the PurpleAir API.
|
96
125
|
test_files: []
|