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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31fc0c7d85affb2fb20f9997bb0c269e55d322db
4
- data.tar.gz: e320d9f0e2cad1f809c5cfd31a73ae8bcda48308
3
+ metadata.gz: 777ac8c55cce65ec92604459dc0fc53110335a93
4
+ data.tar.gz: 60bae2c88bb8de68c57519bf0a2de8a8e45c6054
5
5
  SHA512:
6
- metadata.gz: 7bfa10688c67662e66c25af1cd8f3efdaede9a277ec62861ff4eab32ad83ca1cd844407554389d0b460ce56c9ba11c20a9edca120ebad59997126d3d0bee162e
7
- data.tar.gz: e8f247cdd0a7f6dc867a057f3ca3dcfd4c081f694034f0f2d8f7b8c5e4effd6c91b1679fb09bf90c416b4adc049ac54bedc9d4fba13a394e13f98ba6cbcbdfff
6
+ metadata.gz: a6e1f7d7b4de0bc4a567b7d63ca52b2b25ccc1239028c765b37f6e927734ee4f319ef074fcd39e8613b9354254064c30e80a90bfa350a2f8856f05bd5ef7ab6b
7
+ data.tar.gz: 670b9b11f07024dd2b0fed538217b391ad01dd14ff6c16748fdbb00f5f51299bc2c383d6a2fb77ebd8b8ad68038d0939f97ba71e9f55f4059c2ed97144def174
data/README.md CHANGED
@@ -9,7 +9,7 @@ Reittiopas 2 is a simple Ruby library for accessing the [Reittiopas API][API].
9
9
 
10
10
  Install using [Bundler][]:
11
11
 
12
- gem 'reittiopas2', '~> 0.0.3'
12
+ gem 'reittiopas2', '~> 0.0.5'
13
13
 
14
14
  [Bundler]: http://bundler.io/
15
15
 
@@ -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(@base_url)
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)
@@ -1,3 +1,3 @@
1
1
  class Reittiopas2
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/reittiopas2.rb CHANGED
@@ -11,5 +11,9 @@ class Reittiopas2
11
11
  def initialize(username, password)
12
12
  @client = Reittiopas2::Client.new(username, password)
13
13
  end
14
+
15
+ def self.base_url
16
+ Reittiopas2::Client::BASE_URL
17
+ end
14
18
  end
15
19
 
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
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-01-20 00:00:00.000000000 Z
12
+ date: 2014-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json