osm 1.2.20 → 1.2.21

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.2.1
6
+ - 2.3.0
6
7
  - jruby-1.7.20.1
7
8
  gemfile:
8
9
  - Gemfile
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Version 1.2.21
2
+
3
+ * Fix updating requirement data of a Osm::Badge::Data to a blank string incorrectly returns false when the update was made into OSM
4
+ * Fix updating additional details for a Osm::Member to a blank string incorrectly returns false when the update was made into OSM
5
+
1
6
  ## Version 1.2.20
2
7
 
3
8
  * Fix to OSM changing the URL to get API permissions from
@@ -46,7 +51,6 @@
46
51
  * Addition of remaining_credits(api, section, options={}) method
47
52
  * Addition of number_selected(api, section, members, options={}) method to tell how many numbers a message would be sent to
48
53
  * Add :migration as an API target
49
- >>>>>>> NewContactSystem
50
54
 
51
55
  ## Version 1.2.17
52
56
 
data/README.md CHANGED
@@ -17,12 +17,6 @@ This project uses continuous integration to help ensure that a quality product i
17
17
  Travis CI monitors two branches (versions) of the code - Master (which is what gets released)
18
18
  and Staging (which is what is currently being developed ready for moving to master).
19
19
 
20
- [![Build Status](https://secure.travis-ci.org/robertgauld/osm.png?
21
- branch=master)](http://travis-ci.org/robertgauld/osm)
22
-
23
- [![Build Status](https://secure.travis-ci.org/robertgauld/osm.png?
24
- branch=staging)](http://travis-ci.org/robertgauld/osm)
25
-
26
20
 
27
21
  ## Ruby Versions
28
22
  This gem supports the following versions of ruby, it may work on other versions but is not tested against them so don't rely on it.
@@ -30,6 +24,7 @@ This gem supports the following versions of ruby, it may work on other versions
30
24
  * 1.9.3
31
25
  * 2.0.0
32
26
  * 2.2.1
27
+ * 2.3.0
33
28
  * jruby-1.7.20.1
34
29
 
35
30
 
data/lib/osm/badge.rb CHANGED
@@ -815,7 +815,7 @@ module Osm
815
815
  })
816
816
  requirements_updated = false unless result.is_a?(Hash) &&
817
817
  (result['scoutid'].to_i == member_id) &&
818
- (result[requirement.to_s] == now)
818
+ (result[requirement.to_s].to_s == now.to_s)
819
819
  end
820
820
  end
821
821
 
data/lib/osm/member.rb CHANGED
@@ -386,7 +386,7 @@ module Osm
386
386
  'group_id' => GID_CUSTOM,
387
387
  'context' => 'members',
388
388
  })
389
- updated = updated && data.is_a?(Hash) && data['data'].is_a?(Hash) && data['data']['value'].eql?(new_value)
389
+ updated = updated && data.is_a?(Hash) && data['data'].is_a?(Hash) && data['data']['value'].to_s.eql?(new_value.to_s)
390
390
  end # each attr to update
391
391
 
392
392
  # Do contacts
@@ -788,6 +788,17 @@ describe "Badge" do
788
788
  @data.update(@api).should == true
789
789
  end
790
790
 
791
+ it "Success (just requirement) (to blank)" do
792
+ date = Date.new(2000, 1, 2)
793
+ HTTParty.should_receive(:post).with('https://www.onlinescoutmanager.co.uk/ext/badges/records/?action=updateSingleRecord', {:body => @update_post_data.merge('value' => '')}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>@update_body_data.merge('2345' => nil).to_json}) }
794
+ Osm::Section.stub(:get) { Osm::Section.new(:id => 2, :type => :beavers) }
795
+ @data.should_not_receive(:mark_awarded)
796
+ @data.should_not_receive(:mark_due)
797
+
798
+ @data.requirements[2345] = ''
799
+ @data.update(@api).should == true
800
+ end
801
+
791
802
  it "Success (just due)" do
792
803
  date = Date.new(2000, 1, 2)
793
804
  HTTParty.should_not_receive(:post)
@@ -900,6 +900,39 @@ describe "Member" do
900
900
  @member.update(@api).should == true
901
901
  end
902
902
 
903
+ it "When setting data to a blank string" do
904
+ HTTParty.should_receive(:post).with('https://www.onlinescoutmanager.co.uk/ext/members/contact/?action=update', {:body => {
905
+ "apiid" => "1",
906
+ "token" => "API TOKEN",
907
+ "userid" => "user_id",
908
+ "secret" => "secret",
909
+ "sectionid" => 2,
910
+ "scoutid" => 1,
911
+ "column" => "firstname",
912
+ "value" => "",
913
+ }}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{"ok":true}'}) }
914
+
915
+ HTTParty.should_receive(:post).with('https://www.onlinescoutmanager.co.uk/ext/customdata/?action=updateColumn&section_id=2', {:body => {
916
+ "apiid" => "1",
917
+ "token" => "API TOKEN",
918
+ "userid" => "user_id",
919
+ "secret" => "secret",
920
+ "context" => "members",
921
+ "associated_type" => "member",
922
+ "associated_id" => 1,
923
+ "group_id" => 5,
924
+ "column_id" => 123,
925
+ "value" => "",
926
+ }}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{"data":{"value":null}}'}) }
927
+
928
+ Osm::Term.stub(:get_for_section) { [] }
929
+
930
+ @member.stub('valid?'){ true }
931
+ @member.first_name = ''
932
+ @member.additional_information[123] = ''
933
+ @member.update(@api).should == true
934
+ end
935
+
903
936
  end
904
937
 
905
938
  it "Get Photo link" do
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Osm
2
- VERSION = "1.2.20"
2
+ VERSION = "1.2.21"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.20
4
+ version: 1.2.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-21 00:00:00.000000000 Z
12
+ date: 2016-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport