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.



26601
26602
26603
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26601

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



26599
26600
26601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26599

def value
  @value
end

Class Method Details

.ALLObject



26621
26622
26623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26621

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



26606
26607
26608
26609
26610
26611
26612
26613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26606

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



26626
26627
26628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26626

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

.discountObject

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



26631
26632
26633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26631

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



26616
26617
26618
26619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26616

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



26636
26637
26638
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26636

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

.metafieldObject

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



26641
26642
26643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26641

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

.orderObject

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



26646
26647
26648
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26646

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

Instance Method Details

#to_hashObject



26650
26651
26652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26650

def to_hash
  value
end