Class: Jekyll::PayPalEWP
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::PayPalEWP
- Defined in:
- lib/jekyllEWP.rb
Instance Method Summary collapse
-
#initialize(tag_name, variables, tokens) ⇒ PayPalEWP
constructor
A new instance of PayPalEWP.
-
#lookup(context, name) ⇒ Object
Lookup allows access to the page/post variables through the tag context blog.sverrirs.com/2016/04/custom-jekyll-tags.html.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, variables, tokens) ⇒ PayPalEWP
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/jekyllEWP.rb', line 168 def initialize(tag_name, variables, tokens) super @variables = variables.split(" ") = @variables[0] unless @variables[1].nil? = getBool(@variables[1]) else = false end unless @variables[2].nil? if == true #is an id @formid = @variables[2] else #is an image = @variables[2] end else #no value provided if == true #is an id @formid = 0 else #is an image = "https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" #some arbitrary thing end end end |
Instance Method Details
#lookup(context, name) ⇒ Object
Lookup allows access to the page/post variables through the tag context blog.sverrirs.com/2016/04/custom-jekyll-tags.html
208 209 210 211 212 |
# File 'lib/jekyllEWP.rb', line 208 def lookup(context, name) lookup = context name.split(".").each { |value| lookup = lookup[value] } lookup end |
#render(context) ⇒ Object
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/jekyllEWP.rb', line 214 def render(context) wrapInForm( getButtonEncryptionValue( getButtonOptionsString( "#{lookup(context, 'site.paypal_cert_id')}", getButtonCmd(), "#{lookup(context, 'site.paypal_email_address')}", "#{lookup(context, 'page.name')}", #product name "#{lookup(context, 'page.price')}"), #product price #"#{lookup(context, 'page.sku')}" #product identifier ENV['EWP_PRIVKEY'], ENV['EWP_PUBCERT'], ENV['EWP_PAYPAL_PUBCERT'], ENV['EWP_PRIVKEY_PASS']), "#{lookup(context, 'site.paypal_sandbox_mode')}", , , @formid) end |