Class: SuperSendTX::DomainsResource
- Inherits:
-
Object
- Object
- SuperSendTX::DomainsResource
- Defined in:
- lib/supersendtx/resources.rb
Instance Method Summary collapse
- #apply(id_or_name, provider: "cloudflare", credentials: nil) ⇒ Object
- #create(name, inbound_enabled: nil) ⇒ Object
- #delete(id_or_name) ⇒ Object
- #get(id_or_name) ⇒ Object
-
#initialize(http) ⇒ DomainsResource
constructor
A new instance of DomainsResource.
- #list(limit: nil, cursor: nil, inbound_enabled: nil) ⇒ Object
- #update(id_or_name, **params) ⇒ Object
- #verify(id_or_name) ⇒ Object
Constructor Details
#initialize(http) ⇒ DomainsResource
Returns a new instance of DomainsResource.
78 79 80 |
# File 'lib/supersendtx/resources.rb', line 78 def initialize(http) @http = http end |
Instance Method Details
#apply(id_or_name, provider: "cloudflare", credentials: nil) ⇒ Object
103 104 105 106 107 |
# File 'lib/supersendtx/resources.rb', line 103 def apply(id_or_name, provider: "cloudflare", credentials: nil) body = { "action" => "apply", "provider" => provider } body["credentials"] = credentials if credentials @http.request("POST", "/domains/#{URI.encode_www_form_component(id_or_name)}", body: body) end |
#create(name, inbound_enabled: nil) ⇒ Object
93 94 95 96 97 |
# File 'lib/supersendtx/resources.rb', line 93 def create(name, inbound_enabled: nil) body = { "name" => name } body["inbound_enabled"] = inbound_enabled unless inbound_enabled.nil? @http.request("POST", "/domains", body: body) end |
#delete(id_or_name) ⇒ Object
113 114 115 |
# File 'lib/supersendtx/resources.rb', line 113 def delete(id_or_name) @http.request("DELETE", "/domains/#{URI.encode_www_form_component(id_or_name)}") end |
#get(id_or_name) ⇒ Object
89 90 91 |
# File 'lib/supersendtx/resources.rb', line 89 def get(id_or_name) @http.request("GET", "/domains/#{URI.encode_www_form_component(id_or_name)}") end |
#list(limit: nil, cursor: nil, inbound_enabled: nil) ⇒ Object
82 83 84 85 86 87 |
# File 'lib/supersendtx/resources.rb', line 82 def list(limit: nil, cursor: nil, inbound_enabled: nil) @http.request( "GET", "/domains#{@http.query({ "limit" => limit, "cursor" => cursor, "inbound_enabled" => inbound_enabled })}" ) end |
#update(id_or_name, **params) ⇒ Object
109 110 111 |
# File 'lib/supersendtx/resources.rb', line 109 def update(id_or_name, **params) @http.request("PATCH", "/domains/#{URI.encode_www_form_component(id_or_name)}", body: params) end |
#verify(id_or_name) ⇒ Object
99 100 101 |
# File 'lib/supersendtx/resources.rb', line 99 def verify(id_or_name) @http.request("POST", "/domains/#{URI.encode_www_form_component(id_or_name)}", body: { "action" => "verify" }) end |