crisp_client 0.2.5 → 0.2.6
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/crisp_client.rb +9 -4
- data/lib/crisp_client/list_websites.rb +2 -1
- data/lib/crisp_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02569b5c01dae994c50d8c1f24977099e429191d
|
4
|
+
data.tar.gz: ba1a6192d1e3fe4937a4c77690a8998ddedb021a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45610b6846b581d1488e4e0e4b1472ae94f1d18005ee50b292a9f7f54497039189bf634582f80a58907f5b0e80e099b878dbee7fde65872e7ae970fe4d94ff71
|
7
|
+
data.tar.gz: 63a838cf9f2e8446709618016a5f84873aac4d15b99fbdd19fb5ec33b78274bac01ab7dccd125628cc73fe20aa1ad9fde67017829b8495cd462557ee57b3be79
|
data/lib/crisp_client.rb
CHANGED
@@ -16,9 +16,13 @@ module CrispClient
|
|
16
16
|
|
17
17
|
base_uri "https://api.crisp.im/v1"
|
18
18
|
|
19
|
-
def initialize(
|
20
|
-
|
21
|
-
|
19
|
+
def initialize(options)
|
20
|
+
if options[:stored_key]
|
21
|
+
@auth = { "Authorization" => "Basic #{options[:stored_key]}" }
|
22
|
+
else
|
23
|
+
@email = options[:email]
|
24
|
+
@password = options[:password]
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
def authenticate
|
@@ -29,7 +33,8 @@ module CrispClient
|
|
29
33
|
identifier = res.parsed_response["data"]["identifier"]
|
30
34
|
key = res.parsed_response["data"]["key"]
|
31
35
|
base64 = Base64.strict_encode64 [identifier, key].join(":")
|
32
|
-
@auth
|
36
|
+
@auth = { "Authorization" => "Basic #{base64}" }
|
37
|
+
return base64
|
33
38
|
end
|
34
39
|
|
35
40
|
private
|
@@ -6,6 +6,7 @@ module ListWebsites
|
|
6
6
|
|
7
7
|
# custom method
|
8
8
|
def find_website_id_by_name(website_name:)
|
9
|
-
list_websites.select{ |website| website["name"] == website_name }
|
9
|
+
websites = list_websites.select{ |website| (website["name"] if website) == website_name }
|
10
|
+
websites.any? ? websites.first["id"] : nil
|
10
11
|
end
|
11
12
|
end
|
data/lib/crisp_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crisp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flavio Wuensche
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|