panlex_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *gem
2
+ *pid
3
+ /doc
4
+ .yardoc/
5
+ .rdoc_options
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ -m markdown
2
+ - COPYING.txt
File without changes
data/README.md CHANGED
@@ -1,18 +1,22 @@
1
1
  # panlex\_client
2
- Simply Ruby client for the [public API](http://dev.panlex.org/api/) of the [Panlex Database](http://panlex.org).
2
+ Simple Ruby client for the [public API](http://dev.panlex.org/api/) of the [Panlex Database](http://panlex.org).
3
3
 
4
4
  ## Usage
5
5
 
6
- Right now, there is just a `PanlexClient` module with only one `query` method which accepts three arguments: the URL parameter, the request body and an optional block to process the response and which accept three arguments: response, request and result. This is just a wrapper of [rest-client](https://github.com/rest-client/rest-client) `RestClient.post` method, so you can check there for more documentation.
6
+ Right now, there is just a `PanlexClient` module with only one `query` method which accepts three arguments: the URL parameter, the request body and an optional block to process the response and which accept three arguments: response, request and result.
7
7
 
8
- PanlexClient.query 'lv', { :indent => true, :limit => 2 } do |response, request, result|
9
- response_json = JSON.parse(response)
10
- if response_json['status'] == 'OK' then
11
- response_json['result'].each do |language|
12
- puts language.to_s
13
- end
14
- end
15
- end
8
+ ```ruby
9
+ require 'panlex_client'
10
+
11
+ PanlexClient.query 'lv', { :indent => true, :limit => 2 } do |response, request, result|
12
+ response_json = JSON.parse(response)
13
+ if response_json['status'] == 'OK' then
14
+ response_json['result'].each do |language|
15
+ puts language.to_s
16
+ end
17
+ end
18
+ end
19
+ ```
16
20
 
17
21
  ## LICENSE
18
22
 
@@ -1,6 +1,15 @@
1
+ # panlex_client namespace
1
2
  module PanlexClient
3
+ # PanLex public API URL
2
4
  API_URL = 'http://api.panlex.org/'
3
5
 
6
+ # Send a request to PanLex API.
7
+ #
8
+ # @param param [String] {http://dev.panlex.org/api/#urlparam PanLex API URL parameter}
9
+ # @param body [#to_json] The request body which includes the query parameters. Look at the {http://dev.panlex.org/api/#globalparam global optional parameter} and the specifics for each URL parameter
10
+ # @yieldparam response [String] The response from PanLex, a string you can parse to JSON
11
+ # @yieldparam request [RestClient::Request]
12
+ # @yieldparam result [Net::HTTPOK]
4
13
  def self.query(param, body, &block)
5
14
  RestClient.post API_URL+param, body.to_json, { :content_type => :json, :accept => :json }, &block
6
15
  end
@@ -0,0 +1,16 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'panlex_client'
3
+ s.version = '0.1.1'
4
+ s.summary = 'Client for the PanLex database public API'
5
+ s.description = 'https://github.com/laMarciana/panlex_client/'
6
+ s.license = 'GPL3'
7
+ s.homepage = 'https://github.com/laMarciana/panlex_client/'
8
+ s.authors = ['Marc Busqué']
9
+ s.email = 'marc@lamarciana.com'
10
+ s.files = `git ls-files`.split("\n")
11
+
12
+ s.add_runtime_dependency "rest-client", "~>1.6"
13
+
14
+ s.add_development_dependency "yard", "~>0.8"
15
+ s.add_development_dependency "redcarpet", "~>2.2"
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panlex_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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: 2013-04-09 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -19,7 +19,7 @@ dependencies:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: '1.6'
22
- type: :development
22
+ type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
@@ -27,17 +27,51 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.6'
30
+ - !ruby/object:Gem::Dependency
31
+ name: yard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '0.8'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.8'
46
+ - !ruby/object:Gem::Dependency
47
+ name: redcarpet
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.2'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.2'
30
62
  description: https://github.com/laMarciana/panlex_client/
31
63
  email: marc@lamarciana.com
32
64
  executables: []
33
65
  extensions: []
34
- extra_rdoc_files:
35
- - README.md
66
+ extra_rdoc_files: []
36
67
  files:
37
- - COPYNG
68
+ - .gitignore
69
+ - .yardopts
70
+ - COPYING.txt
38
71
  - README.md
39
72
  - lib/panlex_client.rb
40
73
  - lib/panlex_client/panlex_client.rb
74
+ - panlex_client.spec
41
75
  homepage: https://github.com/laMarciana/panlex_client/
42
76
  licenses:
43
77
  - GPL3
@@ -64,3 +98,4 @@ signing_key:
64
98
  specification_version: 3
65
99
  summary: Client for the PanLex database public API
66
100
  test_files: []
101
+ has_rdoc: