spinacz 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spinacz/client.rb +5 -2
- data/lib/spinacz/version.rb +1 -1
- 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: da82fbd825e5c9d7f0a9505ebd16ccf5d19a2b33
|
4
|
+
data.tar.gz: 20d2612aea6aeb87173dcb8120d31bf9c342f2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0467d05f331f2be03653d65f9d0c3f1ff57d07871766138a82493a654a8def19bb74b89b4a3596c658106d3137eca22fa1bb6b84ea4f279a72e221eea01ee153
|
7
|
+
data.tar.gz: 4e68dfc5d75427903a9e7b775b97efcfb89ff861c8aa7d9b7b70d75712e327447a9ea31cb2f0dfe3bbf0ef705bf5b003dbc90c03f21e6249812d4142fc8600e8
|
data/lib/spinacz/client.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Spinacz
|
2
2
|
class Client
|
3
|
-
attr_accessor :email, :password, :token
|
3
|
+
attr_accessor :email, :password, :token, :test
|
4
4
|
|
5
5
|
URL = 'https://spinacz.pl'
|
6
|
+
TEST_URL = 'https://test.spinacz.pl'
|
6
7
|
|
7
8
|
def initialize(credentials = {})
|
8
9
|
@email = credentials[:email] || ENV['SPINACZ_EMAIL']
|
@@ -11,6 +12,7 @@ module Spinacz
|
|
11
12
|
@password = @password.strip if @password
|
12
13
|
@token = credentials[:token] || ENV['SPINACZ_TOKEN']
|
13
14
|
@token = @token.strip if @token
|
15
|
+
@test = credentials[:test]
|
14
16
|
end
|
15
17
|
|
16
18
|
def login
|
@@ -89,8 +91,9 @@ module Spinacz
|
|
89
91
|
def call_api(call_type, get_data, json_data = nil)
|
90
92
|
json_data_converted = json_data ? json_data.to_json : ''
|
91
93
|
endpoint = "/api/v1/#{get_data}"
|
94
|
+
url = @test ? TEST_URL : URL
|
92
95
|
|
93
|
-
conn = Faraday.new(:url
|
96
|
+
conn = Faraday.new(url: url) do |faraday|
|
94
97
|
faraday.request :url_encoded
|
95
98
|
# faraday.response :logger
|
96
99
|
faraday.adapter Faraday.default_adapter
|
data/lib/spinacz/version.rb
CHANGED