Skip to content

Commit

Permalink
fix latest message
Browse files Browse the repository at this point in the history
  • Loading branch information
mm580486 committed May 5, 2016
1 parent 2df3193 commit 5250724
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.bundle/
/.yardoc
*.gem
/.idea/
/Gemfile.lock
/_yardoc/
Expand Down
4 changes: 2 additions & 2 deletions kave.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
spec.authors = ["mohammad mahmoudi"]
spec.email = ["[email protected]"]

spec.summary = %q{Send SMS}
spec.description = %q{Send SMS by kavenegar services}
spec.summary = %q{Send SMS in iran}
spec.description = %q{Send SMS by kavenegar services in iran}
spec.homepage = "https://github.com/mm580486/kave"
spec.license = "mohammad mahmoudi"

Expand Down
8 changes: 3 additions & 5 deletions lib/kave/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@ def perform_validation
end

class ResponseLatestOutBox

attr_reader :response, :select
def validate(response = nil,send_simple_by)
def validate(response = nil,send_latest_by)
@response = response
@send_simple_by=send_simple_by
@send_latest_by=send_latest_by
perform_validation
return self
end
private
def perform_validation
raise ArgumentError, 'not a valid response' if @response.nil?

body = if @send_simple_by==:send_simple_by_apikey
body = if @send_latest_by==:selectlatest_by_apikey
@response[:selectlatest_by_apikey_response]
else
@response[:selectlatest_by_login_info_response]
end
# body =@response[:selectlatest_by_apikey_response]
@select = body[:selectlatest_by_apikey_result][:api_select]
end

Expand Down
6 changes: 3 additions & 3 deletions lib/kave/send_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ def initialize(args = {})
end

def call
@selectlatest_by=unless Kave.configuration.api_key.nil?
@send_latest_by=unless Kave.configuration.api_key.nil?
:selectlatest_by_apikey
else
:selectlatest_by_login_info
end
@pagesize=if @pagesize < 2;2;else;@pagesize;end
response = @wsdl.call :selectlatest_by_apikey, message: {
response = @wsdl.call @send_latest_by, message: {
'apikey' =>Kave.configuration.api_key,
'pagesize'=>@pagesize.to_i,
'sender' => Kave.configuration.sender
}
@response.validate(response.body,@send_latest_by)
@response.validate(response.body,@send_latest_by )
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/kave/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Kave
VERSION = "0.1.1"
VERSION = "0.1.2"
end

0 comments on commit 5250724

Please sign in to comment.