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.



14580
14581
14582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14580

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14578
14579
14580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14578

def value
  @value
end

Class Method Details

.ALLObject



14600
14601
14602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14600

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



14585
14586
14587
14588
14589
14590
14591
14592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14585

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



14605
14606
14607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14605

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

.discountObject

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



14610
14611
14612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14610

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



14595
14596
14597
14598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14595

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



14615
14616
14617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14615

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

.metafieldObject

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



14620
14621
14622
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14620

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

.orderObject

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



14625
14626
14627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14625

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

Instance Method Details

#to_hashObject



14629
14630
14631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14629

def to_hash
  value
end