Class: PortaText::Command::Base
- Inherits:
-
Object
- Object
- PortaText::Command::Base
show all
- Defined in:
- lib/portatext/command/base.rb
Overview
The base command class.
- Author
-
Marcelo Gornstein ([email protected])
- Copyright
-
Copyright © 2015 PortaText
- License
-
Apache-2.0
Direct Known Subclasses
Api::Acl, Api::Blacklist, Api::Calls, Api::CampaignLifecycle, Api::Campaigns, Api::Cnam, Api::ContactLists, Api::Contacts, Api::CreditCards, Api::Destinations, Api::DidSearch, Api::DidSettings, Api::EmailVerify, Api::GsmCharset, Api::Jobs, Api::Me, Api::MyPassword, Api::NumberInspect, Api::NumberVerify, Api::Operators, Api::Recharge, Api::Services, Api::Settings, Api::Simulate, Api::Sms, Api::Sounds, Api::Summary, Api::Tariffs, Api::Templates, Api::Timezones, Api::Trunks, Api::Version
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
57
58
59
|
# File 'lib/portatext/command/base.rb', line 57
def initialize
@args = {}
end
|
Instance Attribute Details
#client=(value) ⇒ Object
Sets the attribute client
11
12
13
|
# File 'lib/portatext/command/base.rb', line 11
def client=(value)
@client = value
end
|
Instance Method Details
#accept_content_type(_method) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/portatext/command/base.rb', line 44
def accept_content_type(_method)
return '*/*' unless @args[:accept_any_file].nil?
return 'text/csv' unless @args[:accept_file].nil?
return 'audio/mpeg' unless @args[:accept_sound_file].nil?
'application/json'
end
|
#body(_method) ⇒ Object
51
52
53
54
55
|
# File 'lib/portatext/command/base.rb', line 51
def body(_method)
return "file:#{@args[:file]}" unless @args[:file].nil?
return '' if @args.size.eql? 0
@args.to_json
end
|
#content_type(_method) ⇒ Object
38
39
40
41
42
|
# File 'lib/portatext/command/base.rb', line 38
def content_type(_method)
return 'text/csv' unless @args[:file].nil?
return 'audio/mpeg' unless @args[:sound_file].nil?
'application/json'
end
|
#delete ⇒ Object
29
30
31
|
# File 'lib/portatext/command/base.rb', line 29
def delete
run :delete
end
|
#get ⇒ Object
13
14
15
|
# File 'lib/portatext/command/base.rb', line 13
def get
run :get
end
|
#patch ⇒ Object
25
26
27
|
# File 'lib/portatext/command/base.rb', line 25
def patch
run :patch
end
|
#post ⇒ Object
17
18
19
|
# File 'lib/portatext/command/base.rb', line 17
def post
run :post
end
|
#put ⇒ Object
21
22
23
|
# File 'lib/portatext/command/base.rb', line 21
def put
run :put
end
|
#set(key, value) ⇒ Object
33
34
35
36
|
# File 'lib/portatext/command/base.rb', line 33
def set(key, value)
@args[key] = value
self
end
|