restclient_api_base 0.0.2 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0e7611148ac41483a29424a93722a812e6145f8
4
- data.tar.gz: 67e70e6fbcfe73146b35638a26a5aaa42bacbb9c
3
+ metadata.gz: 0f37578421aecd27d6f939f82c77d6ac8f721bee
4
+ data.tar.gz: daed8a77e784369d4448da6d9b5aa34eb365e933
5
5
  SHA512:
6
- metadata.gz: ec04065543d39890702faf28564ade8cf3d8a4dc922af9d4ad20766979897103f35eaa0147b0dc362d0ba09d055b0f579f68a8cf820356f9e2839ec5162e52d4
7
- data.tar.gz: 4b655321c95e2796e37ab18a14024821039e8cd0d46213ce649be9811cbf3ec1fe48849e4061a8d2d9acfb84944c7c1b2dd264b6e8f586aa94c2c8d190cbd283
6
+ metadata.gz: c5d7deb987ae63e4e30fb09641f136d38586299b05695bf894caaaedabf3efcd0a71d2fd0e2a9c54ed07dd071a00dc49974d684d4694179a946c9593fc99c54f
7
+ data.tar.gz: dbc5f5c348bc3c5753e086b80d1e6b7d871e6e2371be4adc42bd81932a593f7f6f3f3ac95774985a208027d8d6700cffcd916bb9ef9601608e32398532733141
data/README.md CHANGED
@@ -34,9 +34,13 @@ module A
34
34
  self.private_params = { key: 'api_key' } # define app secret key
35
35
  end
36
36
 
37
- A.get('/api/xxx', key_1: value_1, key_2: value_2) # => { response: json_response }
38
- A.post('/api/xxx', key_1: value_1, key_2: value_2)
39
- A.patch('/api/xxx', key_1: value_1, key_2: value_2)
37
+ res = A.get('/api/xxx', key_1: value_1, key_2: value_2) # => { response: json_response }
38
+ res.code # => 200
39
+ res.cookies # => { 'key' => 'value' }
40
+ res.headers # => {:content_type=>"text/html; charset=utf-8", :cache_control=>"private" ...
41
+
42
+ res = A.post('/api/xxx', key_1: value_1, key_2: value_2)
43
+ res = A.patch('/api/xxx', key_1: value_1, key_2: value_2)
40
44
  ```
41
45
 
42
46
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module RestclientApiBase
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -35,7 +35,7 @@ module RestclientApiBase
35
35
  )
36
36
  end
37
37
 
38
- def patch api_url, query = {}
38
+ def patch api_url, query = {}, headers = {}
39
39
  res = RestClient.patch(
40
40
  base_url + api_url,
41
41
  JSON.generate(private_params.merge(query)),
@@ -43,7 +43,7 @@ module RestclientApiBase
43
43
  )
44
44
  end
45
45
 
46
- def put api_url, query = {}
46
+ def put api_url, query = {}, headers = {}
47
47
  res = RestClient.put(
48
48
  base_url + api_url,
49
49
  JSON.generate(private_params.merge(query)),
@@ -15,6 +15,9 @@ class TestRestclientApiBase < Minitest::Test
15
15
 
16
16
  def test_get
17
17
  list = TestClient.get(@list_url)
18
+ assert_equal 200, list.code, 'the http status code is 200'
19
+ assert_equal "application/json; charset=utf-8", list.headers[:content_type]
20
+ assert list.cookies
18
21
  assert_equal true, JSON.parse(list).is_a?(Array)
19
22
  end
20
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restclient_api_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spirit
@@ -67,7 +67,7 @@ files:
67
67
  - lib/concern.rb
68
68
  - lib/restclient_api_base.rb
69
69
  - lib/restclient_api_base/version.rb
70
- - restclinet_api_base.gemspec
70
+ - restclient_api_base.gemspec
71
71
  - test/test_helper.rb
72
72
  - test/test_restclient_api_base.rb
73
73
  homepage: https://github.com/NaixSpirit/restclient_api_base