aws_agcod 0.0.4 → 0.0.5
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/README.md +13 -6
- data/lib/aws_agcod/config.rb +19 -2
- data/lib/aws_agcod/version.rb +1 -1
- data/spec/aws_agcod/config_spec.rb +33 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ff415961b808c02f5cc2ce8612d322b432e47fa
|
4
|
+
data.tar.gz: 7fc8b376f22d1dc861ca1e63ceb4ee5bb731a7e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ba3184af7117c076fc81062a5c7adca7d7e5f2c403a177ad009748cdb324ddd5837c2a0f4d0f1c9a71e382ad6d0f97ad7b52e20b17a32a0925ccb6865aa579
|
7
|
+
data.tar.gz: 24f6e556de1a091fc0f51c99cabb90bb82cdcdb24fc96a18860cf90c2b7baa3c4bc4f74fd4515caa863e0c61420df5360216c47da624f23b16a7f32f35dfca48
|
data/README.md
CHANGED
@@ -26,12 +26,19 @@ Or install it yourself as:
|
|
26
26
|
require "aws_agcod"
|
27
27
|
|
28
28
|
AGCOD.configure do |config|
|
29
|
-
config.access_key = "
|
30
|
-
config.secret_key = "
|
31
|
-
config.partner_id = "
|
32
|
-
|
33
|
-
config
|
34
|
-
|
29
|
+
config.access_key = "YOUR ACCESS KEY"
|
30
|
+
config.secret_key = "YOUR SECRET KEY"
|
31
|
+
config.partner_id = "PARTNER ID"
|
32
|
+
|
33
|
+
# The `production` config is important as it determines which endpoint
|
34
|
+
# you're hitting.
|
35
|
+
config.production = true # This defaults to false.
|
36
|
+
|
37
|
+
# Optionally, you can customize the URI completely.
|
38
|
+
config.uri = "https://my-custom-agcod-endpoint.com"
|
39
|
+
|
40
|
+
config.region = "us-east-1" # default
|
41
|
+
config.timeout = 30 # default
|
35
42
|
end
|
36
43
|
```
|
37
44
|
|
data/lib/aws_agcod/config.rb
CHANGED
@@ -1,12 +1,29 @@
|
|
1
1
|
module AGCOD
|
2
2
|
class Config
|
3
|
-
|
3
|
+
attr_writer :uri
|
4
|
+
attr_accessor :access_key,
|
5
|
+
:secret_key,
|
6
|
+
:partner_id,
|
7
|
+
:region,
|
8
|
+
:timeout,
|
9
|
+
:production
|
10
|
+
|
11
|
+
URI = {
|
12
|
+
sandbox: "https://agcod-v2-gamma.amazon.com",
|
13
|
+
production: "https://agcod-v2.amazon.com"
|
14
|
+
}
|
4
15
|
|
5
16
|
def initialize
|
6
17
|
# API defaults
|
7
|
-
@
|
18
|
+
@production = false
|
8
19
|
@region = "us-east-1"
|
9
20
|
@timeout = 30
|
10
21
|
end
|
22
|
+
|
23
|
+
def uri
|
24
|
+
return @uri if @uri
|
25
|
+
|
26
|
+
production ? URI[:production] : URI[:sandbox]
|
27
|
+
end
|
11
28
|
end
|
12
29
|
end
|
data/lib/aws_agcod/version.rb
CHANGED
@@ -2,13 +2,44 @@ require "spec_helper"
|
|
2
2
|
require "aws_agcod/config"
|
3
3
|
|
4
4
|
describe AGCOD::Config do
|
5
|
-
|
6
|
-
let!(:config) { AGCOD::Config.new }
|
5
|
+
let(:config) { AGCOD::Config.new }
|
7
6
|
|
7
|
+
context ".new" do
|
8
8
|
it "sets default uri and region" do
|
9
9
|
expect(config.uri).not_to be_nil
|
10
10
|
expect(config.region).not_to be_nil
|
11
11
|
expect(config.timeout).not_to be_nil
|
12
|
+
expect(config.production).to eq(false)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "#uri" do
|
17
|
+
context "when uri is set" do
|
18
|
+
before do
|
19
|
+
config.uri = "https://custom-uri.example.com"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns the custom uri" do
|
23
|
+
expect(config.uri).to eq("https://custom-uri.example.com")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when uri is not set" do
|
28
|
+
context "when production is enabled" do
|
29
|
+
before do
|
30
|
+
config.production = true
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns the production uri" do
|
34
|
+
expect(config.uri).to eq(AGCOD::Config::URI[:production])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when production is disabled" do
|
39
|
+
it "returns the sandbox uri" do
|
40
|
+
expect(config.uri).to eq(AGCOD::Config::URI[:sandbox])
|
41
|
+
end
|
42
|
+
end
|
12
43
|
end
|
13
44
|
end
|
14
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_agcod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenor Chang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -101,7 +101,7 @@ files:
|
|
101
101
|
- spec/aws_agcod/response_spec.rb
|
102
102
|
- spec/aws_agcod_spec.rb
|
103
103
|
- spec/spec_helper.rb
|
104
|
-
homepage: https://github.com/listia/
|
104
|
+
homepage: https://github.com/listia/aws_agcod
|
105
105
|
licenses:
|
106
106
|
- MIT
|
107
107
|
metadata: {}
|