sports_south 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sports_south.rb +2 -0
- data/lib/sports_south/base.rb +2 -0
- data/lib/sports_south/rotator.rb +35 -0
- data/lib/sports_south/version.rb +1 -1
- data/sports_south.gemspec +3 -0
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de313626597cdbf14ae1edd85a56e05fba986ea2
|
4
|
+
data.tar.gz: b23792c4092a401d0040d7afd401d61d0a3537b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01860dea085cc73a7a5fb021ba8d4498f7d9555a83ec2cb9dd846edf9d5d733f36aafe235a5ba481d2b106cd0d087220d6c7e9eb3191cb22c9b1df328c00e0fb
|
7
|
+
data.tar.gz: a63d288db706ece19ead28fec4da3ca7d8b01866b8256782221023ef639d7ffba95c869d967116c88a62edcd15efb00b4e494add7863efe5e8fc3b520cd56e76
|
data/lib/sports_south.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'sports_south/version'
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'net/http'
|
4
5
|
require 'nokogiri'
|
5
6
|
|
@@ -11,6 +12,7 @@ require 'sports_south/image'
|
|
11
12
|
require 'sports_south/inventory'
|
12
13
|
require 'sports_south/invoice'
|
13
14
|
require 'sports_south/order'
|
15
|
+
require 'sports_south/rotator'
|
14
16
|
require 'sports_south/user'
|
15
17
|
|
16
18
|
module SportsSouth
|
data/lib/sports_south/base.rb
CHANGED
@@ -3,6 +3,7 @@ module SportsSouth
|
|
3
3
|
class Base
|
4
4
|
|
5
5
|
TIMEOUT = 960 # seconds
|
6
|
+
USER_AGENT = "sports_south rubygems.org/gems/sports_south v(#{SportsSouth::VERSION})"
|
6
7
|
|
7
8
|
protected
|
8
9
|
|
@@ -43,6 +44,7 @@ module SportsSouth
|
|
43
44
|
http = Net::HTTP.new(uri.host, uri.port)
|
44
45
|
http.read_timeout = TIMEOUT
|
45
46
|
request = Net::HTTP::Post.new(uri.request_uri)
|
47
|
+
request["User-Agent"] = USER_AGENT
|
46
48
|
|
47
49
|
return http, request
|
48
50
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module SportsSouth
|
2
|
+
class Rotator
|
3
|
+
|
4
|
+
API_URL = 'http://tsw-api.com/images/rotator/check.php'
|
5
|
+
|
6
|
+
|
7
|
+
def self.check(api_user_id, api_key, *items)
|
8
|
+
new(api_user_id, api_key).check(items)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(api_user_id, api_key)
|
12
|
+
@api_user_id = api_user_id
|
13
|
+
@api_key = api_key
|
14
|
+
end
|
15
|
+
|
16
|
+
def check(*items)
|
17
|
+
params = {
|
18
|
+
u: @api_user_id,
|
19
|
+
k: @api_key,
|
20
|
+
}
|
21
|
+
|
22
|
+
params[:i] = items.is_a?(String) ? items.first : items.join(',')
|
23
|
+
|
24
|
+
uri = URI(API_URL)
|
25
|
+
uri.query = URI.encode_www_form(params)
|
26
|
+
|
27
|
+
response = Net::HTTP.get_response(uri)
|
28
|
+
|
29
|
+
results = {}
|
30
|
+
JSON.parse(response.body).each { |k, v| results[k] = v == 'true' }
|
31
|
+
results
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/sports_south/version.rb
CHANGED
data/sports_south.gemspec
CHANGED
@@ -4,6 +4,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'sports_south/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = '~> 2.0'
|
8
|
+
|
7
9
|
spec.name = "sports_south"
|
8
10
|
spec.version = SportsSouth::VERSION
|
9
11
|
spec.authors = ["Dale Campbell"]
|
@@ -24,4 +26,5 @@ Gem::Specification.new do |spec|
|
|
24
26
|
spec.add_development_dependency "net-http-spy", "~> 0.2"
|
25
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
28
|
spec.add_development_dependency "rspec", "~> 3.3"
|
29
|
+
spec.add_development_dependency "webmock", "~> 1.20"
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sports_south
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.20'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.20'
|
83
97
|
description: Sports South API Ruby library.
|
84
98
|
email:
|
85
99
|
- oshuma@gmail.com
|
@@ -107,6 +121,7 @@ files:
|
|
107
121
|
- lib/sports_south/inventory.rb
|
108
122
|
- lib/sports_south/invoice.rb
|
109
123
|
- lib/sports_south/order.rb
|
124
|
+
- lib/sports_south/rotator.rb
|
110
125
|
- lib/sports_south/user.rb
|
111
126
|
- lib/sports_south/version.rb
|
112
127
|
- sports_south.gemspec
|
@@ -120,9 +135,9 @@ require_paths:
|
|
120
135
|
- lib
|
121
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
137
|
requirements:
|
123
|
-
- - "
|
138
|
+
- - "~>"
|
124
139
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
140
|
+
version: '2.0'
|
126
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
142
|
requirements:
|
128
143
|
- - ">="
|
@@ -130,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
145
|
version: '0'
|
131
146
|
requirements: []
|
132
147
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.4.
|
148
|
+
rubygems_version: 2.4.5
|
134
149
|
signing_key:
|
135
150
|
specification_version: 4
|
136
151
|
summary: Sports South API Ruby library.
|