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.



26434
26435
26436
26437
26438
26439
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26434

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:role, :environment], 'OrganizationAuthorization')
  @role = (x = opts.delete(:role); 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.



26432
26433
26434
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26432

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



26432
26433
26434
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26432

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26445
26446
26447
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26445

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

#to_hashObject



26449
26450
26451
26452
26453
26454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26449

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

#to_jsonObject



26441
26442
26443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26441

def to_json
  JSON.dump(to_hash)
end