hypothesis 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -6
  3. data/lib/hypothesis/version.rb +1 -1
  4. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26d6aaad780952c945bbc56900dbd4edaefa4c23
4
- data.tar.gz: 9c782c976134aaafb1e925c0039ddbfb6e12d938
3
+ metadata.gz: 6932a1ab9d62d6efd17ec3b3481666773c238a1d
4
+ data.tar.gz: 735097cbad4a8b74579ec0b50dbf53e55b86d165
5
5
  SHA512:
6
- metadata.gz: 29c97ad4ead21deb9265f5fdc328ad0ecf8e65bf155206601e66506ed92a1fb6779f541e76aab3e9f96a784fb2de65a22e04a5b21d947744e8c8351f7aea7dd4
7
- data.tar.gz: 6a382dbb5184db8ca3ab01d0418d4f72255e42d0a11a248de36c85e875f3316d554ea1c570a64639a31f8a4cb7d7daa7c5a302383c8143017fe55559408ead75
6
+ metadata.gz: 8351021cbb35c78ffa10bef4fe88dbe5f574e6398be91d0f7174627606e645574ab82e1edd662be5f6aaf4c5862de380cb04001cc586c58c9c8e79129c407080
7
+ data.tar.gz: 0d4bd6400bdee5838299725277506e2e4058dbfc7707b45f7b2a9ea1b92ce75237e18f2fb5e5c9f5d5ec1fb91a2d23ef83a1cba74c2e97c1b7339ea0d6948454
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Unofficial [hypothesis](https://hypothes.is) ruby gem.
1
+ Unofficial ruby gem for the [hypothesis](https://hypothes.is) API.
2
2
 
3
3
  ### Installation
4
4
 
@@ -13,14 +13,29 @@ require 'rubygems'
13
13
  require 'hypothesis'
14
14
 
15
15
  hypothesis = Hypothesis::API.new('YOUR_HYPOTHESIS_API_KEY')
16
- puts hypothesis.search({ user: 'javier', limit: 10 })
16
+ puts hypothesis.search({ user: 'USERNAME', limit: 10 })
17
17
 
18
18
  ```
19
19
 
20
- That will output a Hash with the found items:
20
+ That will output an object with the found items.
21
+
22
+ Here's how you to print the title, URL, text and highlighted content:
21
23
 
22
24
  ```ruby
23
- => {"rows"=>[{"updated"=>"2016-08-21T13:08:33.877253+00:00", "group"=>"__world__", "target"=>[{"source"=>"http://thelongandshort.org/society/war-on-cash", "selector"=>[{"endContainer"=>"/main[1]/article[1]/div[1]/div[6]/div[1]/p[3]", "startContainer"=>"/main[1]/article[1]/div[1]/div[6]/div[1]/p[3]", "type"=>"RangeSelector", "startOffset"=>0, "endOffset"=>368}, {"type"=>"TextPositionSelector", "end"=>9811, "start"=>9443}, {"exact"=>"Anyone defending cash in this context will be labelled as an anti-progress, reactionary, and nostalgic Luddite. That's why we must not defend cash. Rather, we should focus on pointing out that the Death of Cash means the Rise of Something Else. We are fighting a broader battle to maintain alternatives to the growing digital panopticon that is emerging all around us.", "prefix"=>"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "type"=>"TextQuoteSelector", "suffix"=>"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}]}], "links"=>{"json"=>"https://hypothes.is/api/annotations/XUdzmGegAeaMle8incguxg", "html"=>"https://hypothes.is/a/XUdzmGegEeaNle8inzguxg", "incontext"=>"https://hyp.is/XUdzmGegAeaMle8incguxg/thelongandshort.org/society/war-on-cash"}, "tags"=>[], "text"=>"", "created"=>"2016-08-21T13:08:33.877245+00:00", "uri"=>"http://thelongandshort.org/society/war-on-cash", "user"=>"acct:javier@hypothes.is", "document"=>{"title"=>["The War on Cash"]}, "id"=>"XUdzmGegAeaMle8incguxg", "permissions"=>{"read"=>["acct:javier@hypothes.is"], "admin"=>["acct:javier@hypothes.is"], "update"=>["acct:javier@hypothes.is"], "delete"=>["acct:javier@hypothes.is"]}}], "total"=>1}
25
+ hypothesis = Hypothesis::API.new('YOUR_HYPOTHESIS_API_KEY')
26
+ results = hypothesis.search(user: 'USERNAME', limit: 10)
27
+
28
+ results.rows.each do |row|
29
+ puts row.document.title
30
+ puts row.uri
31
+ puts row.text unless row.text.nil?
32
+
33
+ row.target.each do |target|
34
+ puts target.selector[target.selector.length - 1].exact unless target.selector.nil?
35
+ end
36
+
37
+ puts "\n"
38
+ end
24
39
  ```
25
40
 
26
41
  Currently this gem only supports the `root`, `search`, and `read` endpoints.
@@ -31,5 +46,4 @@ Currently this gem only supports the `root`, `search`, and `read` endpoints.
31
46
 
32
47
  ### License
33
48
 
34
-
35
- This work is licensed under the [MIT License (MIT)](LICENSE) and it is not associated with [TinyLetter](https://www.tinyletter.com) in any way.
49
+ This work is licensed under the [MIT License (MIT)](LICENSE) and it is not associated with [Hypothes.is](https://hypothes.is) in any way.
@@ -1,3 +1,3 @@
1
1
  module Hypothesis
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypothesis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Arce
@@ -64,34 +64,34 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.39.0
67
+ version: 0.52.1
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.39.0
74
+ version: 0.52.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: httparty
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 0.14.0
81
+ version: 0.11.0
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 0.14.0
84
+ version: 0.11.0
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: 0.14.0
91
+ version: 0.11.0
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 0.14.0
94
+ version: 0.11.0
95
95
  description: 'Ruby API for hypothesis '
96
96
  email: javierarce@gmail.com
97
97
  executables:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.6.6
127
+ rubygems_version: 2.6.11
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Ruby API for hypothesis