Skip to content

Commit

Permalink
fix response latest out box
Browse files Browse the repository at this point in the history
  • Loading branch information
mm580486 committed May 2, 2016
1 parent 8f7e086 commit 2df3193
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 171 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.bundle/
/.yardoc
/.DS_Store
/.idea/
/Gemfile.lock
/_yardoc/
Expand All @@ -9,3 +8,10 @@
/pkg/
/spec/reports/
/tmp/
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/.rakeTasks

This file was deleted.

29 changes: 0 additions & 29 deletions .idea/kave.iml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

87 changes: 0 additions & 87 deletions .idea/workspace.xml

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ Kave.configure do |config|
config.wsdl ='http://api.kavenegar.com/soap/v1.asmx?WSDL'
config.sender = 'number'

# You can user api key or username and password for authinticate
# You can use api key or username and password for authinticate
config.api_key = 'api key'
# OR
config.username = 'kave username'
config.password = 'kave password'
end
```
[kavenegar.com](http://kavenegar.com/) for receiver api key !
[kavenegar.com](http://kavenegar.com/) for receive api key !
## Usage
alright ;) , now you can call kave function for send simply sms by loginfo or api key
alright ;) now you can call kave function for send simply sms by loginfo or api key

```ruby
class HomeController < ApplicationController
Expand All @@ -59,6 +59,7 @@ end

for report issues contact me on twitter [@mm580486](https://twitter.com/mm580486)


## persian tutorials

1-[youtube send simply sms by kave gem](https://twitter.com/mm580486)
Expand Down
Binary file added kave-0.1.1.gem
Binary file not shown.
11 changes: 2 additions & 9 deletions kave.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@ Gem::Specification.new do |spec|

spec.summary = %q{Send SMS}
spec.description = %q{Send SMS by kavenegar services}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
spec.license = "MIT"
spec.homepage = "https://github.com/mm580486/kave"
spec.license = "mohammad mahmoudi"

# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
# delete this section to allow pushing this gem to any host.
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end
spec.add_dependency 'savon', ['~> 2.0']
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
Expand Down
14 changes: 9 additions & 5 deletions lib/kave/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def valid?
private
def perform_validation
raise ArgumentError, 'not a valid response' if @response.nil?

body = if @send_simple_by==:send_simple_by_apikey
@response[:send_simple_by_apikey_response]
else
Expand All @@ -32,20 +31,25 @@ def perform_validation
end
end


class ResponseLatestOutBox

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

body = if @send_simple_by==:send_simple_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
2 changes: 1 addition & 1 deletion lib/kave/send_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def call
else
:selectlatest_by_login_info
end
@pagesize=if @pagesize < 2;2;else;@pagesize;end
@pagesize=if @pagesize < 2;2;else;@pagesize;end
response = @wsdl.call :selectlatest_by_apikey, message: {
'apikey' =>Kave.configuration.api_key,
'pagesize'=>@pagesize.to_i,
Expand Down

0 comments on commit 2df3193

Please sign in to comment.