magicbell 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/magicbell/api_operations.rb +14 -13
- data/lib/magicbell/api_resource.rb +4 -4
- data/lib/magicbell/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c41d47dfcb956fd6ce283573619aafe27c5dc8ecae3db01807ae442afce912
|
4
|
+
data.tar.gz: 6dc6769e62c3b105a675854ccb0ea683f01b425a5d3fc1836fd962f1e370b9fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24b81b3179c672118ac6550a80c8e28bfdb73c293b9f96a1c8ca88e7836c36157eed6ab8fa5d7850199674cdc81770ab237dc5218c28d637f281c787e04b093f
|
7
|
+
data.tar.gz: edb2e6dcdc5e5827b55d4a75067c386a6278dddf52d70ea614657a47a7abcbcccef47e3255ef0918a8af4bbd053f888861a420989db248b5e37ee3d94083f784
|
@@ -1,39 +1,40 @@
|
|
1
1
|
module MagicBell
|
2
2
|
module ApiOperations
|
3
3
|
def get(url, options = {})
|
4
|
-
|
5
|
-
|
6
|
-
options.merge(headers: authentication_headers)
|
7
|
-
)
|
4
|
+
defaults = { headers: default_headers }
|
5
|
+
response = HTTParty.get(url, options.merge(defaults))
|
8
6
|
raise_http_error_unless_2xx_response(response)
|
9
7
|
|
10
8
|
response
|
11
9
|
end
|
12
10
|
|
13
11
|
def post(url, options = {})
|
14
|
-
|
15
|
-
|
16
|
-
options.merge(headers: authentication_headers)
|
17
|
-
)
|
12
|
+
defaults = { headers: default_headers }
|
13
|
+
response = HTTParty.post(url, options.merge(defaults))
|
18
14
|
raise_http_error_unless_2xx_response(response)
|
19
15
|
|
20
16
|
response
|
21
17
|
end
|
22
18
|
|
23
19
|
def put(url, options = {})
|
24
|
-
|
25
|
-
|
26
|
-
options.merge(headers: authentication_headers)
|
27
|
-
)
|
20
|
+
defaults = { headers: default_headers }
|
21
|
+
response = HTTParty.put(url, options.merge(defaults))
|
28
22
|
raise_http_error_unless_2xx_response(response)
|
29
23
|
|
30
24
|
response
|
31
25
|
end
|
32
26
|
|
27
|
+
protected
|
28
|
+
|
29
|
+
def default_headers
|
30
|
+
authentication_headers.merge({ "Content-Type" => "application/json", "Accept"=> "application/json" })
|
31
|
+
end
|
32
|
+
|
33
33
|
private
|
34
34
|
|
35
35
|
def raise_http_error_unless_2xx_response(response)
|
36
36
|
return if response.success?
|
37
|
+
|
37
38
|
e = MagicBell::Client::HTTPError.new
|
38
39
|
e.response_status = response.code
|
39
40
|
e.response_headers = response.headers.to_h
|
@@ -41,4 +42,4 @@ module MagicBell
|
|
41
42
|
raise e
|
42
43
|
end
|
43
44
|
end
|
44
|
-
end
|
45
|
+
end
|
@@ -79,7 +79,7 @@ module MagicBell
|
|
79
79
|
response = @client.post(
|
80
80
|
create_url,
|
81
81
|
body: { name => attributes }.to_json,
|
82
|
-
headers:
|
82
|
+
headers: extra_headers
|
83
83
|
)
|
84
84
|
parse_response(response)
|
85
85
|
|
@@ -90,7 +90,7 @@ module MagicBell
|
|
90
90
|
response = @client.put(
|
91
91
|
url,
|
92
92
|
body: new_attributes.to_json,
|
93
|
-
headers:
|
93
|
+
headers: extra_headers
|
94
94
|
)
|
95
95
|
parse_response(response)
|
96
96
|
|
@@ -99,8 +99,8 @@ module MagicBell
|
|
99
99
|
|
100
100
|
protected
|
101
101
|
|
102
|
-
def
|
103
|
-
|
102
|
+
def extra_headers
|
103
|
+
{}
|
104
104
|
end
|
105
105
|
|
106
106
|
private
|
data/lib/magicbell/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magicbell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hana Mohan
|
8
8
|
- Nisanth Chunduru
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -143,7 +143,7 @@ homepage: https://magicbell.io
|
|
143
143
|
licenses:
|
144
144
|
- MIT
|
145
145
|
metadata: {}
|
146
|
-
post_install_message:
|
146
|
+
post_install_message:
|
147
147
|
rdoc_options: []
|
148
148
|
require_paths:
|
149
149
|
- lib
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubygems_version: 3.1.4
|
162
|
-
signing_key:
|
162
|
+
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Ruby wrapper for MagicBell.io
|
165
165
|
test_files: []
|