ts_json_api 0.1.0 → 0.1.1

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.
data/README.md CHANGED
@@ -4,6 +4,12 @@ Use this gem to consume the T&S JSON API provided for live & summary race data.
4
4
 
5
5
  ## Installation
6
6
 
7
+ Add the gem to your Gemfile
8
+
9
+ ```ruby
10
+ gem 'ts_json_api'
11
+ ```
12
+
7
13
  Run the following rails generator to setup the gem
8
14
 
9
15
  > rails g ts_json_api:install
@@ -7,6 +7,7 @@ module TsJsonApi
7
7
  TsJsonApi::Configure.setup do |config|
8
8
  config.username = ""
9
9
  config.password = ""
10
+ config.api_version = 2
10
11
  config.logging_enabled = true
11
12
  config.server_url = ""
12
13
  end
@@ -29,6 +29,14 @@ module TsJsonApi
29
29
  @@server_url
30
30
  end
31
31
 
32
+ def api_version=(v)
33
+ @@api_version = v
34
+ end
35
+
36
+ def api_version
37
+ @@api_version ||= 2
38
+ end
39
+
32
40
  def logging_enabled=(b)
33
41
  @@logging_enabled = b
34
42
  end
@@ -13,7 +13,7 @@ module TsJsonApi
13
13
 
14
14
  url = "#{Configure.server_url}#{partial_url}"
15
15
 
16
- response = api[partial_url].get accept: :json
16
+ response = api[partial_url].get
17
17
  json = response.to_str
18
18
  json.gsub!(/[^\x20-\x7e]/,'')
19
19
 
@@ -44,7 +44,7 @@ module TsJsonApi
44
44
  end
45
45
 
46
46
  def api
47
- @@api ||= RestClient::Resource.new(Configure.server_url, user: Configure.username, password: Configure.password, timeout: 20)
47
+ @@api ||= RestClient::Resource.new(Configure.server_url, user: Configure.username, password: Configure.password, timeout: 20, headers: { accept: "application/json;version=#{Configure.api_version}"})
48
48
  end
49
49
 
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module TsJsonApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts_json_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -130,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: 4083627172601262233
133
+ hash: -2334037871197059931
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  none: false
136
136
  requirements:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: 4083627172601262233
142
+ hash: -2334037871197059931
143
143
  requirements: []
144
144
  rubyforge_project:
145
145
  rubygems_version: 1.8.24