Class: WpRpc::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/wp_rpc/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = { }) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/wp_rpc/base.rb', line 6

def initialize(options = { })
  @conn = options[:conn] || options[:connection]
end

Instance Method Details

#change_attributes(source, mappings = {}) ⇒ Object



18
19
20
21
# File 'lib/wp_rpc/base.rb', line 18

def change_attributes(source, mappings = {})
  source.map{ |obj| obj.keys.each { |k| obj[mappings[k] ] = obj.delete(k) if mappings[k] } }
  source
end

#connObject



10
11
12
# File 'lib/wp_rpc/base.rb', line 10

def conn
  @conn
end

#patternObject



14
15
16
# File 'lib/wp_rpc/base.rb', line 14

def pattern
  @pattern = {"post_title" => "title", "post_content" => "content"}
end