Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Access Ads On The Facebook Graph API #3

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2401929
SOCIALFB-34 Access Ads On The Facebook Graph API
Oct 20, 2011
a42dbf9
SOCIALFB-34 Add More Stats Specific Operations
karthicks Oct 21, 2011
7f3d3b4
Handle reach estimation operation correctly
karthicks Oct 22, 2011
a29c8da
SOCIALFB-34 Handle reach estimation operation correctly
karthicks Oct 22, 2011
c0d422b
Merge branch 'master' of https://github.com/karthicks/spring-social-f…
karthicks Oct 22, 2011
e3f4aa8
SOCIALFB-34 Add Search And Post Operations
karthicks Oct 24, 2011
ba6efee
SOCIALFB-34 Deserialize List Return Values Properly
karthicks Oct 25, 2011
c86f0fa
SOCIALFB-34 Add static modifier back to post type deserializer
karthicks Oct 25, 2011
715fa04
SOCIALFB-34 Flesh Out Targeting And Image Operations
karthicks Oct 26, 2011
41a18cb
SOCIALFB-34 Allow updates of creative, adgroup and campaigns
karthicks Oct 27, 2011
0572aa8
SOCIALFB-34 Allow uploads of image zip files to an account's adimages
karthicks Oct 27, 2011
9c477c8
SOCIALFB-34 Add documentation for the Facebook Ads API
karthicks Oct 27, 2011
1c8b1ef
SOCIALFB-34 Add documentation for the Facebook Ads API
karthicks Oct 27, 2011
21742a5
SOCIALFB-34 Add ad account, campaign and group specific stats
karthicks Oct 27, 2011
8a61113
SOCIALFB-34 Retrieve Ad-Specific Autocomplete Data
karthicks Oct 28, 2011
5be9b2f
SOCIALFB-34 Assign proper values to ad creative type
karthicks Oct 28, 2011
001131a
SOCIALFB-34 Make creative's object id a long
karthicks Oct 29, 2011
743af95
SOCIALFB-34 Utility method for Facebook enumerations
karthicks Oct 31, 2011
397bde0
SOCIALFB-34 Pass actual ad creative type value, not its ordinal
karthicks Oct 31, 2011
d47ac4e
SOCIALFB-34 Serialize Enums Using #toString
karthicks Nov 2, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SOCIALFB-34 Assign proper values to ad creative type
karthicks committed Oct 28, 2011
commit 5be9b2fa91c573001b0649da97cd87694d137789
Original file line number Diff line number Diff line change
@@ -27,7 +27,26 @@
*/
public class AdCreative {
public enum AdCreativeType {
NONE, DEFAULT_BASIC_LINK_AD, INLINE_LIKE, EVENT_RSVP, APP_AD, SPONSORED_STORY_FOR_AN_APP_SHARE, SPONSORED_STORY_FOR_A_PAGE_LIKE_EVENT, SPONSORED_STORY_FOR_A_PLACE_CHECKIN_EVENT, SPONSORED_STORY_FOR_AN_APP_USED, SPONSORED_STORY_FOR_A_PAGE_POST_LIKE, SPONSORED_STORY_FOR_A_DOMAIN, SPONSORED_STORY_FOR_A_FACEBOOK_PAGE_UPDATE
DEFAULT_BASIC_LINK_AD(1), INLINE_LIKE(2), EVENT_RSVP(3), APP_AD(4), SPONSORED_STORY_FOR_AN_APP_SHARE(
8), SPONSORED_STORY_FOR_A_PAGE_LIKE_EVENT(9), SPONSORED_STORY_FOR_A_PLACE_CHECKIN_EVENT(
10), SPONSORED_STORY_FOR_AN_APP_USED(16), SPONSORED_STORY_FOR_A_PAGE_POST_LIKE(
17), SPONSORED_STORY_FOR_A_DOMAIN(19), SPONSORED_STORY_FOR_A_FACEBOOK_PAGE_UPDATE(
27);

private int value;

private AdCreativeType(int value) {
this.value = value;
}

public static AdCreativeType findByValue(int value) {
for (AdCreativeType type : values()) {
if (type.value == value) {
return type;
}
}
return null;
}
}

private String name;
Original file line number Diff line number Diff line change
@@ -18,7 +18,9 @@
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.springframework.social.facebook.api.ads.AdCreative;
import org.springframework.social.facebook.api.ads.AdCreative.AdCreativeType;

/**
* A Jackson mixin for the {@link AdCreative} object.
@@ -31,6 +33,10 @@ abstract class AdCreativeMixin {
AdCreativeMixin() {
}

@JsonProperty("type")
@JsonDeserialize(using=AdCreativeTypeDeserializer.class)
AdCreativeType type;

@JsonProperty("object_id")
int objectId;

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.social.facebook.api.ads.impl.json;

import java.io.IOException;

import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.springframework.social.facebook.api.ads.AdCreative.AdCreativeType;

/**
* A deserializer for parsing a {@link AdCreativeType} enum value.
*
* @author Karthick Sankarachary
*/
public class AdCreativeTypeDeserializer extends JsonDeserializer<AdCreativeType> {
@Override
public AdCreativeType deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
return AdCreativeType.findByValue(Integer.valueOf(jp.getText()
.toUpperCase()));
}
}