Sha256: 3a856cf18c0ac2654c40f19ad97cb076876b71dcd37116c154a6a817a185f99e

Contents?: true

Size: 1 KB

Versions: 15

Compression:

Stored size: 1 KB

Contents

module Attune
  module Model
    # Name/value pairs that provide additional context to the request
    #
    # @attr [String] name 
    # @attr [String] value 
    class ScopeEntry
      attr_accessor :name
      

      attr_accessor :value
      

      def initialize(attributes = {})
        return if attributes.empty?
        # Workaround since JSON.parse has accessors as strings rather than symbols
        @name = attributes["name"] || attributes[:"name"]
        # Workaround since JSON.parse has accessors as strings rather than symbols
        @value = attributes["value"] || attributes[:"value"]
        

      end

      def to_body
        Hash[ATTRIBUTE_MAP.map do |internal, external|
          next unless value = send(internal)
          [external, value]
        end.compact]
      end

      def to_json(options = {})
        to_body.to_json
      end

      private
      # :internal => :external
      ATTRIBUTE_MAP = {
          :name => :name,
          :value => :value

        }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
attune-1.0.21 lib/attune/models/scope_entry.rb
attune-1.0.20 lib/attune/models/scope_entry.rb
attune-1.0.19 lib/attune/models/scope_entry.rb
attune-1.0.18 lib/attune/models/scope_entry.rb
attune-1.0.17 lib/attune/models/scope_entry.rb
attune-1.0.16 lib/attune/models/scope_entry.rb
attune-1.0.15 lib/attune/models/scope_entry.rb
attune-1.0.14 lib/attune/models/scope_entry.rb
attune-1.0.13 lib/attune/models/scope_entry.rb
attune-1.0.12 lib/attune/models/scope_entry.rb
attune-1.0.11 lib/attune/models/scope_entry.rb
attune-1.0.10 lib/attune/models/scope_entry.rb
attune-1.0.9 lib/attune/models/scope_entry.rb
attune-1.0.8 lib/attune/models/scope_entry.rb
attune-1.0.7 lib/attune/models/scope_entry.rb