rapiflash 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rapiflash.rb +10 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59075b570774504cd43b5e0f7a9f3aaea6abc753
4
- data.tar.gz: b5d77738b83cb5e095a62bd8db02bc8c8a79a1c2
3
+ metadata.gz: ff3143b599fd16526c3937ce0650924fef35e96c
4
+ data.tar.gz: c5e802a6358247de745fd85c34da90101a083106
5
5
  SHA512:
6
- metadata.gz: 750d02a01c7966bcda01b20f62d1e9bdfb143562fa6bd3a6e1078c80a3fec976c0c687f370ad558fc0cec3745c19213ee511bc3018902fbbdcd6c3baa86f82f0
7
- data.tar.gz: 6baa11b0a1f809536786f97745a63a76eb72e91d4cb76a12b940a53795031f4a483cc0060959abb26c0ce68dcc09a48f5746dceea088f59a087e1b7318e7b6d3
6
+ metadata.gz: 8945e1114080d679288b3b94a269b123dcafd7a9772f730b9742fbf44d612709a834d3280411f3ea79296c958b639dfeb885718a4e975b56c68b097f330b3742
7
+ data.tar.gz: 141a3e4bb25a870ed106f645defb5d5737019b525405bc9b97b24ada84314e379c89d4d7030aa6f752b4e5d8460769e450e56a3c754b86a8311bf8a3b8225fe9
data/lib/rapiflash.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
+ require 'net/http'
3
4
 
4
- API_URL = "http://api.devinmui.c9.io/api/v1/"
5
+ API_URL = "http://api.devinmui.c9.io/api/v1"
5
6
 
6
7
  class Flood
7
8
  attr_reader :id, :normal_level, :current_level, :flooded, :upstream, :location, :created_at, :updated_at
@@ -20,9 +21,17 @@ class Flood
20
21
  attributes = JSON.parse(response.body)
21
22
  new(attributes)
22
23
  end
24
+
25
+ def self.create_data(normal_level,current_level,flooded,location,upstream)
26
+ response = Faraday.post "#{API_URL}/floods", {flood: {current_level: current_level, normal_level: normal_level, flooded: flooded, location: location, upstream: upstream}}
27
+ return response.body
28
+ end
29
+
23
30
  def self.all
24
31
  response = Faraday.get("#{API_URL}/floods")
25
32
  flood = JSON.parse(response.body)
26
33
  flood.map { |attributes| new(attributes) }
27
34
  end
28
35
  end
36
+
37
+ # postData = Net::HTTP.post_form(URI.parse('#{API_URL}/floods/'), {"flood" => {'current_level' => 9002, 'normal_level' => 9001, 'flooded' => true, 'location' => "SF", 'upstream' => 5}})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapiflash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devin Mui