havenondemand 1.0.0 → 1.1.0
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 +4 -4
- data/.DS_Store +0 -0
- data/README.md +6 -5
- data/lib/havenondemand.rb +9 -6
- data/lib/havenondemand/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125ae7854ef9fda55dc410583ff13202ad75a39a
|
4
|
+
data.tar.gz: b7a8b4c3e57a441a83efd8dbf3b57ec20fef2f0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a59d5357025e6fa147c143f2ed1bc9d4f65c195580c521f9e9e1c3e9464a5e835a3ce3be23bd658077561664b8beb6d5dc485e5000a64e9e39bc51775e920112
|
7
|
+
data.tar.gz: 2d18103c08f4e87a64e635fcfc418ae6e454373fb3eacb03a2a2b50118fd843e78458ca26dc18a0c516240e5b7ac7886835307523e0791f2caf45e7aac6b0269
|
data/.DS_Store
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
**Note:** use `iod` branch for older compatibility syntax.
|
2
|
+
|
1
3
|
# Ruby gem for Haven OnDemand
|
2
|
-
Official
|
4
|
+
Official Ruby gem to help with calling Haven OnDemand APIs [http://havenondemand.com](http://havenondemand.com). Gem is hosted on rubygems.org [here](https://rubygems.org/gems/havenondemand).
|
3
5
|
|
4
6
|
## What is Haven OnDemand?
|
5
7
|
Haven OnDemand is a set of over 70 APIs for handling all sorts of unstructured data. Here are just some of our APIs' capabilities:
|
@@ -47,13 +49,12 @@ require "havenondemand"
|
|
47
49
|
```
|
48
50
|
|
49
51
|
###Initializing the client
|
50
|
-
*Note*: URL endpoint will change in the near future to
|
51
52
|
```ruby
|
52
|
-
client = HODClient.new(
|
53
|
+
client = HODClient.new(apikey, version)
|
53
54
|
```
|
55
|
+
You can find your API key [here](https://www.haveondemand.com/account/api-keys.html) after signing up.
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
+
`version` is an optional parameter (defaults to `'v1'`) and can be either `'v1'` or `'v2'`.
|
57
58
|
|
58
59
|
###Sending requests
|
59
60
|
|
data/lib/havenondemand.rb
CHANGED
@@ -56,11 +56,14 @@ end
|
|
56
56
|
|
57
57
|
class HODClient
|
58
58
|
@@version=1
|
59
|
-
@@apidefault=
|
60
|
-
def initialize(
|
59
|
+
@@apidefault="v1"
|
60
|
+
def initialize(apikey, version="v1")
|
61
61
|
# Instance variables
|
62
|
-
|
63
|
-
|
62
|
+
if apikey=='http://api.havenondemand.com' || apikey=='http://api.havenondemand.com/' || apikey=='https://api.havenondemand.com' || apikey=='https://api.havenondemand.com/'
|
63
|
+
raise ArgumentError, "Using an outdated wrapper constructor method. No need to include API URL.\nInclude as such:\n client = HODClient(API_KEY, VERSION)\n where version is optional"
|
64
|
+
end
|
65
|
+
@@apidefault=version
|
66
|
+
@url = "https://api.havenondemand.com"
|
64
67
|
@apikey = apikey
|
65
68
|
|
66
69
|
end
|
@@ -137,9 +140,9 @@ class HODClient
|
|
137
140
|
syncpath="async"
|
138
141
|
end
|
139
142
|
Unirest.timeout(30)
|
140
|
-
response=Unirest.post "#{@url}/#{@@version}/api/#{syncpath}/#{handler}
|
143
|
+
response=Unirest.post "#{@url}/#{@@version}/api/#{syncpath}/#{handler}/#{@@apidefault}",
|
141
144
|
headers:{ "Accept" => "application/json", "Content-Type" => "application/json"},
|
142
|
-
parameters:data
|
145
|
+
parameters:data
|
143
146
|
if response.code == 200
|
144
147
|
|
145
148
|
if async
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: havenondemand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Nappy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: unirest
|