rakuten_web_service 1.3.0 → 1.4.0

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: f79961bad825f4fb30452d991970455ea06c3dfe
4
- data.tar.gz: 3fe13d653a47429b7a4423f49cfa92a8bc48e41e
3
+ metadata.gz: 36494ec875153de05cd30a11c266d9c2c7d12b09
4
+ data.tar.gz: dafab6e790770ec344dca796d261a4896c741b54
5
5
  SHA512:
6
- metadata.gz: 417d44418dccbcbb5ba5c7cce48168b9204b2d4fa56790119bcc9864abed6e9dfedd8c7738dca523dbc4e733825063f6fe1116da728b281ca0c64bd98748f738
7
- data.tar.gz: 64ac7fb9c11bc7754eae3127ea522234289a3f664e4fa274e3297b0883927dacdcb95c0a7db4c45f6910c1324f3bc28ad18e49ddb0af655e646783ad486fa72f
6
+ metadata.gz: ffddb30af4da3756f6ef0baa4e2ad49c0967d06264eaf39e29c3a1bbb4a109cb7868e63335be9203006f631c4e24ba97144e899532fb2d15a223a7ede2022f2a
7
+ data.tar.gz: 9464a7badbc80252dfadb8c42104e0deefa028858eb9d09f91ee6545b05bd43cbb27b4ab1071a8e4e0ee08b4d7e28bcb5c1818da190aee180f7281661b240ddd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v1.4.0 (2016/11/11)
2
+
3
+ ## Enhancements
4
+
5
+ * Raise RuntimeError if required option `application_id` is not set when generating parameters. [#51](https://github.com/rakuten-ws/rws-ruby-sdk/pull/51)
6
+
7
+
1
8
  # v1.3.0 (2016/11/08)
2
9
 
3
10
  ## Enhancements
@@ -12,8 +12,13 @@ module RakutenWebService
12
12
  convert_snake_key_to_camel_key(default_parameters.merge(params))
13
13
  end
14
14
 
15
- def default_parameters
16
- { :application_id => application_id, :affiliate_id => affiliate_id }
15
+ def default_parameters
16
+ raise "Application ID is not defined" unless has_required_options?
17
+ { application_id: application_id, affiliate_id: affiliate_id }
18
+ end
19
+
20
+ def has_required_options?
21
+ application_id && application_id != ''
17
22
  end
18
23
 
19
24
  def debug_mode?
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "1.3.0".freeze
2
+ VERSION = "1.4.0".freeze
3
3
  end
@@ -102,4 +102,40 @@ describe RakutenWebService::Configuration do
102
102
  end
103
103
  end
104
104
  end
105
+
106
+ describe "#default_parameters" do
107
+ before do
108
+ RakutenWebService.configure do |c|
109
+ c.application_id = application_id
110
+ end
111
+ end
112
+
113
+ context "When application id is given" do
114
+ let(:application_id) { 'app_id' }
115
+
116
+ subject { RakutenWebService.configuration.default_parameters }
117
+
118
+ it "has application_id key and its value is a given value" do
119
+ expect(subject[:application_id]).to eq 'app_id'
120
+ end
121
+ end
122
+ context "When application id is not given" do
123
+ let(:application_id) { nil }
124
+
125
+ it "raises an error" do
126
+ expect {
127
+ RakutenWebService.configuration.default_parameters
128
+ }.to raise_error(RuntimeError, "Application ID is not defined")
129
+ end
130
+ end
131
+ context "When application id is an empty string" do
132
+ let(:application_id) { '' }
133
+
134
+ it "raises an error" do
135
+ expect {
136
+ RakutenWebService.configuration.default_parameters
137
+ }.to raise_error(RuntimeError, "Application ID is not defined")
138
+ end
139
+ end
140
+ end
105
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler