class Recurly::Schema::Attribute
Constants
- PRIMITIVE_TYPES
Attributes
The type of the attribute. Might be a class like ‘DateTime` or could be a Recurly
object. In this case a symbol should be used. Example: :Account. To get the Recurly
type use recurly_class
@return [Class,Symbol]
Public Class Methods
Source
# File lib/recurly/schema.rb, line 69 def self.build(type, options = {}) if PRIMITIVE_TYPES.include? type PrimitiveAttribute.new(type) elsif type == :Boolean BooleanAttribute.new elsif type == DateTime DateTimeAttribute.new elsif type.is_a? Symbol ResourceAttribute.new(type) elsif type == Array item_attr = build(options[:item_type]) ArrayAttribute.new(item_attr) else throw ArgumentError end end
Source
# File lib/recurly/schema.rb, line 86 def initialize(type = nil) @type = type end
Public Instance Methods
Source
# File lib/recurly/schema.rb, line 94 def recurly_class @recurly_class ||= Schema.get_recurly_class(type) end