rwrk 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rwrk.rb +49 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ddfc5fb021f96b40cac2118bb0b3c9e336dc901b43643bdc56c388d945a5a23
4
- data.tar.gz: 1c18dd234b06a13de375eb26a339ce82c3c4c0a9d3368c63802dc5ffe7688c7f
3
+ metadata.gz: '099ceaa0b400a7495564eaae94c6e56b2103b581ee77c26058cf1a37daa76a7d'
4
+ data.tar.gz: dc471a7d402a0853a956fb31e67ffa7fa85847622579510888272b4ae074416e
5
5
  SHA512:
6
- metadata.gz: ab343c19c400490ad3034d6c76e64f418122389c69f5e806926124efa0161e520fe4c5655b433f8ccef2d5e1feb4662da4d92d8752e8ea228a294a0c77225767
7
- data.tar.gz: 6ae92ff0115ea1d33f759d5f1f4fc22e01f95b358ce4c97c44677a45ee0ef061f5f0eff6100ba963161de44f4626bff4f1c11140f1f62fd25d2131255cdab568
6
+ metadata.gz: 51c0d0fa804a2923141ab391844072e7a7d3133ce62e24a3359530f2e47d36c72b413939d9ea313e34eb32df62adff77b2cbe0107e80ce249cf3de01a6dec562
7
+ data.tar.gz: c4daba537665aa0807ced9b8d790f0e5c99237654c6b2b970f259fbb8eb5738818d8a9bfa652798229cb2e01d725eb012ac7571b18c8562e4ed791158bb38402
data/lib/rwrk.rb CHANGED
@@ -1,5 +1,50 @@
1
- class Rwrk
2
- def self.hi
3
- puts "hello world"
1
+ require 'HTTP'
2
+
3
+ class Building
4
+ attr_reader :id, :name, :address, :height, :construction_date, :architect
5
+
6
+ def initialize(input_options)
7
+ @id = input_options["id"]
8
+ @name = input_options["name"]
9
+ @address = input_options["address"]
10
+ @height = input_options["height"]
11
+ @construction_date = input_options["construction_date"]
12
+ @architect = input_options["architect"]
4
13
  end
5
- end
14
+
15
+ def self.all
16
+ response = HTTP.get("http://localhost:3000/api/buildings")
17
+ response.parse.map do |data|
18
+ Building.new(data)
19
+ end
20
+ end
21
+
22
+ def self.create(input_options)
23
+ response = HTTP.post(
24
+ "http://localhost:3000/api/buildings",
25
+ form: input_options
26
+ )
27
+ Building.new(response.parse)
28
+ end
29
+
30
+ def self.find(input_id)d
31
+ response = HTTP.get("http://localhost:3000/api/buildings/#{input_id}")
32
+ Building.new(response.parse)
33
+ end
34
+
35
+ def update(input_options)
36
+ response = HTTP.patch(
37
+ "http://localhost:3000/api/buildings/#{self.id}",
38
+ form: input_options
39
+ )
40
+ Building.new(response.parse)
41
+ end
42
+
43
+ def destroy
44
+ response = HTTP.delete("http://localhost:3000/api/buildings/#{self.id}")
45
+ end
46
+
47
+ def self.test
48
+ p "YEAH BUDDY"
49
+ end
50
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwrk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Whitehead