Class: FacebookAds::Edge
- Inherits:
-
Object
- Object
- FacebookAds::Edge
- Defined in:
- lib/facebook_ads/edge.rb
Class Attribute Summary collapse
-
.param_set_for_delete ⇒ Object
readonly
Returns the value of attribute param_set_for_delete.
-
.param_set_for_get ⇒ Object
readonly
Returns the value of attribute param_set_for_get.
-
.param_set_for_post ⇒ Object
readonly
Returns the value of attribute param_set_for_post.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#should_delegate ⇒ Object
readonly
Returns the value of attribute should_delegate.
Class Method Summary collapse
- .delete(return_type = 'AdObject') {|(@param_set_for_delete = ParamSet.new)| ... } ⇒ Object
- .get(return_type = 'AdObject') {|(@param_set_for_get = ParamSet.new)| ... } ⇒ Object
- .post(return_type = 'AdObject') {|(@param_set_for_post = ParamSet.new)| ... } ⇒ Object
-
.return_types(action = nil, return_type = nil) ⇒ Object
TODO refactor?.
Instance Method Summary collapse
-
#graph_params ⇒ Object
TODO refactor sending this along with params to leverage read-after-write.
-
#initialize(name, node, should_delegate, options) ⇒ Edge
constructor
A new instance of Edge.
- #serialized_options ⇒ Object
Constructor Details
#initialize(name, node, should_delegate, options) ⇒ Edge
Returns a new instance of Edge.
111 112 113 114 115 116 |
# File 'lib/facebook_ads/edge.rb', line 111 def initialize(name, node, should_delegate, ) @name = name @node = node @options = || {} @should_delegate = should_delegate end |
Class Attribute Details
.param_set_for_delete ⇒ Object (readonly)
Returns the value of attribute param_set_for_delete.
133 134 135 |
# File 'lib/facebook_ads/edge.rb', line 133 def param_set_for_delete @param_set_for_delete end |
.param_set_for_get ⇒ Object (readonly)
Returns the value of attribute param_set_for_get.
133 134 135 |
# File 'lib/facebook_ads/edge.rb', line 133 def param_set_for_get @param_set_for_get end |
.param_set_for_post ⇒ Object (readonly)
Returns the value of attribute param_set_for_post.
133 134 135 |
# File 'lib/facebook_ads/edge.rb', line 133 def param_set_for_post @param_set_for_post end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
109 110 111 |
# File 'lib/facebook_ads/edge.rb', line 109 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
109 110 111 |
# File 'lib/facebook_ads/edge.rb', line 109 def node @node end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
109 110 111 |
# File 'lib/facebook_ads/edge.rb', line 109 def @options end |
#should_delegate ⇒ Object (readonly)
Returns the value of attribute should_delegate.
109 110 111 |
# File 'lib/facebook_ads/edge.rb', line 109 def should_delegate @should_delegate end |
Class Method Details
.delete(return_type = 'AdObject') {|(@param_set_for_delete = ParamSet.new)| ... } ⇒ Object
151 152 153 154 155 156 157 |
# File 'lib/facebook_ads/edge.rb', line 151 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 = ParamSet.new)| ... } ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/facebook_ads/edge.rb', line 135 def get(return_type = 'AdObject') include EdgeHasGet yield (@param_set_for_get = ParamSet.new) if block_given? return_types(:get, return_type) end |
.post(return_type = 'AdObject') {|(@param_set_for_post = ParamSet.new)| ... } ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/facebook_ads/edge.rb', line 143 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) ⇒ Object
TODO refactor?
160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/facebook_ads/edge.rb', line 160 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 |
Instance Method Details
#graph_params ⇒ Object
TODO refactor sending this along with params to leverage read-after-write
128 129 130 |
# File 'lib/facebook_ads/edge.rb', line 128 def graph_params {fields: [:fields]}.compact end |
#serialized_options ⇒ Object
118 119 120 121 122 123 124 |
# File 'lib/facebook_ads/edge.rb', line 118 def Hash[.map { |k,v| v = (k == :fields && v.is_a?(Array)) ? v.join(',') : v [k,v] }] end |