Class: Phaxio::Resources::PhaxCode
- Inherits:
-
Phaxio::Resource
- Object
- Phaxio::Resource
- Phaxio::Resources::PhaxCode
- Defined in:
- lib/phaxio/resources/phax_code.rb
Overview
Provides functionality for viewing and managing PhaxCodes.
Instance Attribute Summary collapse
-
#created_at ⇒ Time
The time that the PhaxCode was created.
-
#identifier ⇒ String
The identifier for the PhaxCode.
-
#metadata ⇒ String
The metadata associated with the PhaxCode.
Class Method Summary collapse
-
.create(params = {}) ⇒ Phaxio::Resources::PhaxCode | File
Create a PhaxCode.
-
.get(params = {}) ⇒ Phaxio::Resources::PhaxCode | File
(also: find, retrieve)
Retrieve a PhaxCode.
Methods inherited from Phaxio::Resource
response_collection, response_record
Instance Attribute Details
#created_at ⇒ Time
Returns The time that the PhaxCode was created.
20 |
# File 'lib/phaxio/resources/phax_code.rb', line 20 has_time_attributes %w[created_at] |
#identifier ⇒ String
Returns The identifier for the PhaxCode.
|
# File 'lib/phaxio/resources/phax_code.rb', line 9
|
#metadata ⇒ String
Returns The metadata associated with the PhaxCode.
15 |
# File 'lib/phaxio/resources/phax_code.rb', line 15 has_normal_attributes %w[identifier metadata] |
Class Method Details
.create(params = {}) ⇒ Phaxio::Resources::PhaxCode | File
Create a PhaxCode.
32 33 34 35 36 37 38 39 40 |
# File 'lib/phaxio/resources/phax_code.rb', line 32 def create params = {} endpoint = case (params[:type] || params['type']).to_s when 'png' then phax_codes_endpoint_png else phax_codes_endpoint end result = Client.request :post, endpoint, params return result if result.is_a? File response_record result end |
.get(params = {}) ⇒ Phaxio::Resources::PhaxCode | File Also known as: find, retrieve
Retrieve a PhaxCode.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/phaxio/resources/phax_code.rb', line 52 def get params = {} identifier = params[:identifier] || params['identifier'] endpoint = case (identifier) when nil then default_phax_code_path else phax_code_endpoint(identifier) end endpoint = case (params[:type] || params['type']).to_s when 'png' then "#{endpoint}.png" else endpoint end result = Client.request :get, endpoint, {} return result if result.is_a? File response_record result end |