Class: Io::Flow::V0::Models::ShopifyGrant

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ShopifyGrant

Returns a new instance of ShopifyGrant.



20431
20432
20433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20431

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20429
20430
20431
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20429

def value
  @value
end

Class Method Details

.ALLObject



20451
20452
20453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20451

def ShopifyGrant.ALL
  @@all ||= [ShopifyGrant.customer, ShopifyGrant.discount, ShopifyGrant.gift_card, ShopifyGrant.metafield, ShopifyGrant.order]
end

.apply(value) ⇒ Object

Returns the instance of ShopifyGrant for this value, creating a new instance for an unknown value



20436
20437
20438
20439
20440
20441
20442
20443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20436

def ShopifyGrant.apply(value)
  if value.instance_of?(ShopifyGrant)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || ShopifyGrant.new(value))
  end
end

.customerObject

Access to /admin/customers.json



20456
20457
20458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20456

def ShopifyGrant.customer
  @@_customer ||= ShopifyGrant.new('customer')
end

.discountObject

Access to /admin/price_rules/:id/discount_codes.json



20461
20462
20463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20461

def ShopifyGrant.discount
  @@_discount ||= ShopifyGrant.new('discount')
end

.from_string(value) ⇒ Object

Returns the instance of ShopifyGrant for this value, or nil if not found



20446
20447
20448
20449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20446

def ShopifyGrant.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  ShopifyGrant.ALL.find { |v| v.value == value }
end

.gift_cardObject

Access to /admin/gift_cards.json



20466
20467
20468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20466

def ShopifyGrant.gift_card
  @@_gift_card ||= ShopifyGrant.new('gift_card')
end

.metafieldObject

Access to /admin/variants/:id/metafields.json



20471
20472
20473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20471

def ShopifyGrant.metafield
  @@_metafield ||= ShopifyGrant.new('metafield')
end

.orderObject

Access to /admin/orders/:id/metafields.json



20476
20477
20478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20476

def ShopifyGrant.order
  @@_order ||= ShopifyGrant.new('order')
end

Instance Method Details

#to_hashObject



20480
20481
20482
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20480

def to_hash
  value
end