plugair_sdk 1.0.0 → 1.0.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/README.md +3 -1
- data/lib/plugair_sdk/version.rb +1 -1
- data/lib/plugair_sdk.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bdac5e858183bff6cadce519880e153b152f77a
|
4
|
+
data.tar.gz: 271fe7e637e818811a555600ded1049e21a91c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb8fa56f2a5518090ec179e00bcaf3c162dd2075e675ceead8c18a1487ace8b08bdf895aa47b9c674fbb823e1886b87fd18129f3ed3f53af559ecd8b6bc7d1d4
|
7
|
+
data.tar.gz: a23388f8b1e7cf2d1d8ce70c28241fa800f90f69671c4de29c644f4966e17eadff95b87c3649ebf04c9dd6727f89e20d5dfe7b547208c63cdbab19e42158fd12
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Plugair SDK for Ruby
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/plugair_sdk)
|
4
|
+
|
3
5
|
## Installation
|
4
6
|
|
5
7
|
Add this line to your application's Gemfile:
|
@@ -51,7 +53,7 @@ rescue PlugAirUnkownError => e
|
|
51
53
|
end
|
52
54
|
```
|
53
55
|
|
54
|
-
##
|
56
|
+
## API Documents
|
55
57
|
|
56
58
|
### Initialize
|
57
59
|
|
data/lib/plugair_sdk/version.rb
CHANGED
data/lib/plugair_sdk.rb
CHANGED
@@ -29,7 +29,7 @@ class PlugAir
|
|
29
29
|
|
30
30
|
|
31
31
|
def initialize(api_key=ENV['PLUGAIR_API_KEY'], shared_secret=ENV['PLUGAIR_SHARED_SECRET'])
|
32
|
-
|
32
|
+
validate_api_key_and_shared_secret(api_key, shared_secret)
|
33
33
|
|
34
34
|
@api_key = api_key
|
35
35
|
@shared_secret = shared_secret
|
@@ -37,7 +37,7 @@ class PlugAir
|
|
37
37
|
|
38
38
|
|
39
39
|
def generate_challenge
|
40
|
-
|
40
|
+
validate_api_key_and_shared_secret(@api_key, @shared_secret)
|
41
41
|
|
42
42
|
resource_path = BASE_RESOURCE_PATH + PATH_CHALLENGE
|
43
43
|
query_params = API_KEY_PARAMETER + @api_key
|
@@ -69,7 +69,7 @@ class PlugAir
|
|
69
69
|
|
70
70
|
|
71
71
|
def verify(credential_key, auth_key, auth_data)
|
72
|
-
|
72
|
+
validate_api_key_and_shared_secret(@api_key, @shared_secret)
|
73
73
|
|
74
74
|
resource_path = BASE_RESOURCE_PATH + PATH_VERIFY
|
75
75
|
query_params = API_KEY_PARAMETER + @api_key
|
@@ -107,7 +107,7 @@ class PlugAir
|
|
107
107
|
|
108
108
|
private
|
109
109
|
|
110
|
-
def
|
110
|
+
def validate_api_key_and_shared_secret(api_key, shared_secret)
|
111
111
|
if api_key then
|
112
112
|
if not api_key.is_a?(String) or api_key.length != API_KEY_LENGTH then
|
113
113
|
raise PlugAirApiKeyError.new('API key length is invalid.')
|