peddler 2.3.0 → 2.4.0
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/peddler/headers.rb +4 -1
- data/lib/peddler/marketplace.rb +1 -0
- data/lib/peddler/version.rb +1 -1
- metadata +2 -4
- data/lib/peddler/content.rb +0 -69
- data/lib/peddler/mws.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 974b7b1222d7639db4e0b62033aa77d2797f26cabfd7beedf0efed3672d64531
|
4
|
+
data.tar.gz: 9cfcbb76b80a31adba8ef3093cd25a1d38728277a2a9ebac0a7b9b0d68913b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51dda92daf568674c3d3a4a0c7f378ca904e34f57a96c868535c2e5b91cf736e4d6c41a70093994518be41541f93bd4e0bc40db512cacf6647a9c9b42dc89500
|
7
|
+
data.tar.gz: 53898049e5cae02ba404e18540d2c57b8ee0654206cfbf8aae633e0e0887c291373ca8c60818ed53b887d643da3b27588a3c48b186263eef52816efe4eed44ee
|
data/lib/peddler/headers.rb
CHANGED
@@ -47,7 +47,10 @@ module Peddler
|
|
47
47
|
match_data = headers['Content-Type']&.match(/charset=(.*);?/)
|
48
48
|
return unless match_data
|
49
49
|
|
50
|
-
|
50
|
+
string = match_data[1]
|
51
|
+
string = 'UTF-8' if string == 'UTF8'
|
52
|
+
|
53
|
+
Encoding.find(string)
|
51
54
|
end
|
52
55
|
|
53
56
|
# The max hourly request quota for the requested operation
|
data/lib/peddler/marketplace.rb
CHANGED
@@ -64,6 +64,7 @@ module Peddler
|
|
64
64
|
['A1F83G8C2ARO7P', 'GB', 'mws-eu.amazonservices.com'],
|
65
65
|
['A21TJRUUN4KGV', 'IN', 'mws.amazonservices.in'],
|
66
66
|
['APJ6JRA9NG5V4', 'IT', 'mws-eu.amazonservices.com'],
|
67
|
+
['A1805IZSGTT6HS', 'NL', 'mws-eu.amazonservices.com'],
|
67
68
|
['A17E79C6D8DWNP', 'SA', 'mws-eu.amazonservices.com'],
|
68
69
|
['A33AVAJ2PDY3EV', 'TR', 'mws-eu.amazonservices.com'],
|
69
70
|
['A19VAU5U5O7RUS', 'SG', 'mws-fe.amazonservices.com'],
|
data/lib/peddler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -93,7 +93,6 @@ files:
|
|
93
93
|
- lib/mws/subscriptions/client.rb
|
94
94
|
- lib/peddler.rb
|
95
95
|
- lib/peddler/client.rb
|
96
|
-
- lib/peddler/content.rb
|
97
96
|
- lib/peddler/errors/builder.rb
|
98
97
|
- lib/peddler/errors/class_generator.rb
|
99
98
|
- lib/peddler/errors/error.rb
|
@@ -101,7 +100,6 @@ files:
|
|
101
100
|
- lib/peddler/flat_file_parser.rb
|
102
101
|
- lib/peddler/headers.rb
|
103
102
|
- lib/peddler/marketplace.rb
|
104
|
-
- lib/peddler/mws.rb
|
105
103
|
- lib/peddler/operation.rb
|
106
104
|
- lib/peddler/parser.rb
|
107
105
|
- lib/peddler/structured_list.rb
|
data/lib/peddler/content.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
# Parses content metadata provided in the headers of a response
|
5
|
-
class Content
|
6
|
-
# @!visibility private
|
7
|
-
attr_reader :headers
|
8
|
-
|
9
|
-
# @!visibility private
|
10
|
-
def initialize(headers)
|
11
|
-
@headers = headers.select { |key| key.start_with?('Content') }
|
12
|
-
end
|
13
|
-
|
14
|
-
# The size of the response body in bytes
|
15
|
-
# @return [String, nil]
|
16
|
-
def length
|
17
|
-
return unless headers['Content-Length']
|
18
|
-
|
19
|
-
headers['Content-Length'].to_i
|
20
|
-
end
|
21
|
-
|
22
|
-
# The MD5 digest of the response body
|
23
|
-
# @return [String, nil]
|
24
|
-
def md5
|
25
|
-
headers['Content-MD5']
|
26
|
-
end
|
27
|
-
|
28
|
-
# The MIME type of the response
|
29
|
-
# @return [String, nil]
|
30
|
-
def media_type
|
31
|
-
return unless headers['Content-Type']
|
32
|
-
|
33
|
-
headers['Content-Type'].split(';').first
|
34
|
-
end
|
35
|
-
|
36
|
-
# The general category into which the MIME type falls
|
37
|
-
# @return [String, nil]
|
38
|
-
def type
|
39
|
-
return unless media_type
|
40
|
-
|
41
|
-
media_type.split('/').first
|
42
|
-
end
|
43
|
-
|
44
|
-
# The exact kind of data of the specified type the MIME type represents
|
45
|
-
# @return [String, nil]
|
46
|
-
def subtype
|
47
|
-
return unless media_type
|
48
|
-
|
49
|
-
media_type.split('/').last
|
50
|
-
end
|
51
|
-
|
52
|
-
# The character encoding of the response
|
53
|
-
# @return [Encoding, nil]
|
54
|
-
def charset
|
55
|
-
match_data = headers['Content-Type']&.match(/charset=(.*);?/)
|
56
|
-
return unless match_data
|
57
|
-
|
58
|
-
Encoding.find(match_data[1])
|
59
|
-
end
|
60
|
-
|
61
|
-
# Whether the response is an XML document
|
62
|
-
# @return [Boolean, nil]
|
63
|
-
def xml?
|
64
|
-
return unless subtype
|
65
|
-
|
66
|
-
subtype == 'xml'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
data/lib/peddler/mws.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
# Parses MWS metadata provided in the headers of a response
|
5
|
-
class MWS
|
6
|
-
# @!visibility private
|
7
|
-
attr_reader :headers
|
8
|
-
|
9
|
-
# @!visibility private
|
10
|
-
def initialize(headers)
|
11
|
-
@headers = headers.select { |key| key.start_with?('x-mws') }
|
12
|
-
end
|
13
|
-
|
14
|
-
# The max hourly request quota for the requested operation
|
15
|
-
# @return [Integer, nil]
|
16
|
-
def quota_max
|
17
|
-
return unless headers['x-mws-quota-max']
|
18
|
-
|
19
|
-
headers['x-mws-quota-max'].to_i
|
20
|
-
end
|
21
|
-
|
22
|
-
# The remaining hourly request quota for the requested operation
|
23
|
-
# @return [Integer, nil]
|
24
|
-
def quota_remaining
|
25
|
-
return unless headers['x-mws-quota-remaining']
|
26
|
-
|
27
|
-
headers['x-mws-quota-remaining'].to_i
|
28
|
-
end
|
29
|
-
|
30
|
-
# When the hourly request quota for the requested operation resets
|
31
|
-
# @return [Time, nil]
|
32
|
-
def quota_resets_on
|
33
|
-
return unless headers['x-mws-quota-resetsOn']
|
34
|
-
|
35
|
-
Time.parse(headers['x-mws-quota-resetsOn'])
|
36
|
-
end
|
37
|
-
|
38
|
-
# The ID of the request
|
39
|
-
# @return [String, nil]
|
40
|
-
def request_id
|
41
|
-
headers['x-mws-request-id']
|
42
|
-
end
|
43
|
-
|
44
|
-
# The timestamp of the request
|
45
|
-
# @return [Time, nil]
|
46
|
-
def timestamp
|
47
|
-
return unless headers['x-mws-timestamp']
|
48
|
-
|
49
|
-
Time.parse(headers['x-mws-timestamp'])
|
50
|
-
end
|
51
|
-
|
52
|
-
# The context of the response
|
53
|
-
# @return [String, nil]
|
54
|
-
def response_context
|
55
|
-
headers['x-mws-response-context']
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|