Class: Io::Flow::V0::Models::OrganizationAuthorization

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Defines the data used for broad authorization of user access to org level data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationAuthorization

Returns a new instance of OrganizationAuthorization.



41801
41802
41803
41804
41805
41806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41801

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:environment], 'OrganizationAuthorization')
  @role = (x = opts.delete(:role); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x)))
  @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x))
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



41799
41800
41801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41799

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



41799
41800
41801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41799

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41812
41813
41814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41812

def copy(incoming={})
  OrganizationAuthorization.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



41816
41817
41818
41819
41820
41821
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41816

def to_hash
  {
    :role => role.nil? ? nil : role.value,
    :environment => environment.value
  }
end

#to_jsonObject



41808
41809
41810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41808

def to_json
  JSON.dump(to_hash)
end