business-central 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a9fce53948fe9fcc7fead040e9f2a3c11df882dc59ebe5db8add78fe4b9c396
|
4
|
+
data.tar.gz: 34c62baa8d371b776fae566c97c935467c7c3ee86cd2d3d36c4a22824257c16e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d2acefa8f9086e59343fa0d25ff74f3c9782f20ac719983c5fcbc958ccaaf15fdd1ff28c9defd087d096ed89eb4ecc990c2a1e5e815f24f49217defba06fae3
|
7
|
+
data.tar.gz: f0978a52503c33b618a8d8a6df09c112dc0d4457c3665d67945de478d8ceb5e5e84a9b216d8190f016be62da92b2e5d521890f0532bc4a4d0bd1ee69aa91edfa
|
@@ -4,7 +4,7 @@ module BusinessCentral
|
|
4
4
|
module Object
|
5
5
|
module URLHelper
|
6
6
|
def encode_url_object(object)
|
7
|
-
URI.
|
7
|
+
URI::RFC2396_Parser.new.escape(object)
|
8
8
|
end
|
9
9
|
|
10
10
|
def encode_url_params(query)
|
@@ -21,6 +21,18 @@ module BusinessCentral
|
|
21
21
|
|
22
22
|
def replace_template_with_value(query, values)
|
23
23
|
query = query.dup
|
24
|
+
return replace_template_with_hash_values(query, values) if values.first.is_a?(Hash)
|
25
|
+
replace_template_with_array_values(query, values)
|
26
|
+
end
|
27
|
+
|
28
|
+
def replace_template_with_hash_values(query, values)
|
29
|
+
values.first.each do |key, value|
|
30
|
+
query.gsub!(/:#{key}/, odata_encode(value))
|
31
|
+
end
|
32
|
+
query
|
33
|
+
end
|
34
|
+
|
35
|
+
def replace_template_with_array_values(query, values)
|
24
36
|
query.scan(/\?/).each_with_index do |_character, index|
|
25
37
|
character_position = query =~ /\?/
|
26
38
|
query[character_position] = odata_encode(values[index])
|
@@ -43,4 +43,9 @@ class BusinessCentral::Object::ResponseTest < Minitest::Test
|
|
43
43
|
request = BusinessCentral::Object::Response.new(params).results
|
44
44
|
assert request.key?(:item)
|
45
45
|
end
|
46
|
+
|
47
|
+
def test_string_response
|
48
|
+
response = BusinessCentral::Object::Response.new('{ "value": "OK - Action was successful" }')
|
49
|
+
assert_equal 'OK - Action was successful', response.results
|
50
|
+
end
|
46
51
|
end
|
@@ -14,11 +14,16 @@ class BusinessCentral::WebServiceTest < Minitest::Test
|
|
14
14
|
assert_equal @web_service.object_url, 'Company/Vendors'
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def test_build_object_url_with_array_template_values
|
18
18
|
@web_service.object("Company('?')", 'business1')
|
19
19
|
assert_equal @web_service.object_url, "Company('business1')"
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_build_object_url_with_hash_template_values
|
23
|
+
@web_service.object("Company(':business_name')", business_name: 'business1')
|
24
|
+
assert_equal @web_service.object_url, "Company('business1')"
|
25
|
+
end
|
26
|
+
|
22
27
|
def test_object_get_request
|
23
28
|
stub_request(:get, /Company/)
|
24
29
|
.to_return(
|
@@ -92,4 +97,4 @@ class BusinessCentral::WebServiceTest < Minitest::Test
|
|
92
97
|
|
93
98
|
assert @web_service.object("Company('?')", test_company_name).delete
|
94
99
|
end
|
95
|
-
end
|
100
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: business-central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarrad Muir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-focus
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: '1.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: '1.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest-reporters
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.4
|
75
|
+
version: '1.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.4
|
82
|
+
version: '1.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,28 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: '0.21'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: '0.21'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.12'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
124
|
+
version: '3.12'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: oauth2
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|