ruby-fs-stack 0.4.7 → 0.4.8

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.4.7
1
+ 0.4.8
@@ -277,6 +277,48 @@ module FamilytreeV2
277
277
  end
278
278
  end
279
279
 
280
+ # ===params
281
+ # <tt>id_or_ids</tt> should be a string of the persons identifier. For the 'me' person, use :me or 'me'. Can also accept an array of ID strings.
282
+ # <tt>options</tt> accepts a hash of parameters as documented by the API.
283
+ # For full parameter documentation, see DevNet[https://devnet.familysearch.org/docs/api-manual-reference-system/familytree-v2/r_api_family_tree_person_read_v2.html]
284
+ #
285
+ # ===Example
286
+ # # communicator is an authenticated FsCommunicator object
287
+ # # Request a person with no assertions, only the version.
288
+ # p = communicator.familytree_v2.person :me, :names => 'none', :genders => 'none', :events => 'none'
289
+ #
290
+ # p.version # => '90194378772'
291
+ # p.id # => 'KW3B-NNM'
292
+ def contributor(id_or_ids)
293
+ if id_or_ids.kind_of? Array
294
+ multiple_ids = true
295
+ url = Base + 'contributor/' + id_or_ids.join(',')
296
+ props = properties()
297
+ if id_or_ids.size > props['contributor.max.ids']
298
+ contributors = []
299
+ id_or_ids.each_slice(props['contributor.max.ids']) do |ids_slice|
300
+ contributors = contributors + contributor(ids_slice)
301
+ end
302
+ return contributors
303
+ end
304
+ else
305
+ multiple_ids = false
306
+ id = id_or_ids.to_s
307
+ if id == 'me'
308
+ url = Base + 'contributor'
309
+ else
310
+ url = Base + 'contributor/' + id
311
+ end
312
+ end
313
+ response = @fs_communicator.get(url)
314
+ familytree = parse_response(response)
315
+ if multiple_ids
316
+ return familytree.contributors
317
+ else
318
+ return familytree.contributors.first
319
+ end
320
+ end
321
+
280
322
  def properties
281
323
  if @properties_hash
282
324
  return @properties_hash
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-fs-stack}
8
- s.version = "0.4.7"
8
+ s.version = "0.4.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jimmy Zimmerman"]
12
- s.date = %q{2010-02-26}
12
+ s.date = %q{2010-03-04}
13
13
  s.description = %q{A library that enables you to read and update information with the new.familysearch.org API.}
14
14
  s.email = %q{jimmy.zimmerman@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "spec/familytree_v2/familytree_communicator_spec.rb",
43
43
  "spec/familytree_v2/json/combine_request.js",
44
44
  "spec/familytree_v2/json/combine_response.js",
45
+ "spec/familytree_v2/json/fakeweb_contributor.txt",
45
46
  "spec/familytree_v2/json/fakeweb_pedigree.txt",
46
47
  "spec/familytree_v2/json/fakeweb_pedigree2.txt",
47
48
  "spec/familytree_v2/json/fakeweb_properties.txt",
@@ -109,3 +110,4 @@ Gem::Specification.new do |s|
109
110
  s.add_dependency(%q<fakeweb>, [">= 0"])
110
111
  end
111
112
  end
113
+
@@ -594,4 +594,31 @@ describe FamilytreeV2::Communicator do
594
594
 
595
595
  end
596
596
 
597
+ describe "contributor read" do
598
+ before(:each) do
599
+ options = {
600
+ :domain => 'https://fakeweb.familysearch.org',
601
+ :key => '1111-1111',
602
+ :user_agent => "FsCommunicator/0.1",
603
+ :session => 'SESSID',
604
+ }
605
+ @com = FsCommunicator.new options
606
+ response = File.join(File.dirname(__FILE__),'json','fakeweb_contributor.txt')
607
+ FakeWeb.register_uri(:get, "https://fakeweb.familysearch.org/familytree/v2/contributor?sessionId=SESSID&dataFormat=application/json",
608
+ :response => response)
609
+ end
610
+
611
+ it "should return a contributor record" do
612
+ contributor = @com.familytree_v2.contributor :me
613
+ contributor.class.should == FamilyTreeV2::Contributor
614
+ end
615
+
616
+ it "should have an ID and contact name" do
617
+ contributor = @com.familytree_v2.contributor :me
618
+ contributor.id.should == 'MMDZ-8JD'
619
+ contributor.contactName.should == 'API User 1241'
620
+ end
621
+
622
+ end
623
+
597
624
  end
@@ -0,0 +1,14 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Thu, 04 Mar 2010 21:25:10 GMT
3
+ APP_SVR_ID: 9.31
4
+ Expires: Thu, 01 Jan 1970 00:00:00 GMT
5
+ Cache-Control: no-cache
6
+ Cache-Control: no-store
7
+ X-PROCESSING-TIME: 147
8
+ Content-Type: application/json;charset=utf-8
9
+ Content-Language: en-US
10
+ Content-Length: 134
11
+ Set-Cookie: ftSessionId=USYS47776926A788A2044E0BEE0AC339E945.ptap009-035; Path=/
12
+ Connection: close
13
+
14
+ {"contributors":[{"id":"MMDZ-8JD","contactName":"API User 1241"}],"version":"2.1.20100119.5407","statusCode":200,"statusMessage":"OK"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-fs-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Zimmerman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-26 00:00:00 -07:00
12
+ date: 2010-03-04 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ files:
67
67
  - spec/familytree_v2/familytree_communicator_spec.rb
68
68
  - spec/familytree_v2/json/combine_request.js
69
69
  - spec/familytree_v2/json/combine_response.js
70
+ - spec/familytree_v2/json/fakeweb_contributor.txt
70
71
  - spec/familytree_v2/json/fakeweb_pedigree.txt
71
72
  - spec/familytree_v2/json/fakeweb_pedigree2.txt
72
73
  - spec/familytree_v2/json/fakeweb_properties.txt