kobana 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kobana/configuration.rb +2 -1
- data/lib/kobana/resources/base.rb +3 -1
- data/lib/kobana/resources/connection.rb +3 -1
- data/lib/kobana/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc6a9da2db1bd8cb2aa863f729e4ee3ef9cd4c143e9c38e5ce5e64c633e1f98
|
4
|
+
data.tar.gz: 2841dae640966617c6c9a897681cc26ae0ace4c933613ae0147d91ab0ffda53e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1740ebb8d3b894fd4b0b215450ea4563da1ece74da1002d046f874b8661007716989e9ed8c52279ed95983714e42cca1b3bc3a4c05e369910ca2aec6b68b67f8
|
7
|
+
data.tar.gz: 75ec69765d55582b1363d014ba78ebc4e93d5407e6aef4b18020bd1c3c78d1d4c59b8207d0d40bf9522e81a08364e03779d7743ebcd9a8b5894f15d58d91f4bf
|
data/lib/kobana/configuration.rb
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module Kobana
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :api_token, :environment, :custom_headers, :debug
|
5
|
+
attr_accessor :api_token, :environment, :custom_headers, :debug, :api_version
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@custom_headers = {}
|
9
9
|
@environment = :sandbox
|
10
|
+
@api_version = :v2
|
10
11
|
end
|
11
12
|
|
12
13
|
def inspect
|
@@ -23,9 +23,11 @@ module Kobana
|
|
23
23
|
|
24
24
|
def inherited(subclass)
|
25
25
|
super
|
26
|
+
# Set defaults only if not already set by parent classes
|
26
27
|
subclass.resource_endpoint ||= infer_resource_endpoint(subclass)
|
27
28
|
subclass.primary_key ||= :uid
|
28
|
-
|
29
|
+
# Don't override api_version if it's already been set
|
30
|
+
subclass.api_version = :v2 unless subclass.instance_variable_defined?(:@api_version)
|
29
31
|
subclass.errors ||= []
|
30
32
|
subclass.default_attributes ||= {}
|
31
33
|
end
|
@@ -106,7 +106,9 @@ module Kobana
|
|
106
106
|
|
107
107
|
def base_url
|
108
108
|
config = client&.configuration || Kobana.configuration
|
109
|
-
|
109
|
+
# Prioritize client configuration api_version over class api_version
|
110
|
+
version = config.api_version&.to_sym || api_version&.to_sym
|
111
|
+
BASE_URI[version][config.environment&.to_sym]
|
110
112
|
end
|
111
113
|
end
|
112
114
|
end
|
data/lib/kobana/version.rb
CHANGED