appfuel 0.6.1 → 0.6.3
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/CHANGELOG.md +9 -0
- data/lib/appfuel/storage/dynamodb/adapter.rb +5 -0
- data/lib/appfuel/storage/web_api/http_model.rb +29 -12
- data/lib/appfuel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdb23ba841ae6e72df581ea7170a59ffa443310b
|
4
|
+
data.tar.gz: 3ad6fcc67ee5328cd589cd48113e75554c63f211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a5670824c5e474474093af8720271cbe90be0fe2ed489dbf90adf61705d186a7acf2e13ca4107e90a25b6ff2592e30b8d44b17719d0e578d4b8e28425aec834
|
7
|
+
data.tar.gz: 519aeea32b5dfc40e4fad5128d8a5783e32edd06d09e4694c87ad33a9a34e15ebf650b67a30dc3a8636a0036a0be9edbff0452fbcea72fc9e2c6290424f9a74f
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. (Pending ap
|
|
5
5
|
|
6
6
|
|
7
7
|
# Releases
|
8
|
+
## [[0.6.3]](https://github.com/rsb/appfuel/releases/tag/0.6.3) 2017-08-14
|
9
|
+
### Fixed
|
10
|
+
- invalid method is web_api/http_model when checking url
|
11
|
+
|
12
|
+
## [[0.6.2]](https://github.com/rsb/appfuel/releases/tag/0.6.2) 2017-08-14
|
13
|
+
### Fixed
|
14
|
+
- storage/repository/web_api/http_model missing check for url '/' when
|
15
|
+
appending relative paths
|
16
|
+
|
8
17
|
## [[0.6.0]](https://github.com/rsb/appfuel/releases/tag/0.6.0) 2017-08-10
|
9
18
|
### Added
|
10
19
|
- Validation to handlers
|
@@ -146,6 +146,11 @@ module Appfuel
|
|
146
146
|
result.item
|
147
147
|
end
|
148
148
|
|
149
|
+
def scan(params = {})
|
150
|
+
params[:table_name] = table_name
|
151
|
+
client.scan(params)
|
152
|
+
end
|
153
|
+
|
149
154
|
def get_item(hash_value, range_value = nil)
|
150
155
|
params = table_params(hash_value, range_value)
|
151
156
|
client.get_item(params)
|
@@ -24,10 +24,6 @@ module Appfuel
|
|
24
24
|
config[config_key]
|
25
25
|
end
|
26
26
|
|
27
|
-
def load_http_adapter
|
28
|
-
RestClient
|
29
|
-
end
|
30
|
-
|
31
27
|
def inherited(klass)
|
32
28
|
stage_class_for_registration(klass)
|
33
29
|
end
|
@@ -35,17 +31,18 @@ module Appfuel
|
|
35
31
|
|
36
32
|
attr_reader :config, :uri, :adapter, :content_type
|
37
33
|
|
38
|
-
def initialize
|
39
|
-
@config =
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
@uri = URI(@config[:url])
|
44
|
-
@adapter = self.class.load_http_adapter
|
34
|
+
def initialize(adapter = RestClient, config = self.class.load_config)
|
35
|
+
@config = validate_config(config)
|
36
|
+
@uri = create_uri(@config[:url])
|
37
|
+
@adapter = adapter
|
45
38
|
end
|
46
39
|
|
47
40
|
def url(path)
|
48
|
-
|
41
|
+
if path.start_with?("/")
|
42
|
+
path.slice!(0)
|
43
|
+
end
|
44
|
+
|
45
|
+
uri.to_s + "#{path}"
|
49
46
|
end
|
50
47
|
|
51
48
|
def request(method, path, options = {})
|
@@ -93,6 +90,26 @@ module Appfuel
|
|
93
90
|
|
94
91
|
private
|
95
92
|
|
93
|
+
def validate_config(data)
|
94
|
+
unless data.respond_to?(:to_h)
|
95
|
+
fail "[web_api adapter] config must implement :to_h"
|
96
|
+
end
|
97
|
+
|
98
|
+
data = data.to_h
|
99
|
+
unless data.key?(:url)
|
100
|
+
fail "[web_api adapter] config is missing :url"
|
101
|
+
end
|
102
|
+
data
|
103
|
+
end
|
104
|
+
|
105
|
+
def create_uri(api_url)
|
106
|
+
unless api_url.end_with?("/")
|
107
|
+
api_url = "#{api_url}/"
|
108
|
+
end
|
109
|
+
|
110
|
+
URI(api_url)
|
111
|
+
end
|
112
|
+
|
96
113
|
def add_content_type(options)
|
97
114
|
options[:headers] ||= {}
|
98
115
|
if content_type && !options[:headers].key?(:content_type)
|
data/lib/appfuel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Scott-Buccleuch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|