appfuel 0.3.3 → 0.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af037c6964ab5d3678d25a21fd3720d2f42eeee3
4
- data.tar.gz: 6577915f690254b9ce059dcb3f7a5e7feaa1b2c7
3
+ metadata.gz: beefc3a9ec7594370a31fe42de16d6b109d90279
4
+ data.tar.gz: 8e4f95b742475e7a91239708ce8f3f81707e7b3a
5
5
  SHA512:
6
- metadata.gz: cc08d5a31a3dacf9013422a17601de677d8c19af1382a98ab75a8a42bda808cb5925e2bbfc1d4cf425f7ef35ce5f3b5e49ebbc88dbebd5439fbd59fff1183b7f
7
- data.tar.gz: a6e29c028be12d171f45a66d31b4085d95db68977986e3f8dc308418b5bca69c0f68e97514988b571684a7ae9e241c8563445d8f343596ca96069f2d3c5e00f3
6
+ metadata.gz: fabfb619c581c0ddc07404061e7b336d80aa846c181ec362891cf823fe0b656dca7f5908e86125b726e43ac5e8d4af809190e83f331e8b787dd4204e56b44c47
7
+ data.tar.gz: f56daa9f43805b1572a853655abb43ca367dd605423f1cfe4be250ce13b400e683533a46718d05425b833e8ec780a1613a77035366ecd188a92588489ed8cc43
data/CHANGELOG.md CHANGED
@@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file. (Pending ap
5
5
 
6
6
 
7
7
  # Releases
8
- ## [[0.3.3]](https://github.com/rsb/appfuel/releases/tag/0.3.2) 2017-06-20
8
+ ## [[0.3.4]](https://github.com/rsb/appfuel/releases/tag/0.3.4) 2017-06-20
9
+ ### Changed
10
+ - `web api model` changed `url` to `uri`
11
+ ### Added
12
+ - `web api model` added `url` method to create full endpoint with path
13
+ - `web api model` added `get` and `post` to wrap rest-client interface
14
+
15
+ ## [[0.3.3]](https://github.com/rsb/appfuel/releases/tag/0.3.3) 2017-06-20
9
16
  ### Added
10
17
  - `storage_hash` method to general mapper
11
18
 
@@ -43,17 +43,38 @@ module Appfuel
43
43
  end
44
44
  end
45
45
 
46
- attr_reader :config, :url, :adapter
46
+ attr_reader :config, :uri, :adapter, :content_type
47
47
 
48
48
  def initialize
49
49
  @config = self.class.load_config
50
50
  unless @config.key?(:url)
51
51
  fail "[web_api initialize] config is missing :url"
52
52
  end
53
- @url = URI(@config[:url])
53
+ @uri = URI(@config[:url])
54
54
  @adapter = self.class.load_http_adapter
55
55
  end
56
56
 
57
+ def url(path)
58
+ uri.to_s + "/#{path}"
59
+ end
60
+
61
+ def get(path, options = {})
62
+ add_content_type(options)
63
+ adapter.get(url(path), options)
64
+ end
65
+
66
+ def post(path, params = {}, options = {})
67
+ add_content_type(options)
68
+ adapter.post(url(path), params, options)
69
+ end
70
+
71
+ private
72
+
73
+ def add_content_type(options)
74
+ if content_type && !options.key?(:content_type)
75
+ options[:content_type] = content_type
76
+ end
77
+ end
57
78
  end
58
79
  end
59
80
  end
@@ -1,3 +1,3 @@
1
1
  module Appfuel
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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.3.3
4
+ version: 0.3.4
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-06-20 00:00:00.000000000 Z
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord