Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
exclude api docs pdf from gem file
  • Loading branch information
alextk committed Mar 25, 2012
1 parent 1ce5895 commit 467f38a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -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)
Expand Down Expand Up @@ -61,6 +64,7 @@ DEPENDENCIES
bundler (~> 1.0.0)
httparty
jeweler (~> 1.8.3)
logging
nokogiri
rcov
rdoc (~> 3.12)
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions 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
Expand All @@ -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)
Expand All @@ -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
Expand Down
36 changes: 23 additions & 13 deletions smsim.gemspec
Expand Up @@ -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 = [
Expand All @@ -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"
Expand All @@ -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"])
Expand All @@ -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"])
Expand All @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions spec/smsim/sender_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 467f38a

Please sign in to comment.