wordpress-api 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/wordpress-api.rb +51 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8ee4ce6d2b1c78eaba10a6fe4274cdb32d0dacfd
4
+ data.tar.gz: 735723ab9c6522c41d812ed3f88d476f95344aac
5
+ SHA512:
6
+ metadata.gz: 0db0b47608b17f7a100733db8333d0d9a15b940168d44c9252cb6899d662247b4f09a6acfb6ec36cb6324042b4cd1b4a63acdadb4b6fc2d59e412cc633bc15cb
7
+ data.tar.gz: 2e474fbaeb60b08bc492a1b11ac2c14e03ed2c275712e225ef0cede94b52fdb237b84a2dcc58ed13771766a2d7f79ee6da13b1d4b59160d6c5a64de45949fdf5
@@ -0,0 +1,51 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ class WordPress
5
+ def self.hi
6
+ puts "Hello world!"
7
+ end
8
+
9
+ def self.set_source(source)
10
+ @source = source
11
+ end
12
+
13
+ def self.get_posts(source, count = nil)
14
+ unless count.nil?
15
+ data = open("#{source}posts/")
16
+ else
17
+ data = open("#{source}posts/?filter[posts_per_page]=#{count}")
18
+ end
19
+ wpposts = JSON.load(data)
20
+ end
21
+
22
+ def self.get_post(source, post)
23
+ data = open("#{source}posts/#{post}")
24
+ post = JSON.load(data)
25
+ end
26
+
27
+ def self.get_media(source)
28
+ data = open("#{source}media/")
29
+ media = JSON.load(data)
30
+ end
31
+
32
+ def self.get_taxonomies(source)
33
+ data = open("#{source}/taxonomies")
34
+ taxonomies = JSON.load(data)
35
+ end
36
+
37
+ def self.get_taxonomy(source, taxonomy)
38
+ data = open("#{source}/taxonomies/#{taxonomy}")
39
+ taxonomy = JSON.load(data)
40
+ end
41
+
42
+ def self.get_terms(source, taxonomy)
43
+ data = open("#{source}/taxonomies/#{taxonomy}/terms")
44
+ terms = JSON.load(data)
45
+ end
46
+
47
+ def self.get_term(source, taxonomy, term)
48
+ data = open("#{source}/taxonomies/#{taxonomy}/terms/#{term}")
49
+ term = JSON.load(data)
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wordpress-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Greg Boone
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Methods for interfacing with the WordPress API. Currently supports all
14
+ get requests documented at http://wp-api.org.
15
+ email: greg@harmsboone.org
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/wordpress-api.rb
21
+ homepage: http://rubygems.org/gems/wordpress-api
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.5
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: WordPress API
45
+ test_files: []