compostr 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ebe394c131ac5e4b1a446fd0413783254ab7d907d978afcb32a012b072baaf3
4
- data.tar.gz: d24824f7b8df8aeb9dbdfab420ad6d496779f8327978791d8726ac0cdbd46fa2
3
+ metadata.gz: f31f64aa8e7db06332cc0c34682901416789d268e9e3cebb5f63327c42798f3a
4
+ data.tar.gz: 35387803d8e4c19fe30689b2ca81d8b21467cf196262100062842469793895ca
5
5
  SHA512:
6
- metadata.gz: c3134bd3be696c8662f6d69894cd3bdd68da46dda152cc35bc13e10cf0893a7054ddf9b20d63f2fbd20fec60976a85077b5250f25dd9ed99c72616e27d8be9e8
7
- data.tar.gz: d1b7435b2e816dc05814a3f75a2bc4649c1772be1281e61415d6fba30fad2f9bf62227129f206c6ebcdba3faf12f27aab5eb154d22a38b563e2ad93af518d99f
6
+ metadata.gz: ae127bbc0d8f58b0db9238fe4dabdbc670ca03cc91045c4cbeb194f37df2c2e7fec1586eda0dad5ed2206b2136b75d3067269e1af87bab73debad7c34d292d5d
7
+ data.tar.gz: feebe1cec6423100455aeb4a72b6ba3b84e8e99a7713d4592198382e95038a1f4e11bb4df478eeca0271e0c02621605f1f8354fe60f3c2d965e50a55bf8c1aff
data/README.md CHANGED
@@ -44,7 +44,7 @@ class ProgrammingLanguage < Compostr::CustomPostType
44
44
  end
45
45
  ```
46
46
 
47
- Now `ProgrammingLanguage`s can be queried and posted to your Wordpress installation. Instances of this class will automatically respond to `content`, `id`, `title` and `featured_image_id` (corresponding to the Wordpress `post_content`, `id`, `post_title` and `featured_image_id`).
47
+ Now `ProgrammingLanguage`s can be queried and posted to your Wordpress installation. Instances of this class will automatically respond to `content`, `id`, `title`, `excerpt` and `featured_image_id` (corresponding to the Wordpress `post_content`, `id`, `post_title`, `post_excerpt` and `featured_image_id`).
48
48
 
49
49
  ```ruby
50
50
  require 'compostr'
@@ -2,14 +2,14 @@ module Compostr
2
2
  # Base class to inherit from for Classes that map to Wordpress
3
3
  # Custom Post Types.
4
4
  #
5
- # Besides the post_id, title, content and featured_image (id) that
5
+ # Besides the post_id, title, content, excerpt and featured_image (id) that
6
6
  # define a post, the CustomPostType likely will own custom field
7
7
  # values. These are specified with wp_custom_field_single and
8
8
  # wp_custom_field_multi (depending on their type).
9
9
  #
10
10
  # To loop over the fields, use @fields and @multi_fields.
11
11
  class CustomPostType
12
- attr_accessor :post_id, :title, :content, :featured_image_id
12
+ attr_accessor :post_id, :title, :content, :excerpt, :featured_image_id
13
13
  # TODO rename to single_fields?
14
14
  attr_accessor :fields, :multi_fields
15
15
 
@@ -118,6 +118,8 @@ module Compostr
118
118
  @title = v
119
119
  elsif k == :content
120
120
  self.content= v
121
+ elsif k == :excerpt
122
+ self.excerpt= v
121
123
  elsif k == :post_id
122
124
  self.post_id= v
123
125
  elsif k == :featured_image_id
@@ -199,6 +201,7 @@ module Compostr
199
201
  return nil if content_hash.nil?
200
202
  entity = new(post_id: content_hash["post_id"],
201
203
  content: content_hash["post_content"],
204
+ excerpt: content_hash["post_excerpt"],
202
205
  title: content_hash["post_title"])
203
206
 
204
207
  custom_fields_list = content_hash["custom_fields"] || []
@@ -234,6 +237,7 @@ module Compostr
234
237
  post_data: Time.now,
235
238
  post_title: title || '', # why does content need '@'?
236
239
  post_content: @content || '',
240
+ post_excerpt: @excerpt || '',
237
241
  custom_fields: @fields.map{|k,v| v.to_hash} | @multi_fields.flat_map{|k,v| v.flat_map(&:to_hash)}
238
242
  }
239
243
  if featured_image_id
@@ -369,6 +373,9 @@ module Compostr
369
373
  if @title.to_s.strip != other_cpt_object.title.to_s.strip
370
374
  diff_fields["title"] = [@title, other_cpt_object.title]
371
375
  end
376
+ if @excerpt.to_s.strip != other_cpt_object.excerpt.to_s.strip
377
+ diff_fields["excerpt"] = [@excerpt, other_cpt_object.excerpt]
378
+ end
372
379
  if @featured_image_id != other_cpt_object.featured_image_id
373
380
  diff_fields["featured_image_id"] = [@featured_image_id, other_cpt_object.featured_image_id]
374
381
  end
@@ -1,3 +1,3 @@
1
1
  module Compostr
2
- VERSION = "0.1.5".freeze
2
+ VERSION = "0.1.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compostr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Wolfsteller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubypress