This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add this to ./features/support/hooks.rb | |
| After('@debug') do | |
| puts response.body | |
| end | |
| # tag any features with @debug to get the output printed | |
| # especially handy for testing json and xml responses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby-1.8.7-p249 > s = Chargify::Subscription.find(:first) | |
| ruby-1.8.7-p249 > s.credit_card.expiration_year | |
| => 2020 | |
| ruby-1.8.7-p249 > s.credit_card_attributes = {:expiration_year => "2014"} | |
| ruby-1.8.7-p249 > s.save | |
| ruby-1.8.7-p249 > s.reload | |
| ruby-1.8.7-p249 > s.credit_card.expiration_year | |
| => 2014 | |
| ruby-1.8.7-p249 > s = Chargify::Subscription.find(:first) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Is there a way to override the root name for as_json or to_json? | |
| # | |
| Book.first.to_json | |
| #=> "{\"book\":{\"created_at\":\"2010-03-23 | |
| Book.first.to_json(:root => 'libro') # is there an option like this? | |
| #=> "{\"libro\":{\"created_at\":\"2010-03-23 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Chargify::Product.find(:all).group_by{|p| p.product_family}.select{|pf| pf[0].id = PRODUCT_FAMILY_ID}.first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if %w(solo app app_master).include?(node[:instance_role]) | |
| user = node[:owner_name] | |
| framework_env = node[:environment][:framework_env] | |
| # Be sure to replace APP_NAME with the name of your application. | |
| # The run_for_app method also accepts multiple application name arguments. | |
| run_for_app 'foobar' do |app_name, data| | |
| worker_name = "#{app_name}_delayed_job" | |
| directory "/data/#{app_name}/shared/pids" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <subscription> | |
| <product_id>'.$product.'</product_id> | |
| <customer_attributes> | |
| <first_name>'.$fname.'</first_name> | |
| <last_name>'.$lname.'</last_name> | |
| <email>'.$email.'</email> | |
| <organization>'.$propertyname.'</organization> | |
| <address>'.$shipadd1.'</address> | |
| <address_2>'.$shipadd2.'</address_2> | |
| </customer_attributes> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rubygems" | |
| require "json" | |
| data = '[ | |
| { | |
| "name": "John Doe", | |
| "location": { | |
| "name": "New York, New York", | |
| "id": 12746342329 | |
| }, | |
| "hometown": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ree-1.8.7-2010.02 > she = She.new | |
| => #<She:0x1003727f0> | |
| ree-1.8.7-2010.02 > she.respond_to?(:steal) | |
| => true | |
| ree-1.8.7-2010.02 > she.respond_to?(:rob) | |
| => false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| egg_nog = { | |
| :egg_yolks => 12, | |
| :lbs_sugar => 1, | |
| :cups_rum => 2, | |
| :cups_bourbon => 2, | |
| :quarts_whipping_cream => 2, | |
| :egg_whites => 12, | |
| :nutmeg => "sprinkle" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| The 'Purchase Summary' section of the hosted page gets periodically updated via Ajax | |
| when the user: | |
| 1) Loads the page | |
| 2) Validates a Coupon | |
| 3) Validates a VAT number | |
| 4) Selects billing/shipping state/country (for tax purposes) | |
| Add this to the 'Custom JavaScript' section of your hosted page settings to respond to this event. |