Class: Io::Flow::V0::Models::ShopifyMerchantApplication

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

Instance Attribute Summary collapse

Attributes inherited from MerchantApplication

#discriminator

Instance Method Summary collapse

Methods inherited from MerchantApplication

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyMerchantApplication

Returns a new instance of ShopifyMerchantApplication.



62994
62995
62996
62997
62998
62999
63000
63001
63002
63003
63004
63005
63006
63007
63008
63009
63010
63011
63012
63013
63014
63015
63016
63017
63018
63019
63020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62994

def initialize(incoming={})
  super(:discriminator => MerchantApplication::Types::SHOPIFY_MERCHANT_APPLICATION)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :created_at], 'ShopifyMerchantApplication')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @company = (x = opts.delete(:company); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MerchantInfo) ? x : ::Io::Flow::V0::Models::MerchantInfo.new(x)))
  @indirect_tax_number = (x = opts.delete(:indirect_tax_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('indirect_tax_number', x, String))
  @parent_company = (x = opts.delete(:parent_company); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MerchantInfo) ? x : ::Io::Flow::V0::Models::MerchantInfo.new(x)))
  @beneficiary = (x = opts.delete(:beneficiary); x.nil? ? nil : HttpClient::Preconditions.assert_class('beneficiary', x, String))
  @business_url = (x = opts.delete(:business_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('business_url', x, String))
  @business_description = (x = opts.delete(:business_description); x.nil? ? nil : HttpClient::Preconditions.assert_class('business_description', x, String))
  @business_address = (x = opts.delete(:business_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
  @refund_percentage = (x = opts.delete(:refund_percentage); x.nil? ? nil : HttpClient::Preconditions.assert_class('refund_percentage', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @chargeback_percentage = (x = opts.delete(:chargeback_percentage); x.nil? ? nil : HttpClient::Preconditions.assert_class('chargeback_percentage', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @bank_account_number = (x = opts.delete(:bank_account_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('bank_account_number', x, String))
  @aba_routing_transit_number = (x = opts.delete(:aba_routing_transit_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('aba_routing_transit_number', x, String))
  @trade_sectors = (x = opts.delete(:trade_sectors); x.nil? ? nil : HttpClient::Preconditions.assert_class('trade_sectors', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OnboardingTradeSector) ? x : ::Io::Flow::V0::Models::OnboardingTradeSector.apply(x)) })
  @other_trade_sector = (x = opts.delete(:other_trade_sector); x.nil? ? nil : HttpClient::Preconditions.assert_class('other_trade_sector', x, String))
  @third_party_logistics_partners = (x = opts.delete(:third_party_logistics_partners); x.nil? ? nil : HttpClient::Preconditions.assert_class('third_party_logistics_partners', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ThirdPartyLogisticsPartner) ? x : ::Io::Flow::V0::Models::ThirdPartyLogisticsPartner.new(x)) })
  @average_order_weight = (x = opts.delete(:average_order_weight); x.nil? ? nil : HttpClient::Preconditions.assert_class('average_order_weight', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @package_dimensions = (x = opts.delete(:package_dimensions); x.nil? ? nil : HttpClient::Preconditions.assert_class('package_dimensions', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Dimension) ? x : ::Io::Flow::V0::Models::Dimension.new(x)) })
  @monthly_average = (x = opts.delete(:monthly_average); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MonthlyAverage) ? x : ::Io::Flow::V0::Models::MonthlyAverage.new(x)))
  @dangerous_goods = (x = opts.delete(:dangerous_goods); x.nil? ? nil : HttpClient::Preconditions.assert_class('dangerous_goods', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OnboardingDangerousGoods) ? x : ::Io::Flow::V0::Models::OnboardingDangerousGoods.apply(x)) })
  @default_country_of_origin = (x = opts.delete(:default_country_of_origin); x.nil? ? nil : HttpClient::Preconditions.assert_class('default_country_of_origin', x, String))
  @ratecard = (x = opts.delete(:ratecard); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::RatecardReference) ? x : ::Io::Flow::V0::Models::RatecardReference.new(x)))
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#aba_routing_transit_numberObject (readonly)

Returns the value of attribute aba_routing_transit_number.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def aba_routing_transit_number
  @aba_routing_transit_number
end

#average_order_weightObject (readonly)

Returns the value of attribute average_order_weight.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def average_order_weight
  @average_order_weight
end

#bank_account_numberObject (readonly)

Returns the value of attribute bank_account_number.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def 
  @bank_account_number
end

#beneficiaryObject (readonly)

Returns the value of attribute beneficiary.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def beneficiary
  @beneficiary
end

#business_addressObject (readonly)

Returns the value of attribute business_address.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def business_address
  @business_address
end

#business_descriptionObject (readonly)

Returns the value of attribute business_description.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def business_description
  @business_description
end

#business_urlObject (readonly)

Returns the value of attribute business_url.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def business_url
  @business_url
end

#chargeback_percentageObject (readonly)

Returns the value of attribute chargeback_percentage.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def chargeback_percentage
  @chargeback_percentage
end

#companyObject (readonly)

Returns the value of attribute company.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def company
  @company
end

#created_atObject (readonly)

Returns the value of attribute created_at.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def created_at
  @created_at
end

#dangerous_goodsObject (readonly)

Returns the value of attribute dangerous_goods.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def dangerous_goods
  @dangerous_goods
end

#default_country_of_originObject (readonly)

Returns the value of attribute default_country_of_origin.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def default_country_of_origin
  @default_country_of_origin
end

#idObject (readonly)

Returns the value of attribute id.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def id
  @id
end

#indirect_tax_numberObject (readonly)

Returns the value of attribute indirect_tax_number.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def indirect_tax_number
  @indirect_tax_number
end

#monthly_averageObject (readonly)

Returns the value of attribute monthly_average.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def monthly_average
  @monthly_average
end

#other_trade_sectorObject (readonly)

Returns the value of attribute other_trade_sector.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def other_trade_sector
  @other_trade_sector
end

#package_dimensionsObject (readonly)

Returns the value of attribute package_dimensions.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def package_dimensions
  @package_dimensions
end

#parent_companyObject (readonly)

Returns the value of attribute parent_company.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def parent_company
  @parent_company
end

#ratecardObject (readonly)

Returns the value of attribute ratecard.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def ratecard
  @ratecard
end

#refund_percentageObject (readonly)

Returns the value of attribute refund_percentage.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def refund_percentage
  @refund_percentage
end

#third_party_logistics_partnersObject (readonly)

Returns the value of attribute third_party_logistics_partners.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def third_party_logistics_partners
  @third_party_logistics_partners
end

#trade_sectorsObject (readonly)

Returns the value of attribute trade_sectors.



62992
62993
62994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62992

def trade_sectors
  @trade_sectors
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63026
63027
63028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63026

def copy(incoming={})
  ShopifyMerchantApplication.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



63030
63031
63032
63033
63034
63035
63036
63037
63038
63039
63040
63041
63042
63043
63044
63045
63046
63047
63048
63049
63050
63051
63052
63053
63054
63055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63030

def subtype_to_hash
  {
    :id => id,
    :company => company.nil? ? nil : company.to_hash,
    :indirect_tax_number => indirect_tax_number,
    :parent_company => parent_company.nil? ? nil : parent_company.to_hash,
    :beneficiary => beneficiary,
    :business_url => business_url,
    :business_description => business_description,
    :business_address => business_address.nil? ? nil : business_address.to_hash,
    :refund_percentage => refund_percentage.to_f.to_s,
    :chargeback_percentage => chargeback_percentage.to_f.to_s,
    :bank_account_number => ,
    :aba_routing_transit_number => aba_routing_transit_number,
    :trade_sectors => trade_sectors.nil? ? nil : trade_sectors.map { |o| o.value },
    :other_trade_sector => other_trade_sector,
    :third_party_logistics_partners => third_party_logistics_partners.nil? ? nil : third_party_logistics_partners.map { |o| o.to_hash },
    :average_order_weight => average_order_weight.to_f.to_s,
    :package_dimensions => package_dimensions.nil? ? nil : package_dimensions.map { |o| o.to_hash },
    :monthly_average => monthly_average.nil? ? nil : monthly_average.to_hash,
    :dangerous_goods => dangerous_goods.nil? ? nil : dangerous_goods.map { |o| o.value },
    :default_country_of_origin => default_country_of_origin,
    :ratecard => ratecard.nil? ? nil : ratecard.to_hash,
    :created_at => created_at
  }
end

#to_jsonObject



63022
63023
63024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63022

def to_json
  JSON.dump(to_hash)
end