6px 0.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 +7 -0
- data/lib/6px.rb +4 -0
- data/lib/6px/client.rb +50 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8448153968fead44cd21f3249f158e18f6073b07
|
4
|
+
data.tar.gz: 62b527644776a007bea8b755422ceba78be49b30
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f71105dd955335742b01b005d1812e2fc885fd11c45446f11d285f336d248aef414a43cff39b92fbeb12b412b5e754d68ef5d459b1df05df12eefcb13394fc1
|
7
|
+
data.tar.gz: b84a433ac38fd46114336d8ea0f440ab2a7b4a74a7ec6b0f250b984121ef932665e80f487f9419a332f74dcc07969e78b484ff0837471afc4b2162f1787915b0
|
data/lib/6px.rb
ADDED
data/lib/6px/client.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class SixPX
|
2
|
+
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
base_uri 'https://api.6px.io/v1/'
|
6
|
+
headers 'Content-Type' => 'application/json'
|
7
|
+
|
8
|
+
# Set up the authroized url and parameters
|
9
|
+
def initialize(args)
|
10
|
+
user_id = args[:user_id]
|
11
|
+
api_key = args[:api_key]
|
12
|
+
api_secret = args[:api_secret]
|
13
|
+
self.class.base_uri << "/users/#{user_id}/"
|
14
|
+
self.class.default_params key: api_key, secret: api_secret
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def jobs(*query)
|
19
|
+
response = self.class.get("jobs", query: query.first)
|
20
|
+
ap JSON.parse(response.body)
|
21
|
+
return JSON.parse(response.body)
|
22
|
+
end
|
23
|
+
|
24
|
+
def process_images(inputs, methods, output_format='jpeg', destination="")
|
25
|
+
payload = build_payload(inputs, methods, output_format, destination)
|
26
|
+
|
27
|
+
self.class.post("jobs", body: payload.to_json)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_payload(inputs, methods, output_format, destination)
|
33
|
+
{
|
34
|
+
input: inputs,
|
35
|
+
output: [
|
36
|
+
{
|
37
|
+
methods: methods,
|
38
|
+
type: "image/#{output_format}",
|
39
|
+
ref: {
|
40
|
+
'img1' => false,
|
41
|
+
'img2' => false,
|
42
|
+
'img3' => false,
|
43
|
+
'img4' => false
|
44
|
+
},
|
45
|
+
url: destination
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: 6px
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Quaranto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2010-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
description: Ruby wrapper for 6px's API
|
42
|
+
email: mattleonardco@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/6px.rb
|
48
|
+
- lib/6px/client.rb
|
49
|
+
homepage: http://rubygems.org/gems/hola
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.2.2
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: 6px API wrapper
|
73
|
+
test_files: []
|