We want to use actionwebservice for some SOAP integration. We were able to install it however using it causes an error. Here's my code:
class HelloMessageApi < ActionWebService::Base
api_method :hello_message,
:expects => [{:firstname=>:string},
{:lastname=>:string}],
:returns => [:string]
end
The error returned is
uninitialized constant
ActionWebService
When I do a gem list I can see the gem installed, what am I missing? Please help.
Related
I am using the stripe gem and stripe_event gem in a Rails 4.0.6 application using Ruby 2.1.5. It has been working well until I tried either the 'Securing your webhook endpoint' or 'Authenticating webhooks' section of the stripe_event gem readme (https://github.com/integrallis/stripe_event#authenticating-webhooks). It seems both issues have similar behavior so I will just describe the second one here.
When I try to authenticate my webhook (which worked fine before trying this) with the following code, I get an uninitialized constant error.
#config/initializers/stripe.rb
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
#this is the line that supposedly tells stripe_event to verify the stripe signature
StripeEvent.signing_secret = ENV['STRIPE_SIGNING_SECRET']
StripeEvent.configure do |events|
events.all do |event|
if event.type == 'invoice.payment_failed'
#handled this event...removed code for clarity since works fine
end
end
end
This is the error:
NameError stripe_event/webhook#event
uninitialized constant Stripe::SignatureVerificationError
I got the stripe signing secret from my stripe dashboard as described in the stripe docs: https://stripe.com/docs/webhooks#signatures
I have been testing triggering the event as described in the stripe docs: https://stripe.com/docs/recipes/sending-emails-for-failed-payments#testing
Any help on this will be much appreciated.
Try to update your stripe gem. It will start working.
I followed the instructions on installing geokit-rails (v 2.0.1) and geokit (v 1.8.5). Then attempted to create my own geocoder (to be used with tests). Here is the code I use in my config/initializers/fake_geocoder.rb file
require 'geokit'
module GeoKit
module Geocoders
class FakeGeocoder < Geocoder
#to use, include :fake in the list of geocoders
private
def self.do_geocode(location, options = {})
geocode_payload = GeoKit::GeoLoc.new(:lat => 123.456, :lng => 123.456)
geocode_payload.success = true
return geocode_payload
end
end
end
end
When attempting to start up the rails console (bundle exec rails c), I get the following error:
../config/initializers/fake_geocoder.rb:6:in `<module:Geocoders>': uninitialized constant GeoKit::Geocoders::Geocoder (NameError)
from ../config/initializers/fake_geocoder.rb:5:in `<module:GeoKit>'
from ../config/initializers/fake_geocoder.rb:4:in `<top (required)>'
Any advice you can provide as to why it can't find the Geocoder class would be greatly appreciated.
For a while Geokit and GeoKit (capital K) worked. 1.7.1 removed GeoKit.
Simply replace any reference to GeoKit with Geokit
I'm the maintainer of Geokit so if there's any README's that are out of date (I couldn't see any) please let me know.
I noticed weird thing developing Spree application (I'm using Spree 1.3.2):
Spree uses model called Zone. Zone is associated with zone_members, like this:
has_many :zone_members, :dependent => :destroy, :class_name => "Spree::ZoneMember"
Strange part begins here, in rails console:
zone = Spree::Zone.first
zone.zone_members.empty?
# => true
zone.zone_members
# => []
zone.zone_members.reload.empty?
# => false
zone.zone_members
# => [#<Spree::ZoneMember id: 4914820, zoneable_id: 13, zoneable_type: ...
What's interesting this problem doesn't occur in Spree 1.3.3.
Apart from Spree, I use Rails 3.2.14 (or Rails 3.2.13 - the same result) and Ruby 1.9.3.
Does anybody know why does it happen?
I would guess that this was a bug that was fixed between Spree 1.3.2 and Spree 1.3.3. I highly recommend using 1.3.3, as that is the latest stable gem release from that branch and probably contains more than just that fix.
I've been at this for awhile. I've tried using net http to connect to a https url with no luck. I've tried http party and getting uninitialized constant httpparty. I am running rails 3.2.7. I have httpparty add to gem file.
Can someone please provide an example with either problem sending params to a https url and receiving a response.
code:
options = {:id => params[:id], :code => params[:code]}
response = HTTPParty.post('https://test.com', options)
gem file:
gem "httparty", "~> 0.9.0"
HTTParty.get('https://google.com', :query => {:q => 'stack overflow'})
If this doesn't work for you, please show the code you're using. It you're getting an uninitialized constant error, you've done something wrong. Did you run bundle after adding to your Gemfile?
Also, it's HTTParty, not HTTPParty.
I attempted to install the gmaps4rails gem.
I added gem 'gmaps4rails' to my Gemfile, and ran 'bundle install. It said that my bundle installed successfully. I can find "Using gmaps4rails (0.8.8)" with 'gem list'. I added the specified columns to my users table with rake db:migrate and added acts_as_gmappable and the gmaps4rails_address method to my User model.
Visiting pages that involve the user model gives me "undefined local variable or method 'acts_as_gmappable'"error.
Is there something that I am missing?
For greater context, the code I am using is from the Rails 3 Tutorial.
OS X 10.6.6
ruby 1.8.7
rails 3.0.7
passenger 3.0.7
Restarting the server should resolve the problem :)
I had the same issue : undefined local variable or method 'acts_as_gmappable'
I just restarted the server and it error went away.
I was using Mongoid and had the same trouble.
In which case, make sure your model includes:
include Gmaps4rails::ActsAsGmappable
acts_as_gmappable :position => :location
field :gmaps, :type => Boolean
field :location, :type => Array
def gmaps4rails_address
#describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki
"#{self.address}, #{self.city}, #{self.country}"
end
I think this may be helpful (similar issue):
rvm + rails3 + gmaps4rails - acts_as_gmappable