class FacebookAds::Edge

Attributes

param_set_for_delete[R]
param_set_for_get[R]
param_set_for_post[R]
name[R]
node[R]
options[R]
should_delegate[R]

Public Class Methods

delete(return_type = 'AdObject') { |param_set_for_delete = param_set| ... } click to toggle source
# File lib/facebook_ads/edge.rb, line 163
def delete(return_type = 'AdObject')
  include EdgeHasDelete

  yield (@param_set_for_delete = ParamSet.new) if block_given?

  return_types(:delete, return_type)
end
get(return_type = 'AdObject') { |param_set_for_get = param_set| ... } click to toggle source
# File lib/facebook_ads/edge.rb, line 147
def get(return_type = 'AdObject')
  include EdgeHasGet

  yield (@param_set_for_get = ParamSet.new) if block_given?

  return_types(:get, return_type)
end
new(name, node, should_delegate, options) click to toggle source
# File lib/facebook_ads/edge.rb, line 123
def initialize(name, node, should_delegate, options)
  @name = name
  @node = node
  @options = options || {}
  @should_delegate = should_delegate
end
post(return_type = 'AdObject') { |param_set_for_post = param_set| ... } click to toggle source
# File lib/facebook_ads/edge.rb, line 155
def post(return_type = 'AdObject')
  include EdgeHasPost

  yield (@param_set_for_post = ParamSet.new) if block_given?

  return_types(:post, return_type)
end
return_types(action = nil, return_type = nil) click to toggle source

TODO refactor?

# File lib/facebook_ads/edge.rb, line 172
def return_types(action = nil, return_type = nil)
  if action
    if return_type
      @return_types ||= {}
      @return_types[action] = FieldTypes.for(return_type)
    end
    @return_types[action]
  else
    @return_types
  end
end

Public Instance Methods

graph_params() click to toggle source

TODO refactor sending this along with params to leverage read-after-write

# File lib/facebook_ads/edge.rb, line 140
def graph_params
  {fields: options[:fields]}.compact
end
serialized_options() click to toggle source
# File lib/facebook_ads/edge.rb, line 130
def serialized_options
  Hash[options.map { |k,v|
    v = (k == :fields && v.is_a?(Array)) ?
         v.join(',') : v
    [k,v]
  }]
end