Class: Io::Flow::V0::Models::Attachment
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Attachment
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Attachment
constructor
A new instance of Attachment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Attachment
Returns a new instance of Attachment.
28406 28407 28408 28409 28410 28411 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28406 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type, :url], 'Attachment') @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::AttachmentType) ? x : ::Io::Flow::V0::Models::AttachmentType.apply(x)) @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
28404 28405 28406 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28404 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
28404 28405 28406 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28404 def url @url end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28417 28418 28419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28417 def copy(incoming={}) Attachment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28421 28422 28423 28424 28425 28426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28421 def to_hash { :type => type.value, :url => url } end |
#to_json ⇒ Object
28413 28414 28415 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28413 def to_json JSON.dump(to_hash) end |