rapiflash 0.1.0
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 +7 -0
- data/lib/rapiflash.rb +28 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 59075b570774504cd43b5e0f7a9f3aaea6abc753
|
4
|
+
data.tar.gz: b5d77738b83cb5e095a62bd8db02bc8c8a79a1c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 750d02a01c7966bcda01b20f62d1e9bdfb143562fa6bd3a6e1078c80a3fec976c0c687f370ad558fc0cec3745c19213ee511bc3018902fbbdcd6c3baa86f82f0
|
7
|
+
data.tar.gz: 6baa11b0a1f809536786f97745a63a76eb72e91d4cb76a12b940a53795031f4a483cc0060959abb26c0ce68dcc09a48f5746dceea088f59a087e1b7318e7b6d3
|
data/lib/rapiflash.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
API_URL = "http://api.devinmui.c9.io/api/v1/"
|
5
|
+
|
6
|
+
class Flood
|
7
|
+
attr_reader :id, :normal_level, :current_level, :flooded, :upstream, :location, :created_at, :updated_at
|
8
|
+
def initialize(attributes)
|
9
|
+
@id = attributes["id"]
|
10
|
+
@normal_level = attributes["normal_level"]
|
11
|
+
@current_level = attributes["current_level"]
|
12
|
+
@flooded = attributes["flooded"]
|
13
|
+
@upstream = attributes["upstream"]
|
14
|
+
@location = attributes["location"]
|
15
|
+
@created_at = attributes["created_at"]
|
16
|
+
@updated_at = attributes["updated_at"]
|
17
|
+
end
|
18
|
+
def self.find(id)
|
19
|
+
response = Faraday.get("#{API_URL}/floods/#{id}")
|
20
|
+
attributes = JSON.parse(response.body)
|
21
|
+
new(attributes)
|
22
|
+
end
|
23
|
+
def self.all
|
24
|
+
response = Faraday.get("#{API_URL}/floods")
|
25
|
+
flood = JSON.parse(response.body)
|
26
|
+
flood.map { |attributes| new(attributes) }
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rapiflash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Devin Mui
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2010-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This gem is a wrapper of the Rapiflash API and allows developers to gather
|
42
|
+
data from Rapiflash devices around the world.
|
43
|
+
email: devinmui@yahoo.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/rapiflash.rb
|
49
|
+
homepage:
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.4.3
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Wraps Rapiflash API into a Ruby gem
|
73
|
+
test_files: []
|