caseblocks_api 0.2.4 → 0.2.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "caseblocks_api"
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Provan"]
@@ -40,8 +40,12 @@ module CaseblocksAPI
40
40
 
41
41
  def find_case_type_by_name(case_type_name)
42
42
  @case_types = self.class.get("/case_blocks/case_types")["case_types"]
43
- case_type = @case_types.select { |k| k.has_key? case_type_name }
44
- return case_type.first[case_type_name]["id"] unless case_type.nil?
43
+ @case_types.each do |case_type|
44
+ if case_type["name"] == case_type_name
45
+ return case_type["id"]
46
+ end
47
+ end
48
+ nil
45
49
  end
46
50
 
47
51
  def case_types
@@ -25,7 +25,7 @@ describe "CaseblocksAPI" do
25
25
 
26
26
  it "should look for the case type id" do
27
27
  stub_request(:post, "http://example.com/tokens?auth_token=some_token")
28
- CaseblocksAPI::Client.stub(:get).and_return({"case_types" => [ {'some_case' => {"id" => 1}} ]})
28
+ CaseblocksAPI::Client.stub(:get).and_return({"case_types" => [ {"id" => 1, "name" => 'some_case'} ]})
29
29
  stub = stub_request(:post, "example.com/case_blocks/cases?auth_token=")
30
30
  .with({body: { 'case' => {'my' => 'params', 'case_type_id' => 1}}.to_json })
31
31
  caseblocks_client.create_case({'my' => 'params'}, 'some_case')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caseblocks_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -215,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  segments:
217
217
  - 0
218
- hash: 415753869784523730
218
+ hash: -3653200939008105340
219
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  none: false
221
221
  requirements: