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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b6de71ced61f6a88208d52b17a9b1d69953b8bd
4
- data.tar.gz: 60514e937a017a629f527bd68971acd839c4611c
3
+ metadata.gz: eed1a847f0cc5dbf0c546a595af635f3167cf21b
4
+ data.tar.gz: 4abb5d6cc084ba551c85d9e700fb61d68660d078
5
5
  SHA512:
6
- metadata.gz: ae935ee32f9b24226e2b6bb0d5860850e49e73c8c2d23d8968611e3c63c3dbbe2b9207ac1d902622322954f7b025e3525f923ad4cd1232fd87429ea14f1f75d6
7
- data.tar.gz: d5c196496503d975e52cd3b390cd730ab4d7a89e2c57a96ab024ea214d0a37324b8b1cf133c412e398374582090dcfa1ab641debbafe2e0ea1353d6e2ace5f63
6
+ metadata.gz: a4f69931d3a08c867e0aeaad4bb37d3e5b92cf92de35266cb93d7fb5b51a26a1e0dbdfc34200c3219d3031347acbb04b29f5ad2090e1445f66929e4fa14f855f
7
+ data.tar.gz: 90f49e093ae6f55477aa17b31e3a4cff429a9a32ff397fb8fdda1a4f210401fa1c9258b9125f909ccd481a54a5f7d4115b95250a84344e264ff09fddffceba9f
Binary file
@@ -1,2 +1,2 @@
1
- require "daashub_api/client"
2
- require "daashub_api/version"
1
+ require 'daashub_api/client'
2
+ require 'daashub_api/version'
@@ -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
 
@@ -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 = get(endpoint, options)
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
- send("error_#{response.response.code}", response.parsed_response['error']) if response.parsed_response['error']
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)
@@ -1,3 +1,3 @@
1
1
  module DaashubAPI
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
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.2.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: 2016-08-10 00:00:00.000000000 Z
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