daashub_api 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/daashub_api-0.2.0.gem +0 -0
- data/lib/daashub_api.rb +2 -2
- data/lib/daashub_api/client.rb +2 -0
- data/lib/daashub_api/request.rb +14 -4
- data/lib/daashub_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed1a847f0cc5dbf0c546a595af635f3167cf21b
|
4
|
+
data.tar.gz: 4abb5d6cc084ba551c85d9e700fb61d68660d078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f69931d3a08c867e0aeaad4bb37d3e5b92cf92de35266cb93d7fb5b51a26a1e0dbdfc34200c3219d3031347acbb04b29f5ad2090e1445f66929e4fa14f855f
|
7
|
+
data.tar.gz: 90f49e093ae6f55477aa17b31e3a4cff429a9a32ff397fb8fdda1a4f210401fa1c9258b9125f909ccd481a54a5f7d4115b95250a84344e264ff09fddffceba9f
|
Binary file
|
data/lib/daashub_api.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'daashub_api/client'
|
2
|
+
require 'daashub_api/version'
|
data/lib/daashub_api/client.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'daashub_api/rest/account'
|
2
|
+
require 'daashub_api/rest/batch_file'
|
2
3
|
require 'daashub_api/rest/company'
|
3
4
|
require 'daashub_api/rest/history'
|
4
5
|
|
5
6
|
module DaashubAPI
|
6
7
|
class Client
|
7
8
|
include DaashubAPI::REST::Account
|
9
|
+
include DaashubAPI::REST::BatchFile
|
8
10
|
include DaashubAPI::REST::Company
|
9
11
|
include DaashubAPI::REST::History
|
10
12
|
|
data/lib/daashub_api/request.rb
CHANGED
@@ -10,16 +10,26 @@ module DaashubAPI
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def perform_get(endpoint, access_token, options = {})
|
13
|
+
perform(access_token) { get(endpoint, options) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def perform_post(endpoint, access_token, options = {})
|
17
|
+
perform(access_token) { post(endpoint, options) }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def perform(access_token)
|
13
23
|
headers 'Authorization' => "Token token=#{access_token}"
|
14
|
-
response =
|
24
|
+
response = yield
|
15
25
|
check_for_errors(response)
|
16
26
|
response.parsed_response
|
17
27
|
end
|
18
28
|
|
19
|
-
private
|
20
|
-
|
21
29
|
def check_for_errors(response)
|
22
|
-
|
30
|
+
return unless response.parsed_response['error']
|
31
|
+
send("error_#{response.response.code}",
|
32
|
+
response.parsed_response['error'])
|
23
33
|
end
|
24
34
|
|
25
35
|
def error_400(message)
|
data/lib/daashub_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daashub_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Brzózka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
|
+
- daashub_api-0.2.0.gem
|
111
112
|
- daashub_api.gemspec
|
112
113
|
- lib/daashub_api.rb
|
113
114
|
- lib/daashub_api/account.rb
|