Skip to content

Commit

Permalink
Merge pull request #6 from sapcc/cleanup-upgrade-lib
Browse files Browse the repository at this point in the history
upgraded libs and ruby version
  • Loading branch information
ArtieReus authored May 30, 2022
2 parents 0b0663b + 99f5d89 commit c87fc48
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.7.6
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: ruby
rvm:
- 2.2.0
before_install: gem install bundler -v 1.13.1
- 2.7.6
before_install: gem install bundler -v 2.3.13
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# lyra-client

Ruby client to use the Lyra API

# Testing

Run following command:

```bash
bundle exec rspec
```
4 changes: 3 additions & 1 deletion lib/lyra_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def instantiate_collection(response)
end

def singleton_path(id, query_options = nil)
"#{path_prefix}/#{collection_name}/#{URI.escape(id.to_s)}#{query_string(query_options)}"
# changed URI.scape to CGI.escape as proposed here
# https://ruby-doc.org/stdlib-2.7.0/libdoc/uri/rdoc/URI/Escape.html
"#{path_prefix}/#{collection_name}/#{CGI.escape(id.to_s)}#{query_string(query_options)}"
end

def collection_path(query_options = nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/lyra_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module LyraClient
VERSION = "0.1.1"
VERSION = "0.2.0"
end
10 changes: 5 additions & 5 deletions lyra_client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
end
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.13"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency 'pry', '~> 0.10.3'
spec.add_development_dependency 'excon', '~> 0.52.0'
spec.add_development_dependency "bundler", "~> 2.3.13"
spec.add_development_dependency "rake", "~> 13.0.6"
spec.add_development_dependency "rspec", "~> 3.11.0"
spec.add_development_dependency 'pry', '~> 0.14.1'
spec.add_development_dependency 'excon', '~> 0.92.3'
end
10 changes: 9 additions & 1 deletion spec/lyra_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ class LyraClientTestFindClass < LyraClient::Base
expect(one.attributes).to be == element
end

it "should encode the id" do
element = FakeFactory.automation('id' => "test test")
Excon.stub({path: "/api/v1/automations/test+test", method: 'get'}, {:body => element.to_json, :status => 200})

one = LyraClientTestFindClass.find("test test", {"X-Auth-Token" => 'this_is_a_token'})
expect(one.attributes).to be == element
end

end

end
Expand Down Expand Up @@ -236,7 +244,7 @@ class LyraClientTestCollectionClass < LyraClient::Base

it "should raise an exception when no 200 or 201" do
Excon.stub({}, {:body => "Not found", :status => 404})
expect { LyraClientTestFindClass.find("1") }.to raise_error
expect { LyraClientTestFindClass.find("1") }.to raise_error(Excon::Error::NotFound)
end

end
Expand Down

0 comments on commit c87fc48

Please sign in to comment.