familysearch2 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5e3a8f176f23c64328144548fd125e888f02a31
4
- data.tar.gz: e7667eda6b3479a5f3d5b4f24b2bdf1bebcf9f19
3
+ metadata.gz: 5f206817f6cc5477a46fb5e3b8363ae693b773ea
4
+ data.tar.gz: d3d9813e691035210a469f7e4901f78624760d7c
5
5
  SHA512:
6
- metadata.gz: d24317d59d145938f267d45ff3aee83102a9a61cc163145011a33f82c94512842bff0a5a398d3a7f4dd2c3c50b479788f9932dfeec9b7648d7e78e557aa2a252
7
- data.tar.gz: da1877d1f1c73d8451fd151112aae458410a99e101e81136469154c640da205457aac292356dc67597d9833fe60b2fe5b09b18fdfde83f97911737e689a1e502
6
+ metadata.gz: b8b7e022325f5aac1d48091613f6a5f22b1e1afb507d48b4ce5aff7736540b7e7f78862d6f2aec75734fc6dfc10a9cf9544e8a002ec7362769958e0ad67a3e85
7
+ data.tar.gz: 90fdd562514dda6a2f0df012271a155926a0f95d8f199b9ac9bc9c6a1347e4ed086d70eb6d50a29193bebb57309ea2fe0324d75a37c7f42c6fb62f1080f55e48
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Familysearch2
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/familysearch2git`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A gem used to work with the familysearch api.
4
+
5
+ The original familysearch gem, https://github.com/jimmyz/familysearch-rb, is currently not working so as an attempt to make my first ruby gem, I decided to take a stab at making my own version. It is based on the gem.
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
6
7
 
7
8
  ## Installation
8
9
 
9
10
  Add this line to your application's Gemfile:
10
11
 
11
12
  ```ruby
12
- gem 'familysearch2git'
13
+ gem 'familysearch2'
13
14
  ```
14
15
 
15
16
  And then execute:
@@ -22,7 +23,21 @@ Or install it yourself as:
22
23
 
23
24
  ## Usage
24
25
 
25
- TODO: Write usage instructions here
26
+ ```ruby
27
+ # create a new client
28
+ # environment options: "production","staging","sandbox"
29
+ @client = Familyseach2::Client.new(username: "", password: "", environment: "")
30
+
31
+ # updating the library will create a file that contains the basic api endpoints
32
+ @client.update_library
33
+
34
+ # create an agent to run your requests
35
+ agent = @client.get_agent
36
+
37
+ # GET syntax
38
+ response = agent.get '/platform/users/current' param: "value"
39
+ puts response
40
+ ```
26
41
 
27
42
  ## Development
28
43
 
@@ -15,7 +15,7 @@ module Familyseach2
15
15
  faraday.headers['Accept'] = 'application/x-fs-v1+json,application/x-gedcomx-atom+json,application/json'
16
16
  faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
17
17
  end
18
- get_access_token(params[:username],params[:password],params[:environment])
18
+ get_access_token(params[:username],params[:password],params[:environment],@key )
19
19
  @agent
20
20
  end
21
21
 
@@ -31,10 +31,10 @@ module Familyseach2
31
31
  base_url
32
32
  end
33
33
 
34
- def get_access_token(username,password,env)
34
+ def get_access_token(username,password,env,key)
35
35
  meta
36
36
  url = JSON.parse(@discovery)['links']['fs-identity-v2-login']['href']
37
- @client_id = "a02j0000007rtRiAAI"
37
+ @client_id = key
38
38
  RestClient::Resource.new url, username, password
39
39
 
40
40
  request_url = get_base_url(env) + "/identity/v2/request_token"
@@ -1,3 +1,3 @@
1
1
  module Familysearch2git
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/test.rb CHANGED
@@ -1,17 +1,19 @@
1
1
  require 'rest-client'
2
- require 'oauth'
3
2
 
4
3
  require File.expand_path(File.dirname(__FILE__) + '/lib/familysearch2')
5
4
 
6
- @client = Familyseach2::Client.new(username: "", password: "", environment: "sandbox")
5
+ # create a new client
6
+ # environment options: "production","staging","sandbox"
7
+ @client = Familyseach2::Client.new(username: "", password: "", environment: "")
8
+
9
+ # updating the library will create a file that contains the basic api endpoints
7
10
  @client.update_library
8
11
 
12
+ # create an agent to run your requests
9
13
  agent = @client.get_agent
10
14
 
15
+ # GET syntax
11
16
  response = agent.get '/platform/users/current'
12
- puts response.body
13
- # RestClient.get "https://sandbox.familysearch.org/platform/users/current", {:Authorization => "Bearer #{@access_token}"}
14
-
15
-
17
+ puts response
16
18
 
17
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: familysearch2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kinezu