go_transit 0.8.1 → 0.9.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: 54aad8332d8b5bc0889179609017fe97dfb81ebbf10b6c5e260d710baa469cc0
4
+ data.tar.gz: 1f51df5e8755eabfb6d9add2d32df843ce0218b4bcf8f2862afce5671060bff1
5
5
  SHA512:
6
- metadata.gz: 2ef5935c2c0a985620d94b2866bb667af52775814ecf7ea6df77c868c92f2be62a21caa16b2b02d9690ecf506458b6fb1f79054e9768958b664b02dfc0503c1b
7
- data.tar.gz: 60e1819e3b878c7b800216284ca9b14b7f8768c35150c63af976d36624119df71cbbe26320c0108df3945bc1e8bd17efc626e5f5e0bc5a3fcd183c9e02961144
6
+ metadata.gz: a7178548ace998be435aa218dde735ed46fac843e5a8124e478b58887bbe9fb9e0cb28bf87785d572f0bb99ef0856a94237fbed5f731247ce3a58dd44a0c3d35
7
+ data.tar.gz: acb8c58c71027454a2df4b3245aa7aa105dffb9c7a1e962b43722989914e313c823f25fea42a85177fb3e154132e555971e6dbd77df4c6f2a11008d0fddbed3f
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module GoTransit
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.9.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.9.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-10-07 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