Class: Cloudflare::CustomHostnames
- Inherits:
-
Representation
- Object
- Async::REST::Representation
- Representation
- Cloudflare::CustomHostnames
- Includes:
- Paginate
- Defined in:
- lib/cloudflare/custom_hostnames.rb
Instance Method Summary collapse
-
#create(hostname, metadata: nil, origin: nil, ssl: {}, &block) ⇒ Object
initializes a custom hostname object and yields it for customization before saving.
- #find_by_hostname(hostname) ⇒ Object
- #representation ⇒ Object
Methods included from Paginate
Methods inherited from Representation
#process_response, #represent, #represent_message, #to_hash
Instance Method Details
#create(hostname, metadata: nil, origin: nil, ssl: {}, &block) ⇒ Object
initializes a custom hostname object and yields it for customization before saving
70 71 72 73 74 75 76 |
# File 'lib/cloudflare/custom_hostnames.rb', line 70 def create(hostname, metadata: nil, origin: nil, ssl: {}, &block) attrs = { hostname: hostname, ssl: { method: 'http', type: 'dv' }.merge(ssl) } attrs[:custom_metadata] = if attrs[:custom_origin_server] = origin if origin (self.post(attrs)) end |
#find_by_hostname(hostname) ⇒ Object
78 79 80 |
# File 'lib/cloudflare/custom_hostnames.rb', line 78 def find_by_hostname(hostname) each(hostname: hostname).first end |
#representation ⇒ Object
65 66 67 |
# File 'lib/cloudflare/custom_hostnames.rb', line 65 def representation CustomHostname end |