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.



13871
13872
13873
13874
13875
13876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13871

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.



13869
13870
13871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13869

def environment
  @environment
end

#roleObject (readonly)

Returns the value of attribute role.



13869
13870
13871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13869

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13882
13883
13884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13882

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

#to_hashObject



13886
13887
13888
13889
13890
13891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13886

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

#to_jsonObject



13878
13879
13880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13878

def to_json
  JSON.dump(to_hash)
end