rsbe-client 0.5.0 → 0.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9782c78a09597d6fee30ab7c6853c4a2c5ddce3d
4
- data.tar.gz: 87adba5bdde063e8951e53499224037420ff4c12
2
+ SHA256:
3
+ metadata.gz: cd4118feada708bc7e825e2eb5f27fe61b46cd2b0011f6333a25abc1b065b8d6
4
+ data.tar.gz: 44301a027fa8d33d5827a9442dba5c632f07a71332807373b4d563554972b5ab
5
5
  SHA512:
6
- metadata.gz: b6769297879400a946220562a7e5a9fe1bb360773b1618246c54e7f9860dce6aab4bfb0bbab6cde1ae07c3b0e1940fa09d68a04961c2ecaff99e0984b400a0fc
7
- data.tar.gz: ae2f8b4c95a096dc8d1a975fc7581efa23e42f4afd5dbdbeb7a4b325ddb869e4d79428988dec2a39c906d5b0975c10ef30d7480ec92b27cd166171339cbaed1d
6
+ metadata.gz: 79c9a557a85de6c91e84c2470520c8ae3fb888bc18a5c99b860559450812002ee1c5a5056309ce2e8836b2c9ecf5bb9e0d216958747ac58ae7ec871905132aff
7
+ data.tar.gz: 0125fcecd6341be56cad73f08b70a34009f9e7d0a38c2d1e793bd053a7d1f4e2f6aa488912f0d759b3107a704cb5eb27896036db841d8ce5260996c19442e066
data/README.md CHANGED
@@ -10,13 +10,6 @@ Client library for interaction with the rsbe API
10
10
 
11
11
  This library allows one to interact with the R* Backend (rsbe) API.
12
12
 
13
- #### Completed User stories:
14
- * As an Authorized Client, I want to create a new Partner and have it persist.
15
- * As an Authorized Client, I want to update a Partner.
16
- * As an Authorized Client, I want to find a Partner by id.
17
- * As an Authorized Client, I want to get a list of all available Partners.
18
-
19
-
20
13
  #### Required Environment Variables:
21
14
  ```
22
15
  RSBE_URL
@@ -43,31 +36,28 @@ irb> Partner.all.each {|p| puts p.id}
43
36
  51213be7-c8de-4e06-8cc2-06bfc82cdd68
44
37
  977e659b-886a-4626-8799-8979426ad2b3
45
38
  ...
46
- ```
47
-
48
- #### Usage (code example)
49
- ```
50
- ...
51
- def select_item_or_exit(items, label)
52
- # do some stuff
53
- end
54
39
  ...
55
40
 
56
- partners = Rsbe::Client::Partner.all
57
- partners.sort! { |a, b| a.code <=> b.code }
58
- partner = select_item_or_exit(partners, 'partner')
41
+ irb> p = Rsbe::Client::Partner.all.first
42
+ => #<Rsbe::Client::Partner:0x007fdc81b4ec08 ...>
59
43
 
60
- collections = partner.collections.sort { |a, b| a.code <=> b.code }
61
- collection = select_item_or_exit(collections, 'collection')
62
- puts "collection: #{collection.code}, #{collection.name} #{collection.id}"
63
- ...
64
- ```
44
+ irb> puts "#{p.id} : #{p.code} : #{p.name}"
45
+ 51213be7-c8de-4e06-8cc2-06bfc82cdd68 : bar :
46
+ => nil
47
+
48
+ irb> p.name = 'Foo Bar'
49
+ => "Foo Bar"
50
+
51
+ irb> p.save
52
+ => true
53
+
54
+ > p = Rsbe::Client::Partner.find('51213be7-c8de-4e06-8cc2-06bfc82cdd68')
55
+ => #<Rsbe::Client::Partner:0x007fdc81a3cdd8 ...>
56
+
57
+ irb> puts "#{p.id} : #{p.code} : #{p.name}"
58
+ 51213be7-c8de-4e06-8cc2-06bfc82cdd68 : bar : Foo Bar
59
+ => nil
65
60
 
66
- #### Methods:
67
- ```
68
- Rsbe::Partner#save
69
- Rsbe::Partner#code
70
- Rsbe::Partner#name
71
- Rsbe::Partner#collections
72
61
  ```
73
62
 
63
+
data/examples.md ADDED
@@ -0,0 +1,99 @@
1
+ ## `Rsbe::Client::SearchResults` examples:
2
+
3
+ #### overview
4
+
5
+ The `Rsbe::Client::SearchResults` class takes the results of an
6
+ `Rsbe::Client::Search` call, parses the results, and returns an
7
+ array of `Rsbe::Client::Se` objects.
8
+
9
+ You can use `Se` attribute values as search filters.
10
+
11
+
12
+ ##### Example: search by `digi_id`
13
+
14
+ The most common example is to retrieve the `Rsbe::Client::Se` object
15
+ for a digitization id (`digi_id`) registered in `Rsbe`.
16
+
17
+ ```
18
+ irb> require 'rsbe/client'
19
+ irb> response = Rsbe::Client::Se.search(digi_id: 'foo_quux_cuid0')
20
+ => #<Faraday::Response:0x007fdc819cd050 ...>
21
+
22
+ irb> search_results = Rsbe::Client::SearchResults.new(response)
23
+ => #<Rsbe::Client::SearchResults:0x007fdc81943ee0 ...>
24
+
25
+ irb> search_results.success?
26
+ => true
27
+
28
+ irb> search_results.num_found
29
+ => 1
30
+
31
+ irb> se = search_results.results.first
32
+ => #<Rsbe::Client::Se:0x007fdc819ffbb8 ...>
33
+
34
+ irb> se.id
35
+ => "2edf966a-cde3-48e1-a04e-9c87af07b9b5"
36
+
37
+ irb> se.digi_id
38
+ => "foo_quux_cuid0"
39
+
40
+ irb> se.phase
41
+ => "digitization"
42
+
43
+ irb> se.step
44
+ => "digitization"
45
+
46
+ irb> se.status
47
+ => "queued"
48
+
49
+ irb> se.status = 'error'
50
+ => "error"
51
+
52
+ irb> se.save
53
+ => true
54
+
55
+ ```
56
+
57
+
58
+ ##### Example: search for all `Se`s currently in the digitization queue:
59
+
60
+ ```
61
+ irb> require 'rsbe/client'
62
+ irb> response = Rsbe::Client::Se.search(phase: 'digitization',
63
+ step: 'digitization',
64
+ status: 'queued')
65
+ => #<Faraday::Response:0x007fdc81b257b8 ...>
66
+
67
+ irb> search_results = Rsbe::Client::SearchResults.new(response)
68
+ => #<Rsbe::Client::SearchResults:0x007fdc81b15660 ...>
69
+
70
+ irb> search_results.success?
71
+ => true
72
+
73
+ # NOTE:
74
+ # this is fast because it just returns the num_found value
75
+ # from the Search response
76
+ #
77
+ irb> search_results.num_found
78
+ => 920
79
+
80
+ # NOTE:
81
+ # this operation may be slow. Calling Rsbe::Client::SearchResults#results
82
+ # instantiates an Se object for every record returned by the search.
83
+ # Subsequent invocations of #results will be fast, however, because the
84
+ # Se objects are memoized.
85
+ #
86
+ irb> search_results.results[0..10].each {|se| puts "#{se.digi_id}"}
87
+ foo_quux_cuid0
88
+ foo_quux_cuid01234
89
+ foo_quux_cuid1
90
+ foo_quux_cuid10
91
+ foo_quux_cuid100
92
+ foo_quux_cuid101
93
+ foo_quux_cuid102
94
+ foo_quux_cuid103
95
+ foo_quux_cuid104
96
+ foo_quux_cuid105
97
+ foo_quux_cuid106
98
+
99
+ ```
@@ -1,5 +1,5 @@
1
1
  module Rsbe
2
2
  module Client
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
data/rsbe-client.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.5"
20
+ spec.add_development_dependency "bundler", "~> 2.3"
21
21
  spec.add_development_dependency "rake"
22
22
  spec.add_development_dependency "rspec", "~> 3.5.0"
23
23
  spec.add_development_dependency "rspec-its", "~> 1.0.1"
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "pry", "~> 0.10.1"
27
27
 
28
28
  spec.add_dependency "faraday", "~> 0.9.0"
29
- spec.add_dependency "activesupport", "~> 4.1.6"
29
+ spec.add_dependency "activesupport", "~> 4.2.11"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsbe-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jgpawletko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 4.1.6
131
+ version: 4.2.11
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 4.1.6
138
+ version: 4.2.11
139
139
  description:
140
140
  email:
141
141
  - jgpawletko@gmail.com
@@ -151,6 +151,7 @@ files:
151
151
  - README.md
152
152
  - Rakefile
153
153
  - TODO.md
154
+ - examples.md
154
155
  - lib/rsbe/client.rb
155
156
  - lib/rsbe/client/base.rb
156
157
  - lib/rsbe/client/collection.rb
@@ -242,8 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  - !ruby/object:Gem::Version
243
244
  version: '0'
244
245
  requirements: []
245
- rubyforge_project:
246
- rubygems_version: 2.6.8
246
+ rubygems_version: 3.1.4
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Client library for interacting with rsbe API.