Class: PPC::API::Sogou::Creative
Constant Summary
collapse
- Service =
'CpcIdea'
Class Method Summary
collapse
-
.add(auth, creatives) ⇒ Object
-
.delete(auth, ids) ⇒ Object
-
.get(auth, ids, getTemp = 0) ⇒ Object
-
.search_by_group_id(auth, ids, getTemp = 0) ⇒ Object
-
.search_id_by_group_id(auth, ids, getTemp = 0) ⇒ Object
-
.status(auth, ids, getTemp = 0) ⇒ Object
-
.update(auth, creatives) ⇒ Object
debug_print, process, request, reverse_type
Methods included from PPC::API
#debug_off, #debug_on, #is_no_quota, #make_type, #process, #request, #request_http_body, #request_http_header, #request_uri, #reverse_type
Class Method Details
.add(auth, creatives) ⇒ Object
28
29
30
31
32
|
# File 'lib/ppc/api/sogou/creative.rb', line 28
def self.add( auth, creatives )
body = { cpcIdeaTypes: make_type( creatives ) }
response = request( auth, Service, 'addCpcIdea', body )
process( response, 'cpcIdeaTypes' ){ |x| reverse_type(x) }
end
|
.delete(auth, ids) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/ppc/api/sogou/creative.rb', line 55
def self.delete( auth, ids )
ids = [ ids ] unless ids.is_a? Array
body = { cpcIdeaIds: ids }
response = request( auth, Service, 'deleteCpcIdea', body )
process( response, '' ){ |x| x }
end
|
.get(auth, ids, getTemp = 0) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/ppc/api/sogou/creative.rb', line 34
def self.get( auth, ids, getTemp = 0 )
'''
\'getCreativeByCreativeId\'
@ input : creative ids
@ output: creative informations
'''
ids = [ ids ] unless ids.is_a? Array
body = { cpcIdeaIds: ids, getTemp: getTemp }
response = request( auth, Service, 'getCpcIdeaByCpcIdeaId', body )
process( response, 'cpcIdeaTypes' ){ |x| reverse_type(x) }
end
|
.search_by_group_id(auth, ids, getTemp = 0) ⇒ Object
81
82
83
84
85
86
|
# File 'lib/ppc/api/sogou/creative.rb', line 81
def self.search_by_group_id( auth, ids, getTemp = 0 )
ids = [ ids ] unless ids.is_a? Array
body = { cpcGrpIds: ids, getTemp: getTemp }
response = request( auth, Service, 'getCpcIdeaByCpcGrpId', body )
process( response, 'cpcGrpIdeas' ){ |x| make_groupCreatives( x ) }
end
|
.search_id_by_group_id(auth, ids, getTemp = 0) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/ppc/api/sogou/creative.rb', line 69
def self.search_id_by_group_id( auth, ids, getTemp = 0 )
'''
\'getCreativeIdByAdgroupId\'
@ input: group ids
@ output: groupCreativeIds
'''
ids = [ ids ] unless ids.is_a? Array
body = { cpcGrpIds: ids, getTemp: getTemp }
response = request( auth, Service, 'getCpcIdeaIdByCpcGrpId', body )
process( response, 'cpcGrpIdeaIds' ){ |x| make_groupCreativeIds( x ) }
end
|
.status(auth, ids, getTemp = 0) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/ppc/api/sogou/creative.rb', line 62
def self.status( auth, ids, getTemp = 0 )
ids = [ ids ] unless ids.is_a? Array
body = { cpcIdeaIds: ids, getTemp: getTemp }
response = request( auth, Service, 'getCpcIdeaByCpcIdeaId', body )
process( response, 'cpcIdeaTypes' ){ |x| reverse_type(x, @status_map) }
end
|
.update(auth, creatives) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/ppc/api/sogou/creative.rb', line 46
def self.update( auth, creatives )
'''
根据实际使用情况,更新的时候creative title为必填选
'''
body = { cpcIdeaTypes: make_type( creatives ) }
response = request( auth, Service, 'updateCpcIdea', body )
process( response, 'cpcIdeaTypes' ){ |x| reverse_type(x) }
end
|