aws_agcod 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 655c7b1368611cacb12fba40bb8c7d41c2dc4df9
4
- data.tar.gz: ec16be753d4e8488b1c9b642cfe3edc467649d9c
3
+ metadata.gz: 9ff415961b808c02f5cc2ce8612d322b432e47fa
4
+ data.tar.gz: 7fc8b376f22d1dc861ca1e63ceb4ee5bb731a7e1
5
5
  SHA512:
6
- metadata.gz: 15bb4600aa4d6f812359f511855d7f42659ffe8a6d8b730b7b95f54bb014a45b5539fecda80f6fbbd7f9bf6ed7d0caf9b133a8ddfdc16185d36966e62f8a23c6
7
- data.tar.gz: 0ec38ce66e43f14b6b98086d19f31df5604dd68e0a69759e8a4b75baf535650e82207e7d8fcb93d93686248077619349e7ac3fdee5ce8022e762d35c2e8da063
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 = "YOUR_ACCESS_KEY"
30
- config.secret_key = "YOUR_SECRET_KEY"
31
- config.partner_id = "PARTNER_ID"
32
- config.uri = "https://agcod-v2-gamma.amazon.com" # default, sandbox endpoint
33
- config.region = "us-east-1" # default
34
- config.timeout = 30 # default
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
 
@@ -1,12 +1,29 @@
1
1
  module AGCOD
2
2
  class Config
3
- attr_accessor :access_key, :secret_key, :uri, :partner_id, :region, :timeout
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
- @uri = "https://agcod-v2-gamma.amazon.com"
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
@@ -1,3 +1,3 @@
1
1
  module AGCOD
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -2,13 +2,44 @@ require "spec_helper"
2
2
  require "aws_agcod/config"
3
3
 
4
4
  describe AGCOD::Config do
5
- context ".new" do
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
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-19 00:00:00.000000000 Z
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/aws-agcod
104
+ homepage: https://github.com/listia/aws_agcod
105
105
  licenses:
106
106
  - MIT
107
107
  metadata: {}