ninja_van 1.0.1 → 1.0.2
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/lib/ninja_van/request.rb +6 -4
- data/lib/ninja_van/version.rb +1 -1
- data/lib/ninja_van.rb +0 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24cf8abca79243b87cd06e79481b85b96777e1c7e36361635463dfe8a259cc8b
|
4
|
+
data.tar.gz: 2950dd4e494f3c80116717c0c3495096d0f6b066fdbb93684e9cdce6e9e88c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e101edfb951230b42b63d2564c68b63f48f80875e32856b40e92fde5b5132b93d068e0c564be5087d4057febf2ddd4b05439ad92e5b5af43dc0581c0fffba86
|
7
|
+
data.tar.gz: 66cb594484960dc377fe76da10aebfed0c5bd4b34fdd92c9d86dff3877079e68057c09647d4f483b3643d8fa00650c34a1b20ea858ea3ae439dd400d9d9afe03
|
data/lib/ninja_van/request.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
require "http"
|
2
|
+
|
1
3
|
module NinjaVan
|
2
4
|
class Request
|
3
5
|
|
4
6
|
def self.post(endpoint, params={})
|
5
7
|
full_endpoint = "#{NinjaVan.setup.require!(:domain)}#{endpoint}"
|
6
|
-
response =
|
8
|
+
response = HTTP.headers(content_type: 'application/json', accept: 'application/json')
|
7
9
|
.auth("Bearer #{NinjaVan.setup.get_token_from_cache}")
|
8
10
|
.post(full_endpoint, json: params)
|
9
11
|
raise NinjaVan::ForbiddenError.new(full_endpoint) if response.code == 403
|
@@ -14,7 +16,7 @@ module NinjaVan
|
|
14
16
|
|
15
17
|
def self.post_without_token(endpoint, params={})
|
16
18
|
full_endpoint = "#{NinjaVan.setup.require!(:domain)}#{endpoint}"
|
17
|
-
response =
|
19
|
+
response = HTTP.headers(content_type: 'application/json', accept: 'application/json')
|
18
20
|
.post(full_endpoint, json: params)
|
19
21
|
raise NinjaVan::ForbiddenError.new(full_endpoint) if response.code == 403
|
20
22
|
raise NinjaVan::ServerError.new(full_endpoint) if response.code == 500
|
@@ -24,7 +26,7 @@ module NinjaVan
|
|
24
26
|
|
25
27
|
def self.get(endpoint, params={})
|
26
28
|
full_endpoint = "#{NinjaVan.setup.require!(:domain)}#{endpoint}"
|
27
|
-
response =
|
29
|
+
response = HTTP.headers(content_type: 'application/json', accept: 'application/json')
|
28
30
|
.auth("Bearer #{NinjaVan.setup.get_token_from_cache}")
|
29
31
|
.get(full_endpoint, params: params)
|
30
32
|
raise NinjaVan::ForbiddenError.new(full_endpoint) if response.code == 403
|
@@ -35,7 +37,7 @@ module NinjaVan
|
|
35
37
|
|
36
38
|
def self.delete(endpoint, params={})
|
37
39
|
full_endpoint = "#{NinjaVan.setup.require!(:domain)}#{endpoint}"
|
38
|
-
response =
|
40
|
+
response = HTTP.headers(content_type: 'application/json', accept: 'application/json')
|
39
41
|
.auth("Bearer #{NinjaVan.setup.get_token_from_cache}")
|
40
42
|
.delete(full_endpoint, params: params)
|
41
43
|
raise NinjaVan::ForbiddenError.new(full_endpoint) if response.code == 403
|
data/lib/ninja_van/version.rb
CHANGED
data/lib/ninja_van.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja_van
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KhoaRB
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ metadata:
|
|
105
105
|
bug_tracker_uri: https://github.com/ThanhKhoaIT/ninja_van/issues
|
106
106
|
wiki_uri: https://github.com/ThanhKhoaIT/ninja_van/wiki
|
107
107
|
changelog_uri: https://github.com/ThanhKhoaIT/ninja_van/releases
|
108
|
-
post_install_message:
|
108
|
+
post_install_message:
|
109
109
|
rdoc_options: []
|
110
110
|
require_paths:
|
111
111
|
- lib
|
@@ -120,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
|
124
|
-
|
125
|
-
signing_key:
|
123
|
+
rubygems_version: 3.2.3
|
124
|
+
signing_key:
|
126
125
|
specification_version: 4
|
127
126
|
summary: NinjaVan API Caller for Ruby
|
128
127
|
test_files: []
|