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.



16751
16752
16753
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16751

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16749
16750
16751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16749

def value
  @value
end

Class Method Details

.ALLObject



16771
16772
16773
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16771

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



16756
16757
16758
16759
16760
16761
16762
16763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16756

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



16776
16777
16778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16776

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

.discountObject

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



16781
16782
16783
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16781

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



16766
16767
16768
16769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16766

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



16786
16787
16788
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16786

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

.metafieldObject

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



16791
16792
16793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16791

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

.orderObject

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



16796
16797
16798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16796

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

Instance Method Details

#to_hashObject



16800
16801
16802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16800

def to_hash
  value
end