rubypress 1.0.9 → 1.1.0

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 +4 -4
  2. data/lib/rubypress/client.rb +14 -9
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b8136ffdfc8e1739c8083bd405a58ee3878725b
4
- data.tar.gz: b5de51c79fa7ddc02f59429ddb387383957685a2
3
+ metadata.gz: 36cabfe8257db270de3415114ecf0ef22261d300
4
+ data.tar.gz: 0a5c21ef875c319cd442db651fc01a68246c318c
5
5
  SHA512:
6
- metadata.gz: ece6dda2f5127295c57ee43be57c81c3efd1f13ed0a4a2c2e091a4a8bbafbbc3c029ccfd317ddf8853af4b3e7262a5237cb6537ccb9d969e23e14c36a4afeb4b
7
- data.tar.gz: e3373b571479de95d57490588ab940183aaf1049717359d4848b363d50275c91a453f16e2f6933be6fd4064801823818fa6c397784c4613202879a942b504e67
6
+ metadata.gz: 85b925186635f5807956fd86c3bf297cf8a34c65c8310a05017ca35613ac5ddd25d0b36c947e0f15e9375daa15685011448cfa4a4bd839c8cd6742fa7faa358b
7
+ data.tar.gz: 11e43a35590ceba576b94c89014fe19470997f973dc6a005b52eb1430314c1817179472e4e25b840463749c93c09039cdbbc7f44295519d756f41dadebac66cb
@@ -16,7 +16,7 @@ module Rubypress
16
16
 
17
17
  attr_reader :connection
18
18
  attr_accessor :port, :ssl_port, :host, :path, :username, :password, :use_ssl, :default_post_fields,
19
- :debug, :http_user, :http_password, :retry_timeouts
19
+ :debug, :http_user, :http_password, :retry_timeouts, :cookie
20
20
 
21
21
  def initialize(options = {})
22
22
  {
@@ -31,17 +31,21 @@ module Rubypress
31
31
  :debug => false,
32
32
  :http_user => nil,
33
33
  :http_password => nil,
34
- :retry_timeouts => false
34
+ :retry_timeouts => false,
35
+ :cookie => nil
35
36
  }.merge(options).each{ |opt| self.send("#{opt[0]}=", opt[1]) }
36
37
  self
37
38
  end
38
39
 
39
40
  def connection
40
- server = XMLRPC::Client.new(self.host, self.path, (self.use_ssl ? self.ssl_port : self.port),nil,nil,self.http_user,self.http_password,self.use_ssl,nil)
41
- server.http_header_extra = {'accept-encoding' => 'identity'}
42
- server.extend(XMLRPCRetryable) if retry_timeouts
43
-
44
- @connection = server
41
+ if @connection.nil?
42
+ @connection = XMLRPC::Client.new(self.host, self.path, (self.use_ssl ? self.ssl_port : self.port),nil,nil,self.http_user,self.http_password,self.use_ssl,nil)
43
+ @connection.http_header_extra = {'accept-encoding' => 'identity'}
44
+ @connection.extend(XMLRPCRetryable) if retry_timeouts
45
+ @connection.cookie = self.cookie unless self.cookie.nil?
46
+ end
47
+
48
+ @connection
45
49
  end
46
50
 
47
51
  def self.default
@@ -56,12 +60,13 @@ module Rubypress
56
60
  :password => self.password
57
61
  }
58
62
  options_final.deep_merge!(options).each{|option| args.push(option[1]) if !option[1].nil?}
63
+ method = "wp.#{method}" unless method.include?('.')
59
64
  if self.debug
60
65
  connection.set_debug
61
- server = self.connection.call("wp.#{method}", args)
66
+ server = self.connection.call(method, args)
62
67
  pp server
63
68
  else
64
- self.connection.call("wp.#{method}", args)
69
+ self.connection.call(method, args)
65
70
  end
66
71
  end
67
72
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypress
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Feldman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: retryable-rb
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.2.2
163
+ rubygems_version: 2.4.5
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Easily access WordPress installations through the WordPress XML-RPC API.