reittiopas2 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/reittiopas2/client.rb +3 -2
- data/lib/reittiopas2/version.rb +1 -1
- data/lib/reittiopas2.rb +4 -0
- data/spec/client_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777ac8c55cce65ec92604459dc0fc53110335a93
|
4
|
+
data.tar.gz: 60bae2c88bb8de68c57519bf0a2de8a8e45c6054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e1f7d7b4de0bc4a567b7d63ca52b2b25ccc1239028c765b37f6e927734ee4f319ef074fcd39e8613b9354254064c30e80a90bfa350a2f8856f05bd5ef7ab6b
|
7
|
+
data.tar.gz: 670b9b11f07024dd2b0fed538217b391ad01dd14ff6c16748fdbb00f5f51299bc2c383d6a2fb77ebd8b8ad68038d0939f97ba71e9f55f4059c2ed97144def174
|
data/README.md
CHANGED
data/lib/reittiopas2/client.rb
CHANGED
@@ -14,8 +14,9 @@ class Reittiopas2
|
|
14
14
|
class Client
|
15
15
|
include Utilities
|
16
16
|
|
17
|
+
BASE_URL = "http://api.reittiopas.fi/hsl/prod/"
|
18
|
+
|
17
19
|
def initialize(username, password)
|
18
|
-
@base_url = "http://api.reittiopas.fi/hsl/prod/"
|
19
20
|
@base_query = {"user" => username, "pass" => password}
|
20
21
|
end
|
21
22
|
|
@@ -35,7 +36,7 @@ class Reittiopas2
|
|
35
36
|
# key 'error' containing error message.
|
36
37
|
def perform_query(query={})
|
37
38
|
query = convert_array_values(query)
|
38
|
-
uri = Addressable::URI.parse(
|
39
|
+
uri = Addressable::URI.parse(BASE_URL)
|
39
40
|
uri.query_values = @base_query.merge(query)
|
40
41
|
|
41
42
|
res = Net::HTTP.get_response(uri)
|
data/lib/reittiopas2/version.rb
CHANGED
data/lib/reittiopas2.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -10,6 +10,12 @@ describe Reittiopas2::Client do
|
|
10
10
|
@query = {"user" => @user, "pass" => @pwd}
|
11
11
|
end
|
12
12
|
|
13
|
+
describe "base_url getter" do
|
14
|
+
it "should give url to api endpoint for easier stubbing" do
|
15
|
+
Reittiopas2::base_url.should == @base_url
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
13
19
|
describe "query forming" do
|
14
20
|
it "should put pipes into arrays" do
|
15
21
|
q = @query.merge({ "array" => ["one", "two", "three"] })
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reittiopas2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iivari Äikäs
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|