kooaba 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,24 +17,24 @@ This is a lightweight gem (no other dependencies) for accessing the [kooaba APIs
17
17
 
18
18
  ## Uploading an item
19
19
 
20
- In order to upload items into your account, you need an UPLOAD\_KEY and a BUCKET\_ID. Both of these you can find in your account at https://platform.kooaba.com .
20
+ In order to upload items into your account, you need a `data-key` and a `bucket-id`. The `data-key` you can find on your account on the [kooaba platform](https://platform.kooaba.com), under API Access -> Data API Keys. You need to use the `secret-token` string. The bucket id you find under the Reference Items section.
21
21
 
22
22
  require 'rubygems'
23
23
  require 'kooaba'
24
24
 
25
- # set the upload key
26
- Kooaba.upload_key = <UPLOAD_KEY>
25
+ # set the data key
26
+ Kooaba.data_key = <data-key-secret-token>
27
27
 
28
28
  # initialize the item
29
29
  item = Kooaba::Item.new(
30
30
  :title => "A lake",
31
31
  :metadata => nil,
32
- :image_files => <PATH_TO_IMAGE_ON_LOCAL_SYSTEM>,
32
+ :image_files => <path-to-image-on-local-filesystem>,
33
33
  :referenceId => "lake"
34
34
  )
35
35
 
36
36
  # select the bucket you want to put the item into
37
- bucket_id = <BUCKET_ID>
37
+ bucket_id = <bucket-id>
38
38
 
39
39
  # upload the item
40
40
  response = Kooaba.upload(item, bucket_id)
@@ -52,16 +52,16 @@ The reponse will look like:
52
52
 
53
53
  ## Making a query
54
54
 
55
- To make a query you need a QUERY_KEY which you can find under the API Access section in your account at https://platform.kooaba.com .
55
+ To make a query you need a `query-key` which you can find under the API Access -> Query API Keys section in your [kooaba account](https://platform.kooaba.com). You need to use the `secret-token` string.
56
56
 
57
57
  require 'rubygems'
58
58
  require 'kooaba'
59
59
 
60
60
  # set the query key
61
- Kooaba.query_key = <QUERY_KEY>
61
+ Kooaba.query_key = <query-key-secret-token>
62
62
 
63
63
  # send the query to the kooaba servers
64
- query = Kooaba::Query.new(:image_path => <PATH_TO_QUERY_IMAGE_ON_LOCAL_SYSTEM>)
64
+ query = Kooaba::Query.new(:image_path => <path-to-query-image-on-local-filesystem>)
65
65
  response = Kooaba.query(query)
66
66
 
67
67
  # inspect the result
data/examples/query.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require File.join(File.dirname(__FILE__), "..", "lib", "kooaba.rb")
2
2
 
3
3
  # set the query key
4
- Kooaba.query_key = <QUERY_KEY>
4
+ Kooaba.query_key = <query-key-secret-token>
5
5
 
6
6
  # send the query to the kooaba servers
7
- query = Kooaba::Query.new(:image_path => <PATH_TO_IMAGE>)
7
+ query = Kooaba::Query.new(:image_path => <path-to-image>)
8
8
  response = Kooaba.query(query)
9
9
 
10
10
  # inspect the result
data/examples/upload.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  require File.join(File.dirname(__FILE__), "..", "lib", "kooaba.rb")
2
2
 
3
- # set the upload key
4
- Kooaba.upload_key = <UPLOAD_KEY>
3
+ # set the data key
4
+ Kooaba.data_key = <data-key-secret-token>
5
5
 
6
6
  # initialize the item
7
7
  item = Kooaba::Item.new(
8
8
  :title => "A lake",
9
9
  :metadata => nil,
10
- :image_files => <PATH_TO_IMAGE>,
10
+ :image_files => <path-to-image-on-local-filesystem>,
11
11
  :referenceId => "lake"
12
12
  )
13
13
 
data/lib/kooaba/base.rb CHANGED
@@ -2,16 +2,16 @@ module Kooaba
2
2
  QUERY_URL = "https://query-api.kooaba.com/v4/"
3
3
  UPLOAD_URL = "https://upload-api.kooaba.com/api/v4/"
4
4
 
5
- def self.upload_key=(upload_key)
6
- @@upload_key = upload_key
5
+ def self.data_key=(data_key)
6
+ @@data_key = data_key
7
7
  end
8
8
 
9
9
  def self.query_key=(query_key)
10
10
  @@query_key = query_key
11
11
  end
12
12
 
13
- def self.upload_key
14
- @@upload_key
13
+ def self.data_key
14
+ @@data_key
15
15
  end
16
16
 
17
17
  def self.query_key
@@ -39,7 +39,7 @@ module Kooaba
39
39
  req.body = @message.body
40
40
  req['date'] = Time.new.httpdate
41
41
  req['content-type'] = @message.content_type
42
- req['authorization'] = "Token #{Kooaba.upload_key}"
42
+ req['authorization'] = "Token #{Kooaba.data_key}"
43
43
 
44
44
  http.start { |h| h.request(req) }
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module Kooaba
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kooaba
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cristi Prodan