bb_buildings_gem 0.0.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 +7 -0
- data/lib/bb_buildings_gem.rb +49 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8d2ae81d150f5c9b5b6be35354cbc2e15543e19003beea33fa2de9e0bc79d89f
|
|
4
|
+
data.tar.gz: ce1a79d77524ab54d274ee25ce5c8b0404d472e8f8216707e18e78b5de0f0d72
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bd69d3e93311b942093f19a3a5786a9f9d7e33e8ca0af3695cdac4b4cfca1edb6295a77201f893cb0d65d10e99a3981497724e059b05f1be75c02db067dacd16
|
|
7
|
+
data.tar.gz: 5f56d8eb7e83ff76e9e4bfc7ebc7b2789f0c33db917ad06b0ff9e598d8631ec007ce539933f93208ca924cdd8d661355b3fdd8dc25822a3f09b5b9d9d9ce9484
|
|
@@ -0,0 +1,49 @@
|
|
|
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"]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.all # index action
|
|
16
|
+
response = HTTP.get("http://localhost:3000/api/buildings")
|
|
17
|
+
building_array = []
|
|
18
|
+
|
|
19
|
+
response.parse.each do |building_hash|
|
|
20
|
+
building_array << Building.new(building_hash)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
building_array
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.find(input_id) # show action
|
|
27
|
+
response = HTTP.get("http://localhost:3000/api/buildings/#{input_id}")
|
|
28
|
+
Building.new(response.parse)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.create(input_options) # create action
|
|
32
|
+
response = HTTP.post("http://localhost:3000/api/buildings",
|
|
33
|
+
form: input_options
|
|
34
|
+
)
|
|
35
|
+
Building.new(response.parse)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def update(input_options) # edit
|
|
39
|
+
response = HTTP.patch(
|
|
40
|
+
"http://localhost:3000/api/buildings/#{id}",
|
|
41
|
+
form: input_options
|
|
42
|
+
)
|
|
43
|
+
@id = response.parse["id"]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def destroy # destroy
|
|
47
|
+
response = HTTP.delete("http://localhost:3000/api/buildings/#{self.id}")
|
|
48
|
+
end
|
|
49
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bb_buildings_gem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Chris Bowen
|
|
8
|
+
- Jeff Brinker
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: I will choose bb_buildings_gem!
|
|
15
|
+
email: brinker.jeff@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/bb_buildings_gem.rb
|
|
21
|
+
homepage: https://rubygems.org/gems/bb_buildings_gem
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.0.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: bb_buildings_gem!
|
|
44
|
+
test_files: []
|