gracenote 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gracenote.rb +4 -2
- data/lib/gracenote/HTTP.rb +26 -25
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bef5d85e077a1105e732be2f48d752f0a8d4d461
|
4
|
+
data.tar.gz: 69da1b11b881b34bbd777d52a222df0c870acdff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d7f5b49d757be36fd99c726269b37a9ff3ab201e49362347f37d005d0a759817137018bb5535bccf8e9fd48cf06a8c87a1d491cefa1c17318e2aaa8b86d812
|
7
|
+
data.tar.gz: c29724bd101476f6d422c8c3299eb2b7d9ff9b0e6338b5d55b9b5f9c71cdfb58a2fcbc2084a7d47c7f22a93992733ae7c78b95dd2eedc0f6a726c6f443058806
|
data/lib/gracenote.rb
CHANGED
@@ -7,6 +7,8 @@ class Gracenote
|
|
7
7
|
@@ALL_RESULTS = '1'
|
8
8
|
@@BEST_MATCH_ONLY = '0'
|
9
9
|
|
10
|
+
attr_accessor :clientID, :clientTag, :userID, :apiURL
|
11
|
+
|
10
12
|
# Function: initialize
|
11
13
|
# Sets the following instance variables
|
12
14
|
# clientID
|
@@ -38,7 +40,7 @@ class Gracenote
|
|
38
40
|
end
|
39
41
|
|
40
42
|
if not @userID.nil?
|
41
|
-
|
43
|
+
puts "user already registered. No need to register again"
|
42
44
|
return @userID
|
43
45
|
end
|
44
46
|
|
@@ -250,7 +252,7 @@ class Gracenote
|
|
250
252
|
# Arguments:
|
251
253
|
# query
|
252
254
|
def api (query)
|
253
|
-
return HTTP.post(@apiURL, query)
|
255
|
+
return Gracenote::HTTP.post(@apiURL, query)
|
254
256
|
end
|
255
257
|
|
256
258
|
# Function: constructQueryReq
|
data/lib/gracenote/HTTP.rb
CHANGED
@@ -9,33 +9,34 @@ require 'curb'
|
|
9
9
|
require 'rack'
|
10
10
|
require 'uri'
|
11
11
|
|
12
|
-
class
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
resp = req.get( uri.path, headers)
|
21
|
-
return resp
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.post(path, data='', cookie='')
|
25
|
-
uri = URI(path)
|
26
|
-
req = Net::HTTP.new(uri.host, uri.port)
|
27
|
-
req.read_timeout = 60
|
28
|
-
req.use_ssl = (uri.scheme == "https") ? true : false
|
29
|
-
headers = {'Cookie' => cookie, "Content-Type" => "application/xml"}
|
12
|
+
class Gracenote
|
13
|
+
class HTTP
|
14
|
+
def self.get(path, cookie='')
|
15
|
+
uri = URI(path)
|
16
|
+
req = Net::HTTP.new(uri.host, uri.port)
|
17
|
+
req.read_timeout = 60
|
18
|
+
req.use_ssl = (uri.scheme == "https") ? true : false
|
19
|
+
headers = {'Cookie' => cookie}
|
30
20
|
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
reqdata = Rack::Utils.build_nested_query(data)
|
21
|
+
resp = req.get( uri.path, headers)
|
22
|
+
return resp
|
35
23
|
end
|
36
24
|
|
37
|
-
|
38
|
-
|
39
|
-
|
25
|
+
def self.post(path, data='', cookie='')
|
26
|
+
uri = URI(path)
|
27
|
+
req = Net::HTTP.new(uri.host, uri.port)
|
28
|
+
req.read_timeout = 60
|
29
|
+
req.use_ssl = (uri.scheme == "https") ? true : false
|
30
|
+
headers = {'Cookie' => cookie, "Content-Type" => "application/xml"}
|
31
|
+
|
32
|
+
if data.class.to_s == 'String'
|
33
|
+
reqdata = data;
|
34
|
+
else
|
35
|
+
reqdata = Rack::Utils.build_nested_query(data)
|
36
|
+
end
|
40
37
|
|
38
|
+
resp = req.request_post( uri.path, reqdata, headers)
|
39
|
+
return resp
|
40
|
+
end
|
41
|
+
end
|
41
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gracenote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nobelium
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: curb
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - '>='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: Gracenote web api gem
|
70
98
|
email:
|
71
99
|
- me@vignesh.info
|
@@ -95,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
123
|
version: '0'
|
96
124
|
requirements: []
|
97
125
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.0.14
|
99
127
|
signing_key:
|
100
128
|
specification_version: 4
|
101
129
|
summary: This gem is a wrapper for the gracenote web api
|