havenondemand 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a52f32e712338fbd323f1e7a584ab9f3fc44cc03
4
- data.tar.gz: e37d432c750aea108909076cf0a0e63e1f2c02bd
3
+ metadata.gz: 125ae7854ef9fda55dc410583ff13202ad75a39a
4
+ data.tar.gz: b7a8b4c3e57a441a83efd8dbf3b57ec20fef2f0f
5
5
  SHA512:
6
- metadata.gz: 9831a62983b60163edd61293f9462825769bacae05331037af3994745dc7be5aa7f5aa3c77da47d7a1bee8bfd32798342cc2907e63a98b43b184cd1257542ca9
7
- data.tar.gz: 30f9608b194bdbb656a0895509ba6af352466f9f3fbb95fc4b9b69ff635ac3cb90b4dc90d679238b98d6a6f8c69f5c81aa2c4ff08d6d31699611448ab6a1e8cc
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 client library to help with calling Haven OnDemand APIs [http://havenondemand.com](http://havenondemand.com).
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("http://api.idolondemand.com", $apikey)
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
- All that is needed to initialize the client is an apikey and the url of the API.
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
 
@@ -56,11 +56,14 @@ end
56
56
 
57
57
  class HODClient
58
58
  @@version=1
59
- @@apidefault=1
60
- def initialize(url, apikey)
59
+ @@apidefault="v1"
60
+ def initialize(apikey, version="v1")
61
61
  # Instance variables
62
-
63
- @url = url
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}/v#{@@apidefault}",
143
+ response=Unirest.post "#{@url}/#{@@version}/api/#{syncpath}/#{handler}/#{@@apidefault}",
141
144
  headers:{ "Accept" => "application/json", "Content-Type" => "application/json"},
142
- parameters:data.to_json
145
+ parameters:data
143
146
  if response.code == 200
144
147
 
145
148
  if async
@@ -1,3 +1,3 @@
1
1
  module Havenondemand
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
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.0.0
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-10-08 00:00:00.000000000 Z
12
+ date: 2015-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: unirest