external_api_service 0.2.0 → 0.2.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 +4 -4
- data/README.md +6 -6
- data/external_api_service.gemspec +1 -1
- data/lib/external_api_service.rb +8 -6
- data/lib/external_api_service/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adb4d532f3a42a420f80c09718655aa56aa5ee5d
|
4
|
+
data.tar.gz: 50eb6ad643c82d3fb66120d8bdf3a1849b1b6e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86e71820d4721786c77b5aacae3367971fd4fe51d79defdd509b53fba9ee9af05f53c58f5f1c2267972cf5946f409236ce8880646135dc98faf9bef04b394b3
|
7
|
+
data.tar.gz: b0866851c5fe0a6e42aaad572efaa7d6f3edc0f757f75f35494a92617fdcd069924cc2c781aaeb3951ae6d2189a25d83f99a044731c8d7676d78d65840ccbe3a
|
data/README.md
CHANGED
@@ -55,12 +55,12 @@ The endpoint must accept and return `JSON`.
|
|
55
55
|
There is a header param available, but it is optional, and `Net/HTTP` handles most of it behind the scenes.
|
56
56
|
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
#example: Add a subscriber to your Mailchimp Account (Api V3)
|
59
|
+
auth = {'api_key': '123key'}
|
60
|
+
optional_header = {}
|
61
|
+
data_to_post: {'email' => 'example.email@example.com', 'status' => 'subscribed'}
|
62
|
+
endpoint = 'https://us9.api.mailchimp.com/3.0/lists/123uniquelistID/members'
|
63
|
+
ExternalApiService.post_service(endpoint, data_to_post, auth, optional_header)
|
64
64
|
|
65
65
|
Note:
|
66
66
|
You have to have the trailing '/' for the path for Ruby to POST properly e.g. http://sample.com/ (I think)
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = ExternalApiService::VERSION
|
9
9
|
spec.authors = ["nrakochy"]
|
10
10
|
spec.email = ["nick.rakochy@gmail.com"]
|
11
|
-
spec.summary = %q{Make a GET request to an external endpoint using only Ruby standard lib - No external dependencies}
|
11
|
+
spec.summary = %q{Make a GET or POST request to an external endpoint using only Ruby standard lib - No external dependencies}
|
12
12
|
|
13
13
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
14
14
|
# delete this section to allow pushing this gem to any host.
|
data/lib/external_api_service.rb
CHANGED
@@ -30,13 +30,15 @@ module ExternalApiService
|
|
30
30
|
#
|
31
31
|
# @return Will transform the JSON to Ruby Hash with symbolized names
|
32
32
|
#
|
33
|
-
# @example
|
34
|
-
# auth = {"api_key": "123key"}
|
35
|
-
# data_to_post: {sample_data: "sample"}
|
36
|
-
# ExternalApiService.post_service("sample_endpoint", data_to_post, auth)
|
37
33
|
#
|
38
|
-
#
|
39
|
-
#
|
34
|
+
# @example Add a subscriber to your Mailchimp Account (Api V3)
|
35
|
+
# auth = {'api_key': '123key'}
|
36
|
+
# optional_header = {}
|
37
|
+
# data_to_post: {'email' => 'example.email@example.com', 'status' => 'subscribed'}
|
38
|
+
# endpoint = 'https://us9.api.mailchimp.com/3.0/lists/123uniquelistID/members'
|
39
|
+
# ExternalApiService.post_service(endpoint, data_to_post, auth, optional_header)
|
40
|
+
#
|
41
|
+
# @note You have to have the trailing '/' for the path for Ruby to POST properly e.g. http://sample.com/
|
40
42
|
|
41
43
|
def self.post_service(url, data_to_post, credentials, http_header_params = {})
|
42
44
|
credentials_formatted_for_auth = credentials.to_a.flatten
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: external_api_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nrakochy
|
@@ -138,7 +138,7 @@ rubyforge_project:
|
|
138
138
|
rubygems_version: 2.4.5
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
|
-
summary: Make a GET request to an external endpoint using only Ruby standard
|
142
|
-
No external dependencies
|
141
|
+
summary: Make a GET or POST request to an external endpoint using only Ruby standard
|
142
|
+
lib - No external dependencies
|
143
143
|
test_files: []
|
144
144
|
has_rdoc:
|