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.



18149
18150
18151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18149

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18147
18148
18149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18147

def value
  @value
end

Class Method Details

.ALLObject



18169
18170
18171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18169

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



18154
18155
18156
18157
18158
18159
18160
18161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18154

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



18174
18175
18176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18174

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

.discountObject

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



18179
18180
18181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18179

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



18164
18165
18166
18167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18164

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



18184
18185
18186
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18184

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

.metafieldObject

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



18189
18190
18191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18189

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

.orderObject

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



18194
18195
18196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18194

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

Instance Method Details

#to_hashObject



18198
18199
18200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18198

def to_hash
  value
end