hdcore 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/hdcore/request.rb +3 -2
- data/lib/hdcore/version.rb +1 -1
- data/spec/lib/hdcore/request_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTQ0MTYxMTFlMWZiOWM3NDc3Mzg0MWVhYTA2MGFmZTEwZTZlMjI4YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGI0MDZhMzFiYmMxZDMxZDk4YmViYzhiMmY2OWYyMGM3ZjlkZmRkNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2M1ZmVkODBmMjhiOGUxODIzNzY4NWM5MDU2ZTEyNjhlYmIxZGYyNmU0NDBm
|
10
|
+
YWZmNWUwZmYyODEzMzFlYWQ5NjJhOWI3OTdlNmQxZTQ1Yzc5ZDZjMjNlYzE2
|
11
|
+
NzNjMmE4OWFkN2I5MDg4NzI0NjlhZGI5NzgwNWE5YWZlNzFkOGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGZhNjVmZDEyZDZmZjdmOGM3ZGY3NmIwNjMwYWEyMGViNThiNWE3NGEyOWZh
|
14
|
+
OTIzM2MxNzBhOWQ5MDRjYzQ0ZTA3MWVlNTEyNDhkYmVhNzBlYWFlYjZhOGUy
|
15
|
+
MWVmNmU2NmY5ZTc1YmQ4YTQ3ZDU5NDNiZTlhNjYyODI0ZTczZDM=
|
data/lib/hdcore/request.rb
CHANGED
@@ -10,7 +10,8 @@ module Hdcore
|
|
10
10
|
# @return [HTTParty::Response]
|
11
11
|
def call(action, params = {})
|
12
12
|
init()
|
13
|
-
|
13
|
+
post "/#{action.gsub('.','/')}.json",
|
14
|
+
:body => full_api_parameters(action, params)
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
@@ -46,7 +47,7 @@ module Hdcore
|
|
46
47
|
# @param [String] action The full API action
|
47
48
|
# @param [Hash] params The given action parameters
|
48
49
|
# @return [Hash] Full set of parameters, including generated api parameters
|
49
|
-
def
|
50
|
+
def full_api_parameters(action, params = {})
|
50
51
|
params.merge generate_api_params(action, params)
|
51
52
|
end
|
52
53
|
|
data/lib/hdcore/version.rb
CHANGED
@@ -5,18 +5,18 @@ describe Hdcore::Request do
|
|
5
5
|
describe '.call' do
|
6
6
|
it 'initializes and sends POST request to API endpoint' do
|
7
7
|
test_action = 'some.action'
|
8
|
-
Hdcore::Request.stub(:
|
8
|
+
Hdcore::Request.stub(:full_api_parameters).and_return(params = {:some => 'params'})
|
9
9
|
Hdcore::Request.should_receive(:init)
|
10
|
-
Hdcore::Request.should_receive(:post).with("/#{test_action.gsub('.','/')}.json", params)
|
10
|
+
Hdcore::Request.should_receive(:post).with("/#{test_action.gsub('.','/')}.json", :body => params)
|
11
11
|
Hdcore::Request.call(test_action, {})
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
-
describe '.
|
16
|
+
describe '.full_api_parameters' do
|
17
17
|
it 'returns parameters merged with generated api parameters' do
|
18
18
|
Hdcore::Request.stub(:generate_api_params).and_return(api_params = {:some => 'api_params'})
|
19
|
-
actual = Hdcore::Request.send(:
|
19
|
+
actual = Hdcore::Request.send(:full_api_parameters, 'some.action', params = {:some_other => 'params'})
|
20
20
|
actual.should == params.merge(api_params)
|
21
21
|
end
|
22
22
|
end
|