Class: ThinktankReport

Inherits:
BaseModel show all
Defined in:
lib/models/thinktank_report.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

fields, register, #verify, #verify_empty, #verify_fields, #verify_int, #verify_json, #verify_length, #verify_regex, #verify_string

Constructor Details

#initialize(options = {}) ⇒ ThinktankReport

Returns a new instance of ThinktankReport.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/models/thinktank_report.rb', line 45

def initialize(options = {})
	options = JSON.parse(options.to_json)
	@id = options["id"]
	@title = options["title"]
	@site_name = options["site_name"]
	@site_name_cn = options["site_name_cn"]
	@abstract = options["abstract"]
	@content = options["content"]
	@author_names = options["author_names"]
	@source = options["source"]
	@files = options["files"]
	@images = options["images"]
	@videos = options["videos"]
	@audios = options["audios"]
	@links = options["links"]
	@domain = options["domain"]
	@keywords = options["keywords"]
	@html_content = options["html_content"]
	@lang = options["lang"]
	@country_cn = options["country_cn"]
	@country_code = options["country_code"]
	@created_at = options["created_at"]
	@updated_at = options["updated_at"]
	@created_time = options["created_time"]
	@oss_files = options["oss_files"]
	@oss_images = options["oss_images"]
	@customer_category = options["customer_category"]
	@category = options["category"]
	@topics = options["topics"]
	@tags = options["tags"]
	@views = options["views"]
	@comments = options["comments"]
	@reference = options["reference"]
	@mention_country = options["mention_country"]
	@authors = options["authors"]
	@sub_title = options["sub_title"]
	@timezone = options["timezone"]
	@timezone_location = options["timezone_location"]
end

Instance Attribute Details

#abstractObject

Returns the value of attribute abstract.



6
7
8
# File 'lib/models/thinktank_report.rb', line 6

def abstract
  @abstract
end

#audiosObject

Returns the value of attribute audios.



13
14
15
# File 'lib/models/thinktank_report.rb', line 13

def audios
  @audios
end

#author_namesObject

Returns the value of attribute author_names.



8
9
10
# File 'lib/models/thinktank_report.rb', line 8

def author_names
  @author_names
end

#authorsObject

Returns the value of attribute authors.



34
35
36
# File 'lib/models/thinktank_report.rb', line 34

def authors
  @authors
end

#categoryObject

Returns the value of attribute category.



27
28
29
# File 'lib/models/thinktank_report.rb', line 27

def category
  @category
end

#commentsObject

Returns the value of attribute comments.



31
32
33
# File 'lib/models/thinktank_report.rb', line 31

def comments
  @comments
end

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/models/thinktank_report.rb', line 7

def content
  @content
end

#country_cnObject

Returns the value of attribute country_cn.



19
20
21
# File 'lib/models/thinktank_report.rb', line 19

def country_cn
  @country_cn
end

#country_codeObject

Returns the value of attribute country_code.



20
21
22
# File 'lib/models/thinktank_report.rb', line 20

def country_code
  @country_code
end

#created_atObject

Returns the value of attribute created_at.



21
22
23
# File 'lib/models/thinktank_report.rb', line 21

def created_at
  @created_at
end

#created_timeObject

Returns the value of attribute created_time.



23
24
25
# File 'lib/models/thinktank_report.rb', line 23

def created_time
  @created_time
end

#customer_categoryObject

Returns the value of attribute customer_category.



26
27
28
# File 'lib/models/thinktank_report.rb', line 26

def customer_category
  @customer_category
end

#domainObject

Returns the value of attribute domain.



15
16
17
# File 'lib/models/thinktank_report.rb', line 15

def domain
  @domain
end

#filesObject

Returns the value of attribute files.



10
11
12
# File 'lib/models/thinktank_report.rb', line 10

def files
  @files
end

#html_contentObject

Returns the value of attribute html_content.



17
18
19
# File 'lib/models/thinktank_report.rb', line 17

def html_content
  @html_content
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/models/thinktank_report.rb', line 2

def id
  @id
end

#imagesObject

Returns the value of attribute images.



11
12
13
# File 'lib/models/thinktank_report.rb', line 11

def images
  @images
end

#keywordsObject

Returns the value of attribute keywords.



16
17
18
# File 'lib/models/thinktank_report.rb', line 16

def keywords
  @keywords
end

#langObject

Returns the value of attribute lang.



18
19
20
# File 'lib/models/thinktank_report.rb', line 18

def lang
  @lang
end

Returns the value of attribute links.



14
15
16
# File 'lib/models/thinktank_report.rb', line 14

def links
  @links
end

#mention_countryObject

Returns the value of attribute mention_country.



33
34
35
# File 'lib/models/thinktank_report.rb', line 33

def mention_country
  @mention_country
end

#oss_filesObject

Returns the value of attribute oss_files.



24
25
26
# File 'lib/models/thinktank_report.rb', line 24

def oss_files
  @oss_files
end

#oss_imagesObject

Returns the value of attribute oss_images.



25
26
27
# File 'lib/models/thinktank_report.rb', line 25

def oss_images
  @oss_images
end

#referenceObject

Returns the value of attribute reference.



32
33
34
# File 'lib/models/thinktank_report.rb', line 32

def reference
  @reference
end

#site_nameObject

Returns the value of attribute site_name.



4
5
6
# File 'lib/models/thinktank_report.rb', line 4

def site_name
  @site_name
end

#site_name_cnObject

Returns the value of attribute site_name_cn.



5
6
7
# File 'lib/models/thinktank_report.rb', line 5

def site_name_cn
  @site_name_cn
end

#sourceObject

Returns the value of attribute source.



9
10
11
# File 'lib/models/thinktank_report.rb', line 9

def source
  @source
end

#sub_titleObject

Returns the value of attribute sub_title.



35
36
37
# File 'lib/models/thinktank_report.rb', line 35

def sub_title
  @sub_title
end

#tagsObject

Returns the value of attribute tags.



29
30
31
# File 'lib/models/thinktank_report.rb', line 29

def tags
  @tags
end

#timezoneObject

Returns the value of attribute timezone.



36
37
38
# File 'lib/models/thinktank_report.rb', line 36

def timezone
  @timezone
end

#timezone_locationObject

Returns the value of attribute timezone_location.



37
38
39
# File 'lib/models/thinktank_report.rb', line 37

def timezone_location
  @timezone_location
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/models/thinktank_report.rb', line 3

def title
  @title
end

#topicsObject

Returns the value of attribute topics.



28
29
30
# File 'lib/models/thinktank_report.rb', line 28

def topics
  @topics
end

#updated_atObject

Returns the value of attribute updated_at.



22
23
24
# File 'lib/models/thinktank_report.rb', line 22

def updated_at
  @updated_at
end

#videosObject

Returns the value of attribute videos.



12
13
14
# File 'lib/models/thinktank_report.rb', line 12

def videos
  @videos
end

#viewsObject

Returns the value of attribute views.



30
31
32
# File 'lib/models/thinktank_report.rb', line 30

def views
  @views
end

Class Method Details

.table_nameObject



39
40
41
# File 'lib/models/thinktank_report.rb', line 39

def self.table_name
	return "thinktank_reports"
end

.verify_keysObject



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/models/thinktank_report.rb', line 130

def self.verify_keys
	return {
		"id"=>            ["empty", "string"],
		"title"=>         ["empty", "string"],
		"site_name"=>     ["empty", "string"],
		"site_name_cn"=>  ["empty", "string"],
		"content"=>       ["empty", "string"],
		"source"=>        ["empty", "string"],
		"files"=>         ["json", "string"],
		"images"=>        ["json", "string"],
		"videos"=>        ["json", "string"],
		"audios"=>        ["json", "string"],
		"links"=>         ["json", "string"],
		"domain"=>        ["empty", "string"],
		"keywords"=>      ["json", "string"],
		"lang"=>          ["empty", "string"],
		"country_cn"=>    ["empty", "string"],
		"country_code"=>  ["empty", "string"],
		"created_at"=>    ["empty", "int", "length:13"],
		"updated_at"=>    ["empty", "int", "length:13"],
		"created_time"=>  ["empty", "int", "length:10"],
		"oss_files"=>     ["json", "string"],
		"oss_images"=>    ["json", "string"],
		"topics"=>        ["json", "string"],
		"tags"=>          ["string", "json"],
		"authors"=>       ["json", "fields:author_id,author_name,author_url", "string"],
		"timezone"=>      ["empty", 'regex:[\+|-]\d{4}', "string"],
		"timezone_location"=> ["empty", "string"],	
	}
end

Instance Method Details

#as_jsonObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/models/thinktank_report.rb', line 89

def as_json
	return {
		id: @id,
		title: @title,
		site_name: @site_name,
		site_name_cn: @site_name_cn,
		abstract: @abstract,
		content: @content,
		author_names: @author_names,
		source: @source,
		files: @files,
		images: @images,
		videos: @videos,
		audios: @audios,
		links: @links,
		domain: @domain,
		keywords: @keywords,
		html_content: @html_content,
		lang: @lang,
		country_cn: @country_cn,
		country_code: @country_code,
		created_at: @created_at,
		updated_at: @updated_at,
		created_time: @created_time,
		oss_files: @oss_files,
		oss_images: @oss_images,
		customer_category: @customer_category,
		category: @category,
		topics: @topics,
		tags: @tags,
		views: @views,
		comments: @comments,
		reference: @reference,
		mention_country: @mention_country,
		authors: @authors,
		sub_title: @sub_title,
		timezone: @timezone,
		timezone_location: @timezone_location
	}
end

#to_jsonObject



85
86
87
# File 'lib/models/thinktank_report.rb', line 85

def to_json
	return as_json.to_json
end