civo 0.5.8 → 0.6.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: 9e3ff6bfd80c6ebcf5b6ed6630cc1dba92cff784
4
- data.tar.gz: c2c87963f8fce15d2e8fd6f702aebbd90047390f
3
+ metadata.gz: f400a8bdc064187e6eaf1f3a8cd88f7c8c11bd06
4
+ data.tar.gz: 7684ca5090ef694fba2f51bff23dafb3e48afe52
5
5
  SHA512:
6
- metadata.gz: 2101e81a18c1c33c20f11340c1eadf329cf19c6cee5bf27bc0968ebf9b12647977acf1e6b6a82bb4dd8da026d7b199d0589061ec64c2cc38e284fe465a13ea7a
7
- data.tar.gz: 6868d42af6d1077ba54d8b4236a7b4bfe22a7d3467f6aa699ae86790bd125b1d600d7745daf7e83d479f41f84030ae2c5ce8906c89f78cb913851d1b6aa00975
6
+ metadata.gz: 5eded1cd62419433edb0e45ca84463724c1a4b7f9721118f0625aca0aa02fc8df23fefc0418d1d21d387a8ac8e898a34dcdaab93a603957e17d1a261e982bdd5
7
+ data.tar.gz: c474d73cddfcec284e8c5bc121ab1b4c505e23be1ac4d971993b01afe1f8cb004633f5db478db51ca81367d263b5855b7675513538197bb21ff82f06866a2c65
@@ -1,10 +1,29 @@
1
1
  module Civo
2
2
  class Base < ::Flexirest::Base
3
- before_request do |name, request|
3
+ before_request :authorization_token
4
+
5
+ if ENV["CIVO_API_VERSION"] == "2"
6
+ before_request :administration_set_user
7
+ end
8
+
9
+ private
10
+
11
+ def authorization_token(name, request)
4
12
  request.headers["Authorization"] = "bearer #{ENV["CIVO_TOKEN"]}"
5
13
  end
14
+
15
+ def administration_set_user(name, request)
16
+ user_id = request.post_params[:user_id] # Don't delete the param in case it's needed by an action
17
+ if user_id.present?
18
+ request.headers["X-Civo-UserID"] = user_id
19
+ end
20
+ account_id = request.post_params[:account_id] # Don't delete the param in case it's needed by an action
21
+ if account_id.present?
22
+ request.headers["X-Civo-AccountID"] = account_id
23
+ end
24
+ end
25
+
6
26
  end
7
27
  end
8
28
 
9
29
  Flexirest::Base.base_url = ENV["CIVO_URL"]
10
- Flexirest::Base.verbose! if ENV["CIVO_VERBOSE"]
data/lib/civo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Civo
2
- VERSION = "0.5.8"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flexirest