amazon-drs 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -9
- data/README.md +2 -1
- data/amazon-drs.gemspec +3 -3
- data/appveyor.yml +17 -0
- data/lib/amazon-drs/base.rb +1 -1
- data/lib/amazon-drs/client.rb +16 -0
- data/lib/amazon-drs/test_orders.rb +17 -0
- data/lib/amazon-drs/version.rb +1 -1
- metadata +5 -4
- data/.jrubyrc +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e24c43008ae245288e0d291e78516a0d9658bdec
|
4
|
+
data.tar.gz: 3ab4e44c2930fd7bd80b4ebe55bdcbf30463d489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 275dc32379fa3bb9f61c0e602ee15b9f27719db75709c1f43d7e409e4c0cbdce5ddfdbe950e769fe8a8b0618b8f6d03886d21cd137b867feb051925bbb22554c
|
7
|
+
data.tar.gz: c9689d46dd5e49fff113efeef65f3d61b1c4ee9d6b8a93b41ac743f724ec510de7b2bd765f116c6a579589bb08c4a5e37170981443685649e6119912f69a3cde
|
data/.travis.yml
CHANGED
@@ -2,13 +2,8 @@
|
|
2
2
|
sudo: false
|
3
3
|
language: ruby
|
4
4
|
rvm:
|
5
|
-
- 2.2.
|
6
|
-
- 2.3.
|
7
|
-
- 2.4.
|
8
|
-
- jruby-1.
|
9
|
-
- jruby-9.1.7.0
|
5
|
+
- 2.2.7
|
6
|
+
- 2.3.4
|
7
|
+
- 2.4.1
|
8
|
+
- jruby-9.1.12.0
|
10
9
|
script: bundle exec rake
|
11
|
-
matrix:
|
12
|
-
allow_failures:
|
13
|
-
- rvm: jruby-1.7.26
|
14
|
-
- rvm: jruby-9.1.7.0
|
data/README.md
CHANGED
@@ -31,4 +31,5 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
31
31
|
|
32
32
|
## Badges
|
33
33
|
|
34
|
-
[![Build Status](https://travis-ci.org/aycabta/amazon-drs.svg)](https://travis-ci.org/aycabta/amazon-drs)
|
34
|
+
- [![Build Status](https://travis-ci.org/aycabta/amazon-drs.svg)](https://travis-ci.org/aycabta/amazon-drs)
|
35
|
+
- [![Build Status](https://ci.appveyor.com/api/projects/status/github/aycabta/amazon-drs?branch=master&svg=true)](https://ci.appveyor.com/project/aycabta/amazon-drs)
|
data/amazon-drs.gemspec
CHANGED
@@ -4,10 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'amazon-drs/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'amazon-drs'
|
8
8
|
spec.version = AmazonDrs::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Code Ass']
|
10
|
+
spec.email = ['aycabta@gmail.com']
|
11
11
|
|
12
12
|
spec.summary = %q{amazon-drs is for Amazon Dash Replenishment Service}
|
13
13
|
spec.description = %Q{amazon-drs is for Amazon Dash Replenishment Service.\nYou can use this after authorized by Login with Amazon.\n}
|
data/appveyor.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
install:
|
3
|
+
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
4
|
+
- gem install bundler --no-document
|
5
|
+
- bundle install
|
6
|
+
build: off
|
7
|
+
test_script:
|
8
|
+
- bundle exec rake
|
9
|
+
deploy: off
|
10
|
+
environment:
|
11
|
+
matrix:
|
12
|
+
- ruby_version: "22"
|
13
|
+
- ruby_version: "22-x64"
|
14
|
+
- ruby_version: "23"
|
15
|
+
- ruby_version: "23-x64"
|
16
|
+
- ruby_version: "24"
|
17
|
+
- ruby_version: "24-x64"
|
data/lib/amazon-drs/base.rb
CHANGED
@@ -15,7 +15,7 @@ module AmazonDrs
|
|
15
15
|
response.each do |key, value|
|
16
16
|
case key.downcase
|
17
17
|
when 'x-amzn-errortype'
|
18
|
-
#
|
18
|
+
# Examples:
|
19
19
|
# InvalidTokenException:http://internal.amazon.com/coral/com.amazon.parkeraccioservice/
|
20
20
|
# OA2InvalidRequestException:http://internal.amazon.com/coral/com.amazon.panda/
|
21
21
|
@error_type, @error_description_url = value.split(':', 2)
|
data/lib/amazon-drs/client.rb
CHANGED
@@ -10,6 +10,7 @@ require 'amazon-drs/replenish'
|
|
10
10
|
require 'amazon-drs/error'
|
11
11
|
require 'amazon-drs/slot_status'
|
12
12
|
require 'amazon-drs/access_token'
|
13
|
+
require 'amazon-drs/test_orders'
|
13
14
|
|
14
15
|
module AmazonDrs
|
15
16
|
class Client
|
@@ -113,6 +114,21 @@ module AmazonDrs
|
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
117
|
+
# https://developer.amazon.com/public/solutions/devices/dash-replenishment-service/docs/dash-canceltestorder-endpoint
|
118
|
+
def test_orders(slot_id)
|
119
|
+
headers = {
|
120
|
+
'x-amzn-accept-type': 'com.amazon.dash.replenishment.DrsCancelTestOrdersResult@1.0',
|
121
|
+
'x-amzn-type-version': 'com.amazon.dash.replenishment.DrsCancelTestOrdersInput@1.0'
|
122
|
+
}
|
123
|
+
path = "/testOrders/#{slot_id}"
|
124
|
+
response = request_drs(:delete, path, headers: headers)
|
125
|
+
if response.code == '200'
|
126
|
+
::AmazonDrs::TestOrders.new(response)
|
127
|
+
else
|
128
|
+
::AmazonDrs::Error.new(response)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
116
132
|
def get_token
|
117
133
|
if @access_token
|
118
134
|
@access_token
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'amazon-drs/base'
|
3
|
+
|
4
|
+
module AmazonDrs
|
5
|
+
class TestOrders < Base
|
6
|
+
attr_accessor :slot_order_statuses
|
7
|
+
SlotOrderStatus = Struct.new(:order_status, :slot_id)
|
8
|
+
|
9
|
+
def parse_body(body)
|
10
|
+
json = JSON.parse(body)
|
11
|
+
@slot_order_statuses = []
|
12
|
+
json['slotOrderStatuses'].each do |item|
|
13
|
+
@slot_order_statuses << SlotOrderStatus.new(item['orderStatus'], item['slotId'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/amazon-drs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-drs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Ass
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,13 +76,13 @@ extensions: []
|
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
|
-
- ".jrubyrc"
|
80
79
|
- ".travis.yml"
|
81
80
|
- Gemfile
|
82
81
|
- LICENSE.txt
|
83
82
|
- README.md
|
84
83
|
- Rakefile
|
85
84
|
- amazon-drs.gemspec
|
85
|
+
- appveyor.yml
|
86
86
|
- bin/console
|
87
87
|
- bin/setup
|
88
88
|
- data/client
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/amazon-drs/replenish.rb
|
97
97
|
- lib/amazon-drs/slot_status.rb
|
98
98
|
- lib/amazon-drs/subscription_info.rb
|
99
|
+
- lib/amazon-drs/test_orders.rb
|
99
100
|
- lib/amazon-drs/version.rb
|
100
101
|
homepage: https://github.com/aycabta/amazon-drs
|
101
102
|
licenses:
|
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
120
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.11
|
121
122
|
signing_key:
|
122
123
|
specification_version: 4
|
123
124
|
summary: amazon-drs is for Amazon Dash Replenishment Service
|
data/.jrubyrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
compat.version=2.0
|