Permalink
Browse files

exclude api docs pdf from gem file

  • Loading branch information...
1 parent 1ce5895 commit 467f38a2515a5144c787c3b19449291edfb0f745 @alextk committed Mar 25, 2012
Showing with 38 additions and 15 deletions.
  1. +1 −0 Gemfile
  2. +4 −0 Gemfile.lock
  3. +2 −0 Rakefile
  4. +6 −0 lib/smsim/sender.rb
  5. +23 −13 smsim.gemspec
  6. +2 −2 spec/smsim/sender_spec.rb
View
1 Gemfile
@@ -5,6 +5,7 @@ gem 'builder'
gem 'savon'
gem 'nokogiri'
gem 'uuidtools'
+gem 'logging'
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
View
4 Gemfile.lock
@@ -21,6 +21,9 @@ GEM
rake
rdoc
json (1.6.5)
+ little-plugger (1.1.3)
+ logging (1.6.1)
+ little-plugger (>= 1.1.2)
multi_json (1.0.4)
multi_xml (0.4.1)
nokogiri (1.5.0)
@@ -61,6 +64,7 @@ DEPENDENCIES
bundler (~> 1.0.0)
httparty
jeweler (~> 1.8.3)
+ logging
nokogiri
rcov
rdoc (~> 3.12)
View
2 Rakefile
@@ -21,6 +21,8 @@ Jeweler::Tasks.new do |gem|
gem.description = %Q{Ruby api for sms service provider: Smsim}
gem.email = "tkachev.alex@gmail.com"
gem.authors = ["Alex Tkachev"]
+
+ gem.files.exclude 'api_docs/**/*'
# dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new
View
6 lib/smsim/sender.rb
@@ -1,10 +1,12 @@
require 'httparty'
+require 'logging'
module Smsim
# this class sends smses and parses repsones
class Sender
include ::HTTParty
+ attr_reader :logger
# Create new sms sender with given +options+ with the following keys:
# * +username+ - gateway username
@@ -16,6 +18,7 @@ def initialize(options)
raise ArgumentError.new("HTTP post url is missing") if options[:http_post_url].blank?
raise ArgumentError.new("Username and password must be present") if options[:username].blank? || options[:password].blank?
@options = options
+ @logger = Logging.logger[self]
end
def send_sms(message_text, phones)
@@ -26,10 +29,13 @@ def send_sms(message_text, phones)
message_id = generate_message_id
xml = build_send_sms_xml(message_text, phones, message_id)
+ logger.debug "#send_sms - xml - \n #{xml}"
response = self.class.post(@options[:http_post_url], :body => {:InforuXML => xml})
+ logger.debug "#send_sms - got http response: code=#{response.code}; body=\n#{response.parsed_response}"
verify_http_response_code(response) # error will be raised if response code is bad
response = parse_response_xml(response)
response.message_id = message_id
+ logger.debug "#send_sms - parsed response: #{response.inspect}"
if response.status != 1
raise Smsim::Errors::GatewayError.new(Smsim::Errors::GatewayError.map_send_sms_xml_response_status(response.status), "Sms send failed (status #{response.status}): #{response.description}")
end
View
36 smsim.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alex Tkachev"]
- s.date = "2012-03-12"
+ s.date = "2012-03-25"
s.description = "Ruby api for sms service provider: Smsim"
s.email = "tkachev.alex@gmail.com"
s.extra_rdoc_files = [
@@ -26,25 +26,29 @@ Gem::Specification.new do |s|
"Rakefile",
"VERSION",
"lib/smsim.rb",
+ "lib/smsim/config.rb",
"lib/smsim/core_ext/blank.rb",
- "lib/smsim/delivery_notification.rb",
- "lib/smsim/errors/delivery_notification_error.rb",
- "lib/smsim/errors/error.rb",
+ "lib/smsim/delivery_notifications_parser.rb",
"lib/smsim/errors/gateway_error.rb",
- "lib/smsim/errors/http_response_error.rb",
- "lib/smsim/errors/xml_response_error.rb",
"lib/smsim/gateway.rb",
- "lib/smsim/http_executor.rb",
- "lib/smsim/xml_request_builder.rb",
- "lib/smsim/xml_response_parser.rb",
+ "lib/smsim/report_puller.rb",
+ "lib/smsim/sender.rb",
+ "lib/smsim/sms_replies_parser.rb",
+ "lib/smsim/sms_reply.rb",
"smsim.gemspec",
- "spec/smsim/delivery_notification_spec.rb",
+ "spec/resources/ClientServices.asmx.wsdl.xml",
+ "spec/resources/EnvelopeResponse.soap.xml",
+ "spec/resources/PullClientNotificationResponse.soap.xml",
+ "spec/resources/SmsReplyPush.xml",
+ "spec/resources/SmsSendResponse.xml",
+ "spec/smsim/delivery_notifications_parser_spec.rb",
"spec/smsim/gateway_spec.rb",
- "spec/smsim/http_executor_spec.rb",
- "spec/smsim/xml_request_builder_spec.rb",
- "spec/smsim/xml_response_parser_spec.rb",
+ "spec/smsim/report_puller_spec.rb",
+ "spec/smsim/sender_spec.rb",
+ "spec/smsim/sms_replies_parser_spec.rb",
"spec/smsim_spec.rb",
"spec/spec_helper.rb",
+ "spec/support/file_macros.rb",
"spec/support/smsim_gateway_macros.rb"
]
s.homepage = "http://github.com/alextk/smsim"
@@ -59,8 +63,10 @@ Gem::Specification.new do |s|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<httparty>, [">= 0"])
s.add_runtime_dependency(%q<builder>, [">= 0"])
+ s.add_runtime_dependency(%q<savon>, [">= 0"])
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
s.add_runtime_dependency(%q<uuidtools>, [">= 0"])
+ s.add_runtime_dependency(%q<logging>, [">= 0"])
s.add_development_dependency(%q<rspec>, ["= 2.7.0"])
s.add_development_dependency(%q<webmock>, [">= 0"])
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
@@ -70,8 +76,10 @@ Gem::Specification.new do |s|
else
s.add_dependency(%q<httparty>, [">= 0"])
s.add_dependency(%q<builder>, [">= 0"])
+ s.add_dependency(%q<savon>, [">= 0"])
s.add_dependency(%q<nokogiri>, [">= 0"])
s.add_dependency(%q<uuidtools>, [">= 0"])
+ s.add_dependency(%q<logging>, [">= 0"])
s.add_dependency(%q<rspec>, ["= 2.7.0"])
s.add_dependency(%q<webmock>, [">= 0"])
s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -82,8 +90,10 @@ Gem::Specification.new do |s|
else
s.add_dependency(%q<httparty>, [">= 0"])
s.add_dependency(%q<builder>, [">= 0"])
+ s.add_dependency(%q<savon>, [">= 0"])
s.add_dependency(%q<nokogiri>, [">= 0"])
s.add_dependency(%q<uuidtools>, [">= 0"])
+ s.add_dependency(%q<logging>, [">= 0"])
s.add_dependency(%q<rspec>, ["= 2.7.0"])
s.add_dependency(%q<webmock>, [">= 0"])
s.add_dependency(%q<rdoc>, ["~> 3.12"])
View
4 spec/smsim/sender_spec.rb
@@ -65,8 +65,8 @@
end
it 'should have delivery notification url if specified' do
- options.update(:delivery_notification_url => 'http://google.com')
- xml_doc.at_css('Inforu Settings DeliveryNotificationUrl').text.should == "http://google.com"
+ options.update(:delivery_notification_url => 'http://google.com?auth=1234&alex=king')
+ xml_doc.at_css('Inforu Settings DeliveryNotificationUrl').text.should == "http://google.com?auth=1234&alex=king"
end
it 'should not have delivery notification url if not specified' do

0 comments on commit 467f38a

Please sign in to comment.