go_transit 0.8.1 → 0.10.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
  SHA256:
3
- metadata.gz: ac02d098fdf5e075c7be0c91f350223859f93642bf716da5705eff59b30fb053
4
- data.tar.gz: 1c3d0ae74df441298dc26fd4d82075183166d6a2096ca304b1e69f80c71e2304
3
+ metadata.gz: d1e669745c174a770740b1453b328300650afc78403956892b5f6d5d46905e6f
4
+ data.tar.gz: bf0bb3309089e4f8453a33d925d40f5cd540d79491f3c7657b7f2a8ecc2de295
5
5
  SHA512:
6
- metadata.gz: 2ef5935c2c0a985620d94b2866bb667af52775814ecf7ea6df77c868c92f2be62a21caa16b2b02d9690ecf506458b6fb1f79054e9768958b664b02dfc0503c1b
7
- data.tar.gz: 60e1819e3b878c7b800216284ca9b14b7f8768c35150c63af976d36624119df71cbbe26320c0108df3945bc1e8bd17efc626e5f5e0bc5a3fcd183c9e02961144
6
+ metadata.gz: 86411a5ad705eaf2beb261344ec4753c65bd6fae0f49ee08afb9d9aafd5f3ef00ea9002a9a0d2356bf20121e5075d561794133aa923b499fcd676e4b87e2ae44
7
+ data.tar.gz: fbb987e716899e21a808c4c1529ddb613c33d50da11fc4725385bf1905c76284abb084928db15f489c154ecc223adce0ed5425a4a432f2f5299365a6f8fa54de
@@ -3,11 +3,11 @@ require "net/http"
3
3
 
4
4
  module GoTransit
5
5
  class Client
6
- BASE_URL = "http://api.openmetrolinx.com/OpenDataAPI/api".freeze
7
6
  API_VERSION = "V1".freeze
8
7
 
9
8
  def get(path)
10
- uri = URI("#{BASE_URL}/#{API_VERSION}/#{path}?key=#{GoTransit.api_key}")
9
+ uri = URI("#{GoTransit.base_url}/#{API_VERSION}/#{path}"\
10
+ "?key=#{GoTransit.api_key}")
11
11
  response = Net::HTTP.get_response(uri)
12
12
  json = JSON.parse(response.body)
13
13
  Response.new(json)
@@ -4,6 +4,7 @@ module GoTransit
4
4
  :time, :stops
5
5
 
6
6
  def platforms
7
+ return if platform == "-"
7
8
  platform.split("&").collect(&:strip)
8
9
  end
9
10
 
@@ -1,3 +1,3 @@
1
1
  module GoTransit
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.10.0".freeze
3
3
  end
data/lib/go_transit.rb CHANGED
@@ -62,6 +62,14 @@ module GoTransit
62
62
  @api_key = ""
63
63
 
64
64
  class << self
65
- attr_accessor :api_key
65
+ attr_accessor :api_key, :custom_base_url
66
+
67
+ def configure
68
+ yield self
69
+ end
70
+
71
+ def base_url
72
+ custom_base_url || "http://api.openmetrolinx.com/OpenDataAPI/api"
73
+ end
66
74
  end
67
75
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_transit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Mazur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "<="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 7.0.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "<="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 7.0.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement