magentwo 0.1.90 → 0.1.92
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/.gitignore +1 -0
- data/lib/connection.rb +11 -33
- data/lib/magentwo.rb +1 -1
- data/magentwo.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5000157d6397addf74a0ac9fbc01d42c7af210b8503d443ccf957264b854941
|
4
|
+
data.tar.gz: 3ea8f1c1c9888938a287d744362439fb831e5e98a9781c5d3d8057a541ef65ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e8765e7d5e6d46c2f4f121924b7c7d2000c040be71913a935ce40db556409142a58eae31193e8741841952ec07f0cd8831d201e096197de24812d9593e558f
|
7
|
+
data.tar.gz: 0d0a65941d967d699714b717d3e1ca3cfe5c2989cdb371119a079fbc7fa4ca679672c64e81455e07480dcc8449e6e8a3b5c1c529a0c9c4d8a1e15c35602d91c3
|
data/.gitignore
CHANGED
data/lib/connection.rb
CHANGED
@@ -14,7 +14,7 @@ module Magentwo
|
|
14
14
|
@password = password
|
15
15
|
request_token
|
16
16
|
elsif (token)
|
17
|
-
|
17
|
+
@token = token
|
18
18
|
else
|
19
19
|
raise ArgumentError, "expected user/password or token"
|
20
20
|
end
|
@@ -34,13 +34,13 @@ module Magentwo
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
Magentwo.logger.info "
|
37
|
+
def request verb, path:, data:nil
|
38
|
+
Magentwo.logger.info "#{verb.to_s} #{host}/#{base_path}/#{path}"
|
39
39
|
Magentwo.logger.debug "DATA #{data}"
|
40
40
|
|
41
41
|
url = "#{base_path}/#{path}"
|
42
42
|
Net::HTTP.start(self.host,self.port, :use_ssl => self.scheme == 'https') do |http|
|
43
|
-
req =
|
43
|
+
req = verb.new(url)
|
44
44
|
req["Authorization"] = "Bearer #{self.token}"
|
45
45
|
req['Content-Type'] = "application/json"
|
46
46
|
req.body = data
|
@@ -48,42 +48,20 @@ module Magentwo
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def delete path, data
|
52
|
+
request Net::HTTP::Delete, path:path, data:data
|
53
|
+
end
|
54
|
+
|
51
55
|
def put path, data
|
52
|
-
|
53
|
-
Magentwo.logger.debug "DATA #{data}"
|
54
|
-
url = "#{base_path}/#{path}"
|
55
|
-
Net::HTTP.start(self.host,self.port, :use_ssl => self.scheme == 'https') do |http|
|
56
|
-
req = Net::HTTP::Put.new(url)
|
57
|
-
req["Authorization"] = "Bearer #{self.token}"
|
58
|
-
req['Content-Type'] = "application/json"
|
59
|
-
req.body = data
|
60
|
-
http.request(req)
|
61
|
-
end
|
56
|
+
request Net::HTTP::Put, path:path, data:data
|
62
57
|
end
|
63
58
|
|
64
59
|
def post path, data
|
65
|
-
|
66
|
-
Magentwo.logger.debug "DATA #{data}"
|
67
|
-
url = "#{base_path}/#{path}"
|
68
|
-
Net::HTTP.start(self.host,self.port, :use_ssl => self.scheme == 'https') do |http|
|
69
|
-
req = Net::HTTP::Post.new(url)
|
70
|
-
req["Authorization"] = "Bearer #{self.token}"
|
71
|
-
req['Content-Type'] = "application/json"
|
72
|
-
req.body = data
|
73
|
-
http.request(req)
|
74
|
-
end
|
60
|
+
request Net::HTTP::Post, path:path, data:data
|
75
61
|
end
|
76
62
|
|
77
|
-
|
78
63
|
def get path, query
|
79
|
-
|
80
|
-
url = "#{base_path}/#{path}?#{query}"
|
81
|
-
Net::HTTP.start(self.host,self.port, :use_ssl => self.scheme == 'https') do |http|
|
82
|
-
req = Net::HTTP::Get.new(url)
|
83
|
-
req["Authorization"] = "Bearer #{self.token}"
|
84
|
-
req['Content-Type'] = "application/json"
|
85
|
-
http.request(req)
|
86
|
-
end
|
64
|
+
request Net::HTTP::Get, path:"#{path}?#{query}"
|
87
65
|
end
|
88
66
|
end
|
89
67
|
end
|
data/lib/magentwo.rb
CHANGED
@@ -17,7 +17,7 @@ module Magentwo
|
|
17
17
|
def self.connect_with_token host=nil, token=nil
|
18
18
|
raise ArgumentError, "no host specified" unless host
|
19
19
|
raise ArgumentError, "no token specified" unless token
|
20
|
-
Base.adapter = Adapter.new
|
20
|
+
Base.adapter = Adapter.new(token: token, uri: host)
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.with connection
|
data/magentwo.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'magentwo'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.1.92'
|
4
|
+
s.date = '2023-02-10'
|
5
5
|
s.summary = "Magento 2 API Wrapper"
|
6
6
|
s.description = "Provides a simple Ruby Interface to interact with the Magento 2 API"
|
7
7
|
s.authors = ["André Mueß"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magentwo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Mueß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides a simple Ruby Interface to interact with the Magento 2 API
|
14
14
|
email: andre.cux90@gmail.com
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
64
|
+
rubygems_version: 3.3.25
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Magento 2 API Wrapper
|