6px 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/6px/client.rb +6 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDI5M2I3OTI1YTkxNjkzMWYwYjc2YTU3ZDUxOWFlN2FmYjc2ZWY4ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTg0N2EwZWUyNmE2YmNkMWNjYTI5MDZjNzFjZDY0YjUwZWY1MGJlZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2ZlMTZjNDA2OTY5YzZhMTM2YmNmZDA0Mjg5MjdhMDQ3Mzg3OTlhZGIwNzhh
|
10
|
+
YmZjNjAzZGFhNTYxOTUwZjdkOTAzYzE5MmQwZDg0OWZjMzVmMDg0NzQ0YmU2
|
11
|
+
ZDliNmFmMTVlYWI5Y2NlYWUzNWUyOThkZWUxNzIwY2VjMzY4N2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWQwZmJkMDgzZmNiNDUwYjc0YmJlNWM0MDVmODM4MWUzYmYxY2Q3NWI0YjY0
|
14
|
+
NDM0ZGMxMzFkYjhhOTIyM2IzMTEzMmZmOGQzZjRjNWMwNTU5NzA5YWE4YWRi
|
15
|
+
NTg1ZTE3NzM5MDZlMWUyMzgxNzdiYmNjMDIyNGU0N2QzODFiYzE=
|
data/lib/6px/client.rb
CHANGED
@@ -6,7 +6,7 @@ class PX
|
|
6
6
|
|
7
7
|
METHOD_NAMES = [:rotate, :resize, :crop, :filter, :layer, :analyze]
|
8
8
|
|
9
|
-
base_uri '
|
9
|
+
base_uri ''
|
10
10
|
headers 'Content-Type' => 'application/json'
|
11
11
|
|
12
12
|
# Set up the authroized url and parameters
|
@@ -14,9 +14,8 @@ class PX
|
|
14
14
|
user_id = args[:user_id]
|
15
15
|
api_key = args[:api_key]
|
16
16
|
api_secret = args[:api_secret]
|
17
|
-
self.class.base_uri
|
17
|
+
self.class.base_uri "https://api.6px.io/v1/users/#{user_id}"
|
18
18
|
self.class.default_params key: api_key, secret: api_secret
|
19
|
-
@payload = {}
|
20
19
|
@inputs = {}
|
21
20
|
@outputs = []
|
22
21
|
@output = {}
|
@@ -29,7 +28,7 @@ class PX
|
|
29
28
|
def jobs(*query)
|
30
29
|
query = query.first
|
31
30
|
job_id = query.delete(:job_id) if query
|
32
|
-
url = job_id ? "jobs/#{job_id}" : "jobs"
|
31
|
+
url = job_id ? "/jobs/#{job_id}" : "/jobs"
|
33
32
|
query = clean_up_search_params(query)
|
34
33
|
response = self.class.get(url, query: query).body
|
35
34
|
JSON.parse(response)
|
@@ -100,9 +99,8 @@ class PX
|
|
100
99
|
def save
|
101
100
|
payload = build_payload.to_json
|
102
101
|
empty_variables
|
103
|
-
|
104
|
-
response
|
105
|
-
JSON.parse(response)
|
102
|
+
response = self.class.post("/jobs", body: payload)
|
103
|
+
JSON.parse(response.body)
|
106
104
|
end
|
107
105
|
|
108
106
|
private
|
@@ -162,7 +160,6 @@ class PX
|
|
162
160
|
|
163
161
|
# Resets instance variables after request is sent
|
164
162
|
def empty_variables
|
165
|
-
@payload = {}
|
166
163
|
@inputs = {}
|
167
164
|
@methods = []
|
168
165
|
@data = {}
|
@@ -170,4 +167,4 @@ class PX
|
|
170
167
|
@outputs = []
|
171
168
|
@output = {}
|
172
169
|
end
|
173
|
-
end
|
170
|
+
end
|