6px 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/6px/client.rb +6 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWQ4OTEyNWJkYWM2MmNkNzI0NzQ3YjcxMTM4Mjg3OGM1MmVlZDEzMg==
4
+ NDI5M2I3OTI1YTkxNjkzMWYwYjc2YTU3ZDUxOWFlN2FmYjc2ZWY4ZA==
5
5
  data.tar.gz: !binary |-
6
- Yzg3NWIxZDc2ZTcyNzk4YzhlNjJkMDVjOGExNWM5MmUyNDkzM2E3Nw==
6
+ ZTg0N2EwZWUyNmE2YmNkMWNjYTI5MDZjNzFjZDY0YjUwZWY1MGJlZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmYxMWE3N2E2NWMzZjAzZmU5ZGNhZjdkM2U1MzllNmQ0Nzg0OTJmZTcwN2I2
10
- MjM0NzZjNzRlYThmYjQ1ZDA0NjQxMzI3MjAxMDYxMmVlMTM0MzFiNjZiZGI5
11
- ODE3NzFlODM5MzUxZjY0NzlmNWNhMjRjOGRjYjI5YmFlMzhiOTg=
9
+ M2ZlMTZjNDA2OTY5YzZhMTM2YmNmZDA0Mjg5MjdhMDQ3Mzg3OTlhZGIwNzhh
10
+ YmZjNjAzZGFhNTYxOTUwZjdkOTAzYzE5MmQwZDg0OWZjMzVmMDg0NzQ0YmU2
11
+ ZDliNmFmMTVlYWI5Y2NlYWUzNWUyOThkZWUxNzIwY2VjMzY4N2E=
12
12
  data.tar.gz: !binary |-
13
- ZDA0NDE0NmIzZTM5NGY3Yzc3NDc2MjI3NzhkNjI3MWI0MmNhOTJkYWVlYmM5
14
- ZmY4NmMyM2UzM2FkZDBiMDg0M2MzNzI1YjQ2MmI2Mzc3ZjcyNGFkOWQ5NGUy
15
- OWZhNmM2NzIxM2I3Y2Y5ZDBmY2Y4ZTE3ZGMzYjdmZDY0NTdkN2Y=
13
+ OWQwZmJkMDgzZmNiNDUwYjc0YmJlNWM0MDVmODM4MWUzYmYxY2Q3NWI0YjY0
14
+ NDM0ZGMxMzFkYjhhOTIyM2IzMTEzMmZmOGQzZjRjNWMwNTU5NzA5YWE4YWRi
15
+ NTg1ZTE3NzM5MDZlMWUyMzgxNzdiYmNjMDIyNGU0N2QzODFiYzE=
@@ -6,7 +6,7 @@ class PX
6
6
 
7
7
  METHOD_NAMES = [:rotate, :resize, :crop, :filter, :layer, :analyze]
8
8
 
9
- base_uri 'https://api.6px.io/v1/'
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 << "/users/#{user_id}/"
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
- puts payload
104
- response = self.class.post("jobs", body: payload).body
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 6px
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Leonard